Repository: renproject/multichain
Branch: master
Commit: d2e2ed340047
Files: 217
Total size: 876.5 KB
Directory structure:
gitextract_3n3pcdpe/
├── .github/
│ ├── CODEOWNERS
│ └── workflows/
│ ├── build.yml
│ └── test.yml
├── .gitignore
├── .gitmodules
├── Dockerfile
├── LICENSE
├── README.md
├── api/
│ ├── account/
│ │ └── account.go
│ ├── address/
│ │ └── address.go
│ ├── contract/
│ │ └── contract.go
│ ├── gas/
│ │ └── gas.go
│ └── utxo/
│ └── utxo.go
├── chain/
│ ├── arbitrum/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── avalanche/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── bitcoin/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── bitcoin.go
│ │ ├── bitcoin_suite_test.go
│ │ ├── bitcoin_test.go
│ │ ├── gas.go
│ │ ├── gas_test.go
│ │ ├── utxo.go
│ │ └── utxo_test.go
│ ├── bitcoincash/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── bitcoincash.go
│ │ ├── bitcoincash_suite_test.go
│ │ ├── bitcoincash_test.go
│ │ ├── gas.go
│ │ ├── gas_test.go
│ │ ├── utxo.go
│ │ └── utxo_test.go
│ ├── bsc/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── cosmos/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── cosmos.go
│ │ ├── cosmos_suite_test.go
│ │ ├── cosmos_test.go
│ │ ├── gas.go
│ │ ├── gas_test.go
│ │ └── tx.go
│ ├── digibyte/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── digibyte.go
│ │ ├── digibyte_suite_test.go
│ │ ├── digibyte_test.go
│ │ ├── gas.go
│ │ ├── gas_test.go
│ │ ├── utxo.go
│ │ └── utxo_test.go
│ ├── dogecoin/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── dogecoin.go
│ │ ├── dogecoin_suite_test.go
│ │ ├── dogecoin_test.go
│ │ ├── gas.go
│ │ ├── gas_test.go
│ │ ├── utxo.go
│ │ └── utxo_test.go
│ ├── ethereum/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── evm/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── fantom/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── filecoin/
│ │ ├── account.go
│ │ ├── account_test.go
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── client_test.go
│ │ ├── filecoin.go
│ │ ├── filecoin_suite_test.go
│ │ ├── filecoin_test.go
│ │ ├── gas.go
│ │ └── gas_test.go
│ ├── kava/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── moonbeam/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── optimism/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── polygon/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── client.go
│ │ ├── encode.go
│ │ ├── encode_test.go
│ │ ├── gas.go
│ │ └── tx.go
│ ├── solana/
│ │ ├── address.go
│ │ ├── rpc.go
│ │ ├── solana.go
│ │ ├── solana_ffi.go
│ │ ├── solana_ffi_test.go
│ │ ├── solana_suite_test.go
│ │ ├── solana_test.go
│ │ └── solanarpc.go
│ ├── substrate/
│ │ ├── address.go
│ │ └── address_test.go
│ ├── terra/
│ │ ├── address.go
│ │ ├── address_test.go
│ │ ├── terra.go
│ │ ├── terra_suite_test.go
│ │ └── terra_test.go
│ └── zcash/
│ ├── address.go
│ ├── address_test.go
│ ├── gas.go
│ ├── gas_test.go
│ ├── utxo.go
│ ├── utxo_test.go
│ ├── zcash.go
│ ├── zcash_suite_test.go
│ └── zcash_test.go
├── go.mod
├── go.sum
├── infra/
│ ├── acala/
│ │ ├── Dockerfile
│ │ └── run.sh
│ ├── avalanche/
│ │ ├── Dockerfile
│ │ └── run.sh
│ ├── binance/
│ │ ├── Dockerfile
│ │ ├── Dockerfile-riolta
│ │ └── run.sh
│ ├── bitcoin/
│ │ ├── Dockerfile
│ │ ├── bitcoin.conf
│ │ ├── keygen.go
│ │ └── run.sh
│ ├── bitcoincash/
│ │ ├── Dockerfile
│ │ ├── bitcoin.conf
│ │ └── run.sh
│ ├── digibyte/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── keygen.go
│ │ └── run.sh
│ ├── docker-compose.yaml
│ ├── dogecoin/
│ │ ├── Dockerfile
│ │ ├── dogecoin.conf
│ │ ├── keygen.go
│ │ └── run.sh
│ ├── ethereum/
│ │ ├── Dockerfile
│ │ ├── hardhat.config.js
│ │ ├── package.json
│ │ └── run.sh
│ ├── fantom/
│ │ └── Dockerfile
│ ├── filecoin/
│ │ ├── Dockerfile
│ │ ├── miner.key
│ │ ├── run.sh
│ │ └── user.key
│ ├── goerli/
│ │ ├── Dockerfile
│ │ ├── hardhat.config.js
│ │ ├── package.json
│ │ └── run.sh
│ ├── polygon/
│ │ ├── Dockerfile
│ │ ├── genesis.json
│ │ ├── json-keystore
│ │ ├── nodekey
│ │ ├── password.txt
│ │ ├── run.sh
│ │ └── static-nodes.json
│ ├── terra/
│ │ ├── Dockerfile
│ │ └── run.sh
│ └── zcash/
│ ├── Dockerfile
│ ├── run.sh
│ └── zcash.conf
├── multichain.go
├── multichain_suite_test.go
├── multichain_test.go
└── test.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/CODEOWNERS
================================================
@jazg @tok-kkk
================================================
FILE: .github/workflows/build.yml
================================================
name: Docker Build
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16.6"
- name: Set output
id: push-info
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://tok-kkk:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out solana-ffi with the reference
uses: actions/checkout@v2
with:
repository: renproject/solana-ffi
ref: ${{ env.SOLANA_FFI_COMMIT }}
path: solana-ffi
- name: Install dependencies (Solana FFI)
run: |
sudo apt-get install -y libudev-dev
cd solana-ffi
go get -u github.com/xlab/c-for-go@cef5ec7
make clean
make
go install ./...
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
context: /home/runner/work/multichain/multichain
tags: renbot/multichain:${{ steps.push-info.outputs.tag }}, renbot/multichain:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
================================================
FILE: .github/workflows/test.yml
================================================
name: go
on: [pull_request]
jobs:
test-solana:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Setup environment for Solana tests
run: |
sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)"
cd $GITHUB_WORKSPACE
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
echo ${{ secrets.SOLANA_KEY }} > ~/.config/solana/id.json
docker run -d -h 0.0.0.0 -p 8899:8899 -p 8900:8900 renbot/ren-solana:latest
- name: Sleep until the node is up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests for Solana
run: |
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
cd $GITHUB_WORKSPACE/chain/solana
go test -timeout 100s
test-filecoin:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker run -d -p 1234:1234 -h 0.0.0.0 \
--name infra_filecoin_1 rohitnarurkar/multichain_filecoin:latest
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "10m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-fil=true \
-timeout 1500s
test-zcash:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build zcash
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-zec=true \
-timeout 1500s
test-terra:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
eval `ssh-agent -s`
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build terra
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-luna=true \
-timeout 1500s
test-dogecoin:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build dogecoin
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-doge=true \
-timeout 1500s
test-btc-bch:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build \
bitcoin \
bitcoincash
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-btc=true \
-bch=true \
-timeout 1500s
test-avax:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build avalanche
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-avax=true \
-timeout 1500s
test-ftm:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build fantom
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-ftm=true \
-timeout 1500s
test-polygon:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build polygon
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-matic=true \
-timeout 1500s
test-bsc:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build binance
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-bsc=true \
-timeout 1500s
test-eth:
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: "1.17.13"
id: go
- name: Configure git for Private Modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://jazg:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
submodules: recursive
- name: Caching modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-aw-${{ hashFiles('**/go.sum') }}
- name: Cache extern dependencies (FFI)
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: .extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Install dependency packages
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
- name: Get dependencies
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go get -u github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega@v1.13.0
go get -u golang.org/x/lint/golint
go get -u github.com/loongy/covermerge
go get -u github.com/mattn/goveralls
go get -u github.com/xlab/c-for-go@cef5ec7
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE
mkdir .extern && cd .extern
git clone https://github.com/filecoin-project/filecoin-ffi.git
cd filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
cd $GITHUB_WORKSPACE/.extern
git clone https://github.com/renproject/solana-ffi.git
cd solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Run vetting
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source $HOME/.cargo/env
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
go mod tidy
go vet ./...
- name: Run linting
run: |
cd $GITHUB_WORKSPACE
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
golint $(go list ./... | grep -v filecoin-ffi)
- name: Run multichain infrastructure
run: |
cd $GITHUB_WORKSPACE/infra
source .env
docker-compose up -d --build ethereum
- name: Sleep until the nodes are up
uses: jakejarvis/wait-action@master
with:
time: "1m"
- name: Check on docker containers
run: docker ps -a
- name: Run tests and report test coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PATH=$PATH:$(go env GOPATH)/bin
source ./infra/.env
cd $GITHUB_WORKSPACE
go test \
-eth=true \
-timeout 1500s
================================================
FILE: .gitignore
================================================
# Binaries and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Tests
*.test
# Outputs from tools
*.out
# IDE specific files
.idea/
================================================
FILE: .gitmodules
================================================
[submodule "chain/filecoin/filecoin-ffi"]
path = chain/filecoin/filecoin-ffi
url = https://github.com/filecoin-project/filecoin-ffi
[submodule "chain/solana/solana-ffi"]
path = chain/solana/solana-ffi
url = https://github.com/renproject/solana-ffi
================================================
FILE: Dockerfile
================================================
FROM golang
# doing all updates and installs in a single step and removing the apt cache helps reduce the image size
RUN apt-get update && \
apt-get install -y \
mesa-opencl-icd \
ocl-icd-opencl-dev \
libssl-dev \
libudev-dev \
hwloc \
libhwloc-dev \
gcc \
git \
bzr \
jq \
pkg-config \
curl \
wget && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN mkdir -p $(go env GOPATH)
WORKDIR $GOPATH
RUN mkdir -p src/github.com/filecoin-project
WORKDIR $GOPATH/src/github.com/filecoin-project
RUN git clone https://github.com/filecoin-project/filecoin-ffi
WORKDIR $GOPATH/src/github.com/filecoin-project/filecoin-ffi
RUN git checkout 7912389334e347bbb2eac0520c836830875c39de
RUN make
RUN go install
COPY ./solana-ffi $GOPATH/src/github.com/renproject/solana-ffi
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
# `🔗 multichain`
## Layout
`/` declares the assets and chains that exist, but provides no chain-specific implementations.
`/infra` defines a local deployment of the multichain using `docker-compose`. All underlying chains provide a `Dockerfile` and service definition to make running node instances easy. All chains need to add a `Dockerfile` and service definition that allows the multichain to spin up a local development-mode instance of the chain. This is necessary for running comprehensive local test suites.
`/api` defines the different compatibility APIs that exist: Account, Address, Contract, Gas, and UTXO. Chains should implement the APIs that are relevant to them. For example, Bitcoin (and its forks) implements the Address, Gas, and UTXO APIs. No actual implementations should be added to this folder.
`/chain` defines all of the chain-specific implementations of the APIs. Each chain has its own sub-package. For example, Bitcoin, Bitcoin Cash, Dogecoin, and Zcash are all chains that implement the Address, Gas, and UTXO APIs, and each of these implementations are in `/chain/bitcoin`, `/chain/bitcoincash`, `/chain/dogecoin`, and `/chain/zcash` respectively.
## Example
The `🔗 multichain` is designed to be flexible enough to support any kind of chain. Anyone is free to contribute to the `🔗 multichain` by adding support for a new chain, or improving support for an existing chain. To show how this is done, we will walk-through an example: adding support for Dogecoin.
### Chains and Assets
Before doing anything else, let's add an enumeration for the `Asset` and `Chain` types, which can be found in `package multichain`. To avoid favouritism, all assets and chains are listed in alphabetical order. Unless otherwise advised by an offiical team member, the names and tickers found on https://coinmarketcap.com must be used.
Adding an `Asset`:
```go
// Enumeration of supported assets. When introducing a new chain, or new asset
// from an existing chain, you must add a human-readable string to this set of
// enumerated values. Assets must be listed in alphabetical order.
const (
BCH = Asset("BCH") // Bitcoin Cash
BTC = Asset("BTC") // Bitcoin
DOGE = Asset("DOGE") // Dogecoin (This is our new asset!)
ETH = Asset("ETH") // Ether
ZEC = Asset("ZEC") // Zcash
)
```
Adding a `Chain`:
```go
// Enumeration of supported chains. When introducing a new chain, you must add a
// human-readable string to this set of enumerated values. Chains must be listed
// in alphabetical order.
const (
Bitcoin = Chain("Bitcoin")
BitcoinCash = Chain("BitcoinCash")
Dogecoin = Chain("Dogecoin") // (This is our new chain!)
Ethereum = Chain("Ethereum")
Zcash = Chain("Zcash")
)
```
### Docker
Next, we need to setup a Docker container in the `/infra` folder. This is needed for local test suites, allowing for end-to-end integrated testing directly against a node. Doing this requires a couple of steps.
First, we create a new `dogecoin/` folder in the `/infra` folder:
```
/infra
|-- /bitcoin
|-- /bitcoincash
|-- /dogecoin # This is our new folder!
| |-- Dockerfile # This is our new Dockerfile!
| |-- dogecoin.conf
| |-- run.sh # This is our new run file!
|-- /zcash
|-- .env
|-- docker-compose.yaml
```
The new folder _must_ at least contain a `Dockerfile` that installs the node, and a `run.sh` file that runs the nodes. The node _should_ be run in test mode. The new folder can also contain other files that are specific to the needs of the chain being added. In our case, the `dogecoin.conf` file is also needed to configure the node. (We will omit showing all the code here, since there is quite a bit of it, but you can check it out in the `/infra/dogecoin` folder.)
Second, we add an entry to the `.env` file. Our entry _must_ include a private key that will have access to funds, and the public address associated with that private key. We will add:
```sh
#
# Dogecoin
#
# Address that will receive mining rewards. Generally, this is set to an address
# for which the private key is known by a test suite. This allows the test suite
# access to plenty of testing funds.
export DOGECOIN_PK=cRZnRgH2ztcJupCzkWbq2mjiT8PSFAmtYRYb1phg1vSRRcNBX4w4
export DOGECOIN_ADDRESS=n3PSSpR4zqUKWH4tcRjP9aTwJ4GmixQXmt
```
Last, we add a service to the `docker-compose.yaml` file. This allows the node to boot alongside the other nodes in the multichain. This entry must expose the node for use in tests, and must not overlap with other nodes that already exist (ports are reserved on a first-come-first-serve basis). We will define the service as:
```yaml
##
## Dogecoin
##
dogecoin:
build:
context: ./dogecoin
ports:
- "0.0.0.0:18332:18332"
entrypoint:
- "./root/run.sh"
- "${DOGECOIN_ADDRESS}"
```
### Address API
All chains _should_ implement the Address API. Luckily for Dogecoin, it is so similar to Bitcoin that we can re-export the Bitcoin implementation without the need for custom modifications. In `/chain/dogecoin/address.go` we add:
```go
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
type (
AddressEncoder = bitcoin.AddressEncoder
AddressDecoder = bitcoin.AddressDecoder
AddressEncodeDecoder = bitcoin.AddressEncodeDecoder
)
```
These three interfaces allow users of the `🔗 multichain` to easily encode and decode Dogecoin addresses. Other chains will need to provide their own implementations, based on their chains address standards.
### Gas API
Most, but not all, chains _should_ implement the Gas API. Again, Dogecoin is so similar to Bitcoin that we can re-export the Bitcoin implementation in `/chain/dogecoin/gas.go`:
```go
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
type GasEstimator = bitcoin.GasEstimator
var NewGasEstimator = bitcoin.NewGasEstimator
```
The interface allows users of the `🔗 multichain` to estimate gas prices (although, the current implementation is _very_ simple). The associated function allows users to construct an instance of the interface for Dogecoin.
### UTXO API
Generally speaking, chains fall into two categories: account-based or UTXO-based (and some can even be both). Bitcoin, and its forks, are all UTXO-based chains. As a fork of Bitcoin, Dogecoin is a UTXO-based chain, so we implement the UTXO API. To implement the UTXO API, we must implement the `Tx`, `TxBuilder`, and `Client` interfaces. More information can be found in the comments of `/api/utxo` folder.
Again, the implementation for Dogecoin is trivial. In `/chain/dogecoin/utxo`, we have:
```go
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
type (
Tx = bitcoin.Tx
TxBuilder = bitcoin.TxBuilder
Client = bitcoin.Client
ClientOptions = bitcoin.ClientOptions
)
var (
NewTxBuilder = bitcoin.NewTxBuilder
NewClient = bitcoin.NewClient
DefaultClientOptions = bitcoin.DefaultClientOptions
)
```
Up to this point, we have done nothing but re-export Bitcoin. So what makes Dogecoin different? And how can we express that difference? Well, the `/chain/dogecoin` folder is the place where we must define anything else Dogecoin users will need. In the case of Dogecoin, the only thing that differentiates it from Bitcoin is the `*chaincfg.Param` object. We define this in `/chain/dogecoin/dogecoin.go`:
```go
package dogecoin
import (
"github.com/btcsuite/btcd/chaincfg"
)
func init() {
if err := chaincfg.Register(&MainNetParams); err != nil {
panic(err)
}
if err := chaincfg.Register(&RegressionNetParams); err != nil {
panic(err)
}
}
var MainNetParams = chaincfg.Params{
Name: "mainnet",
Net: 0xc0c0c0c0,
// Address encoding magics
PubKeyHashAddrID: 30,
ScriptHashAddrID: 22,
PrivateKeyID: 158,
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x02, 0xfa, 0xc3, 0x98}, // starts with xprv
HDPublicKeyID: [4]byte{0x02, 0xfa, 0xca, 0xfd}, // starts with xpub
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173. Dogecoin does not actually support this, but we do not want to
// collide with real addresses, so we specify it.
Bech32HRPSegwit: "doge",
}
var RegressionNetParams = chaincfg.Params{
Name: "regtest",
// Dogecoin has 0xdab5bffa as RegTest (same as Bitcoin's RegTest).
// Setting it to an arbitrary value (leet_hex(dogecoin)), so that we can
// register the regtest network.
Net: 0xd063c017,
// Address encoding magics
PubKeyHashAddrID: 111,
ScriptHashAddrID: 196,
PrivateKeyID: 239,
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with xpub
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173. Dogecoin does not actually support this, but we do not want to
// collide with real addresses, so we specify it.
Bech32HRPSegwit: "dogert",
}
```
Most of the functions that we have re-exported expected `*chaincfg.Params` as an argument. By defining one for regnet and mainnet, users can construct Dogecoin instances of the UTXO API by using these params.
## Test Suite
1. Install Docker
2. Install Docker Compose
3. Run Docker
4. Run `./test.sh`
Example output:
```sh
Creating network "docker_default" with the default driver
Building bitcoin
...
Successfully built 1ebb03faa04f
Successfully tagged docker_bitcoin:latest
Building bitcoincash
...
Successfully built e12e98011869
Successfully tagged docker_bitcoincash:latest
Building zcash
...
Successfully built 56231a29ca2e
Successfully tagged docker_zcash:latest
docker_bitcoin_1 is up-to-date
docker_bitcoincash_1 is up-to-date
docker_zcash_1 is up-to-date
Waiting for multichain to boot...
=== RUN TestMultichain
Running Suite: Multichain Suite
===============================
...
Stopping docker_bitcoincash_1 ... done
Stopping docker_zcash_1 ... done
Stopping docker_bitcoin_1 ... done
Removing docker_bitcoincash_1 ... done
Removing docker_zcash_1 ... done
Removing docker_bitcoin_1 ... done
Removing network docker_default
Done!
```
================================================
FILE: api/account/account.go
================================================
// Package account defines the Account API. All chains that use an account-based
// model should implement this API. The Account API is used to send and confirm
// transactions between addresses.
package account
import (
"context"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
)
// The Tx interfaces defines the functionality that must be exposed by
// account-based transactions.
type Tx interface {
// Hash that uniquely identifies the transaction. Hashes are usually the
// result of an irreversible hashing function applied to some serialized
// representation of the transaction.
Hash() pack.Bytes
// From returns the address from which value is being sent.
From() address.Address
// To returns the address to which value is being sent.
To() address.Address
// Value being sent from one address to another.
Value() pack.U256
// Nonce used to order the transaction with respect to all other
// transactions signed and submitted by the sender of this transaction.
Nonce() pack.U256
// Payload returns arbitrary data that is associated with the transaction.
// This payload is often used to send notes between external accounts, or
// call functions on a contract.
Payload() contract.CallData
// Sighashes that must be signed before the transaction can be submitted by
// the client.
Sighashes() ([]pack.Bytes32, error)
// Sign the transaction by injecting signatures for the required sighashes.
// The serialized public key used to sign the sighashes should also be
// specified whenever it is available.
Sign([]pack.Bytes65, pack.Bytes) error
// Serialize the transaction into bytes. This is the format in which the
// transaction will be submitted by the client.
Serialize() (pack.Bytes, error)
}
// The TxBuilder interface defines the functionality required to build
// account-based transactions. Most chain implementations require additional
// information, and this should be accepted during the construction of the
// chain-specific transaction builder.
type TxBuilder interface {
BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gasLimit, gasPrice, gasCap pack.U256, payload pack.Bytes) (Tx, error)
}
// The Client interface defines the functionality required to interact with a
// chain over RPC.
type Client interface {
// LatestBlock returns the block number of the latest block.
LatestBlock(context.Context) (pack.U64, error)
// AccountBalance returns the current balance of the given account.
AccountBalance(context.Context, address.Address) (pack.U256, error)
// AccountNonce is the current nonce of this account, which must be used to
// build a new transaction.
AccountNonce(context.Context, address.Address) (pack.U256, error)
// Tx returns the transaction uniquely identified by the given transaction
// hash. It also returns the number of confirmations for the transaction. If
// the transaction cannot be found before the context is done, or the
// transaction is invalid, then an error should be returned.
Tx(context.Context, pack.Bytes) (Tx, pack.U64, error)
// SubmitTx to the underlying chain. If the transaction cannot be found
// before the context is done, or the transaction is invalid, then an error
// should be returned.
SubmitTx(context.Context, Tx) error
}
================================================
FILE: api/address/address.go
================================================
// Package address defines the Address API. All chains must implement this API,
// so that addresses can be encoded/decoded.
package address
import "github.com/renproject/pack"
// An Address is a human-readable representation of a public identity. It can be
// the address of an external account, contract, or script.
type Address pack.String
// SizeHint returns the number of bytes required to represent the address in
// binary.
func (addr Address) SizeHint() int {
return pack.String(addr).SizeHint()
}
// Marshal the address to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (addr Address) Marshal(buf []byte, rem int) ([]byte, int, error) {
return pack.String(addr).Marshal(buf, rem)
}
// Unmarshal the address from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (addr *Address) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return (*pack.String)(addr).Unmarshal(buf, rem)
}
// RawAddress is an address that has been decoded into its binary form.
type RawAddress pack.Bytes
// SizeHint returns the number of bytes required to represent the address in
// binary.
func (addr RawAddress) SizeHint() int {
return pack.Bytes(addr).SizeHint()
}
// Marshal the address to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (addr RawAddress) Marshal(buf []byte, rem int) ([]byte, int, error) {
return pack.Bytes(addr).Marshal(buf, rem)
}
// Unmarshal the address from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (addr *RawAddress) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return (*pack.Bytes)(addr).Unmarshal(buf, rem)
}
// The Encoder interface is used to convert raw addresses into human-readable
// addresses.
type Encoder interface {
EncodeAddress(RawAddress) (Address, error)
}
// The Decoder interfaces is used to convert human-readable addresses into raw
// addresses.
type Decoder interface {
DecodeAddress(Address) (RawAddress, error)
}
// The EncodeDecoder interfaces combines encoding and decoding functionality
// into one interface.
type EncodeDecoder interface {
Encoder
Decoder
}
================================================
FILE: api/contract/contract.go
================================================
// Package contract defines the Contract API. All chains that have "smart
// contracts" should implement this API. UTXO-based chains that support
// scripting must not attempt to implementing scripting using this API.
package contract
import (
"context"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
)
// CallData is used to specify a function and its parameters when invoking
// business logic on a contract.
type CallData pack.Bytes
// SizeHint returns the number of bytes required to represent the calldata in
// binary.
func (data CallData) SizeHint() int {
return pack.Bytes(data).SizeHint()
}
// Marshal the address to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (data CallData) Marshal(buf []byte, rem int) ([]byte, int, error) {
return pack.Bytes(data).Marshal(buf, rem)
}
// Unmarshal the address from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (data *CallData) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return (*pack.Bytes)(data).Unmarshal(buf, rem)
}
// The Caller interface defines the functionality required to call readonly
// functions on a contract. Calling functions that mutate contract state should
// be done using the Account API.
type Caller interface {
// CallContract at the specified address, using the specified calldata as
// input (this encodes the function and its parameters). The function output
// is returned as raw uninterpreted bytes. It is up to the application to
// interpret these bytes in a meaningful way. If the call cannot be
// completed before the context is done, or the call is invalid, then an
// error should be returned.
CallContract(context.Context, address.Address, CallData) (pack.Bytes, error)
}
================================================
FILE: api/gas/gas.go
================================================
// Package gas defines the Gas API. All chains that support transactions (either
// account-based or utxo-based) should implement this API. This API is used to
// understand the current recommended gas costs required to get confirmations in
// a reasonable amount of time.
package gas
import (
"context"
"github.com/renproject/pack"
)
// The Estimator interface defines the functionality required to know the
// current recommended gas price per gas unit and gas cap per gas unit. Not all
// chains have the concept of a gas cap, in which case it should be set to be
// equal to the gas price.
type Estimator interface {
// EstimateGas base/price that should be used in order to get a transaction
// confirmed within a reasonable amount of time. The precise definition of
// "reasonable amount of time" varies from chain to chain, and so is left
// open to interpretation by the implementation.
// For example, in Bitcoin, the gas price (and gas cap) would be the
// recommended SATs-per-byte required to get a transaction into the next
// block.
// In Ethereum without EIP-1559, the gas price (and gas cap) would be the
// recommended GWEI-per-gas required to get a transaction into one of the
// next few blocks (because blocks happen a lot faster). In Ethereum with
// EIP1559, the gas price and gas cap would be back calculated given the gas
// cap and an estimate of the current gas base.
//
// The assumption is that the total gas cost will be gasLimit * gasPrice <
// gasLimit * gasCap. If chain nodes give back values based on different
// assumptions, then the values must be normalised as needed.
EstimateGas(context.Context) (gasPrice, gasCap pack.U256, err error)
}
================================================
FILE: api/utxo/utxo.go
================================================
// Package utxo defines the UTXO API. All chains that use a utxo-based model
// should implement this API. The UTXO API is used to send and confirm
// transactions between addresses.
package utxo
import (
"context"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
)
// An Outpoint identifies a specific output produced by a transaction.
type Outpoint struct {
Hash pack.Bytes `json:"hash"`
Index pack.U32 `json:"index"`
}
// An Output is produced by a transaction. It includes the conditions required
// to spend the output (called the pubkey script, based on Bitcoin).
type Output struct {
Outpoint `json:"outpoint"`
Value pack.U256 `json:"value"`
PubKeyScript pack.Bytes `json:"pubKeyScript"`
}
// An Input specifies an existing output, produced by a previous transaction, to
// be consumed by another transaction. It includes the script that meets the
// conditions specified by the consumed output (called the sig script, based on
// Bitcoin).
type Input struct {
Output `json:"output"`
SigScript pack.Bytes `json:"sigScript"`
}
// A Recipient specifies an address, and an amount, for which a transaction will
// produce an output. Depending on the output, the address can take on different
// formats (e.g. in Bitcoin, addresses can be P2PK, P2PKH, or P2SH).
type Recipient struct {
To address.Address `json:"to"`
Value pack.U256 `json:"value"`
}
// The Tx interfaces defines the functionality that must be exposed by
// utxo-based transactions.
type Tx interface {
// Hash returns the hash that uniquely identifies the transaction.
// Generally, hashes are irreversible hash functions that consume the
// content of the transaction.
Hash() (pack.Bytes, error)
// Inputs consumed by the transaction.
Inputs() ([]Input, error)
// Outputs produced by the transaction.
Outputs() ([]Output, error)
// Sighashes that must be signed before the transaction can be submitted by
// the client.
Sighashes() ([]pack.Bytes32, error)
// Sign the transaction by injecting signatures for the required sighashes.
// The serialized public key used to sign the sighashes should also be
// specified whenever it is available.
Sign([]pack.Bytes65, pack.Bytes) error
// Serialize the transaction into bytes. This is the format in which the
// transaction will be submitted by the client.
Serialize() (pack.Bytes, error)
}
// The TxBuilder interface defines the functionality required to build
// account-based transactions. Most chain implementations require additional
// information, and this should be accepted during the construction of the
// chain-specific transaction builder.
type TxBuilder interface {
BuildTx([]Input, []Recipient) (Tx, error)
}
// The Client interface defines the functionality required to interact with a
// chain over RPC.
type Client interface {
// LatestBlock returns the height of the longest blockchain.
LatestBlock(context.Context) (pack.U64, error)
// Output returns the transaction output identified by the given outpoint.
// It also returns the number of confirmations for the output. If the output
// cannot be found before the context is done, or the output is invalid,
// then an error should be returned. This method will not error, even if the
// output has been spent.
Output(context.Context, Outpoint) (Output, pack.U64, error)
// UnspentOutput returns the unspent transaction output identified by the
// given outpoint. It also returns the number of confirmations for the
// output. If the output cannot be found before the context is done, the
// output is invalid, or the output has been spent, then an error should be
// returned.
UnspentOutput(context.Context, Outpoint) (Output, pack.U64, error)
// SubmitTx to the underlying chain. If the transaction cannot be found
// before the context is done, or the transaction is invalid, then an error
// should be returned.
SubmitTx(context.Context, Tx) error
// TxSenders returns the senders' addresses of the transaction.
TxSenders(context.Context, pack.Bytes) ([]pack.String, error)
}
================================================
FILE: chain/arbitrum/address.go
================================================
package arbitrum
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/arbitrum/address_test.go
================================================
package arbitrum_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/arbitrum"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := arbitrum.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr arbitrum.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := arbitrum.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr arbitrum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr arbitrum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr arbitrum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr arbitrum.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/arbitrum/client.go
================================================
package arbitrum
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// arbitrum node.
DefaultClientRPCURL = "http://127.0.0.1:8547"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/arbitrum/encode.go
================================================
package arbitrum
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/arbitrum/encode_test.go
================================================
package arbitrum_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/arbitrum"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := arbitrum.Address(x)
resBytes := arbitrum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { arbitrum.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr arbitrum.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := arbitrum.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/arbitrum/gas.go
================================================
package arbitrum
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/arbitrum/tx.go
================================================
package arbitrum
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/avalanche/address.go
================================================
package avalanche
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/avalanche/address_test.go
================================================
package avalanche_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/avalanche"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := avalanche.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr avalanche.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := avalanche.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr avalanche.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr avalanche.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr avalanche.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr avalanche.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/avalanche/client.go
================================================
package avalanche
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// avalanche node.
DefaultClientRPCURL = "http://127.0.0.1:9650/ext/bc/C/rpc"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/avalanche/encode.go
================================================
package avalanche
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/avalanche/encode_test.go
================================================
package avalanche_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/avalanche"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := avalanche.Address(x)
resBytes := avalanche.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { avalanche.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr avalanche.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := avalanche.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/avalanche/gas.go
================================================
package avalanche
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/avalanche/tx.go
================================================
package avalanche
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/bitcoin/address.go
================================================
package bitcoin
import (
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/base58"
"github.com/renproject/multichain/api/address"
)
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// NewAddressEncodeDecoder constructs a new AddressEncodeDecoder with the
// chain specific configurations
func NewAddressEncodeDecoder(params *chaincfg.Params) AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: NewAddressEncoder(params),
AddressDecoder: NewAddressDecoder(params),
}
}
// AddressEncoder encapsulates the chain specific configurations and implements
// the address.Encoder interface
type AddressEncoder struct {
params *chaincfg.Params
}
// NewAddressEncoder constructs a new AddressEncoder with the chain specific
// configurations
func NewAddressEncoder(params *chaincfg.Params) AddressEncoder {
return AddressEncoder{params: params}
}
// EncodeAddress implements the address.Encoder interface
func (encoder AddressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error) {
switch len(rawAddr) {
case 25:
return encoder.encodeBase58(rawAddr)
case 21, 33:
return encoder.encodeBech32(rawAddr)
default:
return address.Address(""), fmt.Errorf("non-exhaustive pattern: address length %v", len(rawAddr))
}
}
func (encoder AddressEncoder) encodeBase58(rawAddr address.RawAddress) (address.Address, error) {
// Validate that the base58 address is in fact in correct format.
encodedAddr := base58.Encode([]byte(rawAddr))
if _, err := btcutil.DecodeAddress(encodedAddr, encoder.params); err != nil {
return address.Address(""), err
}
return address.Address(encodedAddr), nil
}
func (encoder AddressEncoder) encodeBech32(rawAddr address.RawAddress) (address.Address, error) {
switch len(rawAddr) {
case 21:
addr, err := btcutil.NewAddressWitnessPubKeyHash(rawAddr[1:], encoder.params)
if err != nil {
return address.Address(""), fmt.Errorf("new address witness pubkey hash: %v", err)
}
return address.Address(addr.EncodeAddress()), nil
case 33:
addr, err := btcutil.NewAddressWitnessScriptHash(rawAddr[1:], encoder.params)
if err != nil {
return address.Address(""), fmt.Errorf("new address witness script hash: %v", err)
}
return address.Address(addr.EncodeAddress()), nil
default:
return address.Address(""), fmt.Errorf("non-exhaustive pattern: bech32 address length %v", len(rawAddr))
}
}
// AddressDecoder encapsulates the chain specific configurations and implements
// the address.Decoder interface
type AddressDecoder struct {
params *chaincfg.Params
}
// NewAddressDecoder constructs a new AddressDecoder with the chain specific
// configurations
func NewAddressDecoder(params *chaincfg.Params) AddressDecoder {
return AddressDecoder{params: params}
}
// DecodeAddress implements the address.Decoder interface
func (decoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error) {
// The btcutil package assumes the address being decoded only contains
// valid ASCII characters between 0-255.
for _, c := range addr {
if c > 255 {
return nil, fmt.Errorf("invalid address: bad character %v", c)
}
}
decodedAddr, err := btcutil.DecodeAddress(string(addr), decoder.params)
if err != nil {
return nil, fmt.Errorf("decode address: %v", err)
}
if !decodedAddr.IsForNet(decoder.params) {
return nil, fmt.Errorf("address of different network")
}
switch a := decodedAddr.(type) {
case *btcutil.AddressPubKeyHash, *btcutil.AddressScriptHash:
return address.RawAddress(base58.Decode(string(addr))), nil
case *btcutil.AddressWitnessPubKeyHash:
rawAddr := append([]byte{a.WitnessVersion()}, a.WitnessProgram()...)
return address.RawAddress(rawAddr), nil
case *btcutil.AddressWitnessScriptHash:
rawAddr := append([]byte{a.WitnessVersion()}, a.WitnessProgram()...)
return address.RawAddress(rawAddr), nil
default:
return nil, fmt.Errorf("non-exhaustive pattern: address %T", a)
}
}
================================================
FILE: chain/bitcoin/address_test.go
================================================
package bitcoin_test
import (
"github.com/btcsuite/btcd/chaincfg"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/bitcoin"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bitcoin", func() {
Context("when decoding address with invalid characters", func() {
It("should not panic", func() {
decoder := bitcoin.NewAddressDecoder(&chaincfg.MainNetParams)
Expect(func() {
_, err := decoder.DecodeAddress(address.Address(rune(256)))
Expect(err).To(HaveOccurred())
}).ToNot(Panic())
})
})
})
================================================
FILE: chain/bitcoin/bitcoin.go
================================================
package bitcoin
import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"log"
"math/rand"
"net/http"
"time"
"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcutil"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/pack"
)
const (
// DefaultClientTimeout used by the Client.
DefaultClientTimeout = time.Minute
// DefaultClientTimeoutRetry used by the Client.
DefaultClientTimeoutRetry = time.Second
// DefaultClientHost used by the Client. This should only be used for local
// deployments of the multichain.
DefaultClientHost = "http://0.0.0.0:18443"
// DefaultClientUser used by the Client. This is insecure, and should only
// be used for local — or publicly accessible — deployments of the
// multichain.
DefaultClientUser = "user"
// DefaultClientPassword used by the Client. This is insecure, and should
// only be used for local — or publicly accessible — deployments of the
// multichain.
DefaultClientPassword = "password"
)
// ClientOptions are used to parameterise the behaviour of the Client.
type ClientOptions struct {
Timeout time.Duration
TimeoutRetry time.Duration
Host string
User string
Password string
}
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return ClientOptions{
Timeout: DefaultClientTimeout,
TimeoutRetry: DefaultClientTimeoutRetry,
Host: DefaultClientHost,
User: DefaultClientUser,
Password: DefaultClientPassword,
}
}
// WithHost sets the URL of the Bitcoin node.
func (opts ClientOptions) WithHost(host string) ClientOptions {
opts.Host = host
return opts
}
// WithUser sets the username that will be used to authenticate with the Bitcoin
// node.
func (opts ClientOptions) WithUser(user string) ClientOptions {
opts.User = user
return opts
}
// WithPassword sets the password that will be used to authenticate with the
// Bitcoin node.
func (opts ClientOptions) WithPassword(password string) ClientOptions {
opts.Password = password
return opts
}
// A Client interacts with an instance of the Bitcoin network using the RPC
// interface exposed by a Bitcoin node.
type Client interface {
utxo.Client
// UnspentOutputs spendable by the given address.
UnspentOutputs(ctx context.Context, minConf, maxConf int64, address address.Address) ([]utxo.Output, error)
// Confirmations of a transaction in the Bitcoin network.
Confirmations(ctx context.Context, txHash pack.Bytes) (int64, error)
// EstimateSmartFee
EstimateSmartFee(ctx context.Context, numBlocks int64) (float64, error)
// EstimateFeeLegacy
EstimateFeeLegacy(ctx context.Context, numBlocks int64) (float64, error)
}
type client struct {
opts ClientOptions
httpClient http.Client
}
// NewClient returns a new Client.
func NewClient(opts ClientOptions) Client {
httpClient := http.Client{}
httpClient.Timeout = opts.Timeout
return &client{
opts: opts,
httpClient: httpClient,
}
}
// LatestBlock returns the height of the longest blockchain.
func (client *client) LatestBlock(ctx context.Context) (pack.U64, error) {
var resp int64
if err := client.send(ctx, &resp, "getblockcount"); err != nil {
return pack.NewU64(0), fmt.Errorf("get block count: %v", err)
}
if resp < 0 {
return pack.NewU64(0), fmt.Errorf("unexpected block count, expected > 0, got: %v", resp)
}
return pack.NewU64(uint64(resp)), nil
}
// Output associated with an outpoint, and its number of confirmations.
func (client *client) Output(ctx context.Context, outpoint utxo.Outpoint) (utxo.Output, pack.U64, error) {
resp := btcjson.TxRawResult{}
hash := chainhash.Hash{}
copy(hash[:], outpoint.Hash)
if err := client.send(ctx, &resp, "getrawtransaction", hash.String(), 1); err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad \"getrawtransaction\": %v", err)
}
if outpoint.Index.Uint32() >= uint32(len(resp.Vout)) {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad index: %v is out of range", outpoint.Index)
}
vout := resp.Vout[outpoint.Index.Uint32()]
amount, err := btcutil.NewAmount(vout.Value)
if err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad amount: %v", err)
}
if amount < 0 {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad amount: %v", amount)
}
pubKeyScript, err := hex.DecodeString(vout.ScriptPubKey.Hex)
if err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad pubkey script: %v", err)
}
output := utxo.Output{
Outpoint: outpoint,
Value: pack.NewU256FromU64(pack.NewU64(uint64(amount))),
PubKeyScript: pack.NewBytes(pubKeyScript),
}
return output, pack.NewU64(resp.Confirmations), nil
}
// UnspentOutput returns the unspent transaction output identified by the
// given outpoint. It also returns the number of confirmations for the
// output. If the output cannot be found before the context is done, the
// output is invalid, or the output has been spent, then an error should be
// returned.
func (client *client) UnspentOutput(ctx context.Context, outpoint utxo.Outpoint) (utxo.Output, pack.U64, error) {
resp := btcjson.GetTxOutResult{}
hash := chainhash.Hash{}
copy(hash[:], outpoint.Hash)
if err := client.send(ctx, &resp, "gettxout", hash.String(), outpoint.Index.Uint32()); err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad \"gettxout\": %v", err)
}
amount, err := btcutil.NewAmount(resp.Value)
if err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad amount: %v", err)
}
if amount < 0 {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad amount: %v", amount)
}
if resp.Confirmations < 0 {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad confirmations: %v", resp.Confirmations)
}
pubKeyScript, err := hex.DecodeString(resp.ScriptPubKey.Hex)
if err != nil {
return utxo.Output{}, pack.NewU64(0), fmt.Errorf("bad pubkey script: %v", err)
}
output := utxo.Output{
Outpoint: outpoint,
Value: pack.NewU256FromU64(pack.NewU64(uint64(amount))),
PubKeyScript: pack.NewBytes(pubKeyScript),
}
return output, pack.NewU64(uint64(resp.Confirmations)), nil
}
// SubmitTx to the Bitcoin network.
func (client *client) SubmitTx(ctx context.Context, tx utxo.Tx) error {
serial, err := tx.Serialize()
if err != nil {
return fmt.Errorf("bad tx: %v", err)
}
resp := ""
if err := client.send(ctx, &resp, "sendrawtransaction", hex.EncodeToString(serial)); err != nil {
return fmt.Errorf("bad \"sendrawtransaction\": %v", err)
}
return nil
}
// TxSenders returns the senders of the transaction.
func (client *client) TxSenders(ctx context.Context, id pack.Bytes) ([]pack.String, error) {
resp, err := client.getRawTransaction(ctx, id)
if err != nil {
return nil, fmt.Errorf("bad \"getrawtransaction\": %v", err)
}
addrs := make([]pack.String, 0)
for _, vin := range resp.Vin {
txHash, err := chainhash.NewHashFromStr(vin.Txid)
if err != nil {
return nil, err
}
rawTx, err := client.getRawTransaction(ctx, txHash.CloneBytes())
if err != nil {
return nil, err
}
for _, addr := range rawTx.Vout[int(vin.Vout)].ScriptPubKey.Addresses {
addrs = append(addrs, pack.String(addr))
}
}
return addrs, nil
}
// UnspentOutputs spendable by the given address.
func (client *client) UnspentOutputs(ctx context.Context, minConf, maxConf int64, addr address.Address) ([]utxo.Output, error) {
resp := []btcjson.ListUnspentResult{}
if err := client.send(ctx, &resp, "listunspent", minConf, maxConf, []string{string(addr)}); err != nil && err != io.EOF {
return []utxo.Output{}, fmt.Errorf("bad \"listunspent\": %v", err)
}
outputs := make([]utxo.Output, len(resp))
for i := range outputs {
amount, err := btcutil.NewAmount(resp[i].Amount)
if err != nil {
return []utxo.Output{}, fmt.Errorf("bad amount: %v", err)
}
if amount < 0 {
return []utxo.Output{}, fmt.Errorf("bad amount: %v", amount)
}
pubKeyScript, err := hex.DecodeString(resp[i].ScriptPubKey)
if err != nil {
return []utxo.Output{}, fmt.Errorf("bad pubkey script: %v", err)
}
txid, err := chainhash.NewHashFromStr(resp[i].TxID)
if err != nil {
return []utxo.Output{}, fmt.Errorf("bad txid: %v", err)
}
outputs[i] = utxo.Output{
Outpoint: utxo.Outpoint{
Hash: pack.NewBytes(txid[:]),
Index: pack.NewU32(resp[i].Vout),
},
Value: pack.NewU256FromU64(pack.NewU64(uint64(amount))),
PubKeyScript: pack.NewBytes(pubKeyScript),
}
}
return outputs, nil
}
// Confirmations of a transaction in the Bitcoin network.
func (client *client) Confirmations(ctx context.Context, txHash pack.Bytes) (int64, error) {
resp := btcjson.GetTransactionResult{}
size := len(txHash)
txHashReversed := make([]byte, size)
copy(txHashReversed[:], txHash[:])
for i := 0; i < size/2; i++ {
txHashReversed[i], txHashReversed[size-1-i] = txHashReversed[size-1-i], txHashReversed[i]
}
if err := client.send(ctx, &resp, "gettransaction", hex.EncodeToString(txHashReversed)); err != nil {
return 0, fmt.Errorf("bad \"gettransaction\": %v", err)
}
confirmations := resp.Confirmations
if confirmations < 0 {
confirmations = 0
}
return confirmations, nil
}
// EstimateSmartFee fetches the estimated bitcoin network fees to be paid (in
// BTC per kilobyte) needed for a transaction to be confirmed within `numBlocks`
// blocks. An error will be returned if the bitcoin node hasn't observed enough
// blocks to make an estimate for the provided target `numBlocks`.
func (client *client) EstimateSmartFee(ctx context.Context, numBlocks int64) (float64, error) {
resp := btcjson.EstimateSmartFeeResult{}
if err := client.send(ctx, &resp, "estimatesmartfee", numBlocks); err != nil {
return 0.0, fmt.Errorf("estimating smart fee: %v", err)
}
if resp.Errors != nil && len(resp.Errors) > 0 {
return 0.0, fmt.Errorf("estimating smart fee: %v", resp.Errors[0])
}
return *resp.FeeRate, nil
}
func (client *client) EstimateFeeLegacy(ctx context.Context, numBlocks int64) (float64, error) {
var resp float64
switch numBlocks {
case int64(0):
if err := client.send(ctx, &resp, "estimatefee"); err != nil {
return 0.0, fmt.Errorf("estimating fee: %v", err)
}
default:
if err := client.send(ctx, &resp, "estimatefee", numBlocks); err != nil {
return 0.0, fmt.Errorf("estimating fee: %v", err)
}
}
return resp, nil
}
func (client *client) getRawTransaction(ctx context.Context, txhash pack.Bytes) (btcjson.TxRawResult, error) {
resp := btcjson.TxRawResult{}
hash := chainhash.Hash{}
copy(hash[:], txhash)
if err := client.send(ctx, &resp, "getrawtransaction", hash.String(), 1); err != nil {
return resp, fmt.Errorf("bad \"getrawtransaction\": %v", err)
}
return resp, nil
}
func (client *client) send(ctx context.Context, resp interface{}, method string, params ...interface{}) error {
// Encode the request.
data, err := encodeRequest(method, params)
if err != nil {
return err
}
return retry(ctx, client.opts.TimeoutRetry, func() error {
// Create request and add basic authentication headers. The context is
// not attached to the request, and instead we all each attempt to run
// for the timeout duration, and we keep attempting until success, or
// the context is done.
req, err := http.NewRequest("POST", client.opts.Host, bytes.NewBuffer(data))
if err != nil {
return fmt.Errorf("building http request: %v", err)
}
req.SetBasicAuth(client.opts.User, client.opts.Password)
// Send the request and decode the response.
res, err := client.httpClient.Do(req)
if err != nil {
return fmt.Errorf("sending http request: %v", err)
}
defer res.Body.Close()
if err := decodeResponse(resp, res.Body); err != nil {
return fmt.Errorf("decoding http response: %v", err)
}
return nil
})
}
func encodeRequest(method string, params []interface{}) ([]byte, error) {
rawParams, err := json.Marshal(params)
if err != nil {
return nil, fmt.Errorf("encoding params: %v", err)
}
req := struct {
Version string `json:"version"`
ID int `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}{
Version: "2.0",
ID: rand.Int(),
Method: method,
Params: rawParams,
}
rawReq, err := json.Marshal(req)
if err != nil {
return nil, fmt.Errorf("encoding request: %v", err)
}
return rawReq, nil
}
func decodeResponse(resp interface{}, r io.Reader) error {
res := struct {
Version string `json:"version"`
ID int `json:"id"`
Result *json.RawMessage `json:"result"`
Error *json.RawMessage `json:"error"`
}{}
if err := json.NewDecoder(r).Decode(&res); err != nil {
return fmt.Errorf("decoding response: %v", err)
}
if res.Error != nil {
return fmt.Errorf("decoding response: %v", string(*res.Error))
}
if res.Result == nil {
return fmt.Errorf("decoding result: result is nil")
}
if err := json.Unmarshal(*res.Result, resp); err != nil {
return fmt.Errorf("decoding result: %v", err)
}
return nil
}
func retry(ctx context.Context, dur time.Duration, f func() error) error {
ticker := time.NewTicker(dur)
err := f()
for err != nil {
log.Printf("retrying: %v", err)
select {
case <-ctx.Done():
return fmt.Errorf("%v: %v", ctx.Err(), err)
case <-ticker.C:
err = f()
}
}
return nil
}
================================================
FILE: chain/bitcoin/bitcoin_suite_test.go
================================================
package bitcoin_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestBitcoin(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Bitcoin Suite")
}
================================================
FILE: chain/bitcoin/bitcoin_test.go
================================================
package bitcoin_test
import (
"context"
"log"
"os"
"reflect"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bitcoin", func() {
Context("when submitting transactions", func() {
Context("when sending BTC to multiple addresses", func() {
It("should work", func() {
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting BITCOIN_PK to the
// value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("BITCOIN_PK")
if pkEnv == "" {
panic("BITCOIN_PK is undefined")
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).ToNot(HaveOccurred())
// PKH
pkhAddr, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &chaincfg.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
pkhAddrUncompressed, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &chaincfg.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("PKH %v", pkhAddr.EncodeAddress())
log.Printf("PKH (uncompressed) %v", pkhAddrUncompressed.EncodeAddress())
// WPKH
wpkAddr, err := btcutil.NewAddressWitnessPubKeyHash([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}, &chaincfg.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("WPKH %v", wpkAddr.EncodeAddress())
// Setup the client and load the unspent transaction outputs.
client := bitcoin.NewClient(bitcoin.DefaultClientOptions())
outputs, err := client.UnspentOutputs(context.Background(), 0, 999999999, address.Address(pkhAddr.EncodeAddress()))
Expect(err).ToNot(HaveOccurred())
Expect(len(outputs)).To(BeNumerically(">", 0))
output := outputs[0]
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err := client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
output2, _, err = client.UnspentOutput(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Build the transaction by consuming the outputs and spending
// them to a set of recipients.
inputs := []utxo.Input{
{Output: utxo.Output{
Outpoint: utxo.Outpoint{
Hash: output.Outpoint.Hash[:],
Index: output.Outpoint.Index,
},
PubKeyScript: output.PubKeyScript,
Value: output.Value,
}},
}
recipients := []utxo.Recipient{
{
To: address.Address(pkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
{
To: address.Address(pkhAddrUncompressed.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
{
To: address.Address(wpkAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
}
tx, err := bitcoin.NewTxBuilder(&chaincfg.RegressionNetParams).BuildTx(inputs, recipients)
Expect(err).ToNot(HaveOccurred())
// Get the digests that need signing from the transaction, and
// sign them. In production, this would be done using the RZL
// MPC algorithm, but for the purposes of this test, using an
// explicit privkey is ok.
sighashes, err := tx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(tx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the transaction to the Bitcoin node. Again, this
// should be running a la `./multichaindeploy`.
txHash, err := tx.Hash()
Expect(err).ToNot(HaveOccurred())
err = client.SubmitTx(context.Background(), tx)
Expect(err).ToNot(HaveOccurred())
log.Printf("TXID %v", txHash)
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a Bitcoin transaction!
confs, err := client.Confirmations(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
log.Printf(" %v/3 confirmations", confs)
if confs >= 1 {
break
}
time.Sleep(10 * time.Second)
}
ctxWithTimeout, cancelCtxWithTimeout := context.WithTimeout(context.Background(), time.Second)
defer cancelCtxWithTimeout()
_, _, err = client.UnspentOutput(ctxWithTimeout, output.Outpoint)
Expect(err).To(HaveOccurred())
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err = client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Check we can get the transaction inputs
senders, err := client.TxSenders(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
Expect(len(senders)).Should(Equal(1))
Expect(senders[0]).Should(Equal(pkhAddr.EncodeAddress()))
})
})
})
})
================================================
FILE: chain/bitcoin/gas.go
================================================
package bitcoin
import (
"context"
"fmt"
"math"
"github.com/renproject/pack"
)
const (
btcToSatoshis = 1e8
kilobyteToByte = 1024
)
// A GasEstimator returns the SATs-per-byte that is needed in order to confirm
// transactions with an estimated maximum delay of one block. In distributed
// networks that collectively build, sign, and submit transactions, it is
// important that all nodes in the network have reached consensus on the
// SATs-per-byte.
type GasEstimator struct {
client Client
numBlocks int64
fallbackGas pack.U256
}
// NewGasEstimator returns a simple gas estimator that always returns the given
// number of SATs-per-byte.
func NewGasEstimator(client Client, numBlocks int64, fallbackGas pack.U256) GasEstimator {
return GasEstimator{
client: client,
numBlocks: numBlocks,
fallbackGas: fallbackGas,
}
}
// EstimateGas returns the number of SATs-per-byte (for both price and cap) that
// is needed in order to confirm transactions with an estimated maximum delay of
// `numBlocks` block. It is the responsibility of the caller to know the number
// of bytes in their transaction. This method calls the `estimatesmartfee` RPC
// call to the node, which based on a conservative (considering longer history)
// strategy returns the estimated BTC per kilobyte of data in the transaction.
// An error will be returned if the bitcoin node hasn't observed enough blocks
// to make an estimate for the provided target `numBlocks`.
func (gasEstimator GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
feeRate, err := gasEstimator.client.EstimateSmartFee(ctx, gasEstimator.numBlocks)
if err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, err
}
if feeRate <= 0.0 {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, fmt.Errorf("invalid fee rate: %v", feeRate)
}
satsPerByte := uint64(math.Ceil(feeRate * btcToSatoshis / kilobyteToByte))
return pack.NewU256FromUint64(satsPerByte), pack.NewU256FromUint64(satsPerByte), nil
}
================================================
FILE: chain/bitcoin/gas_test.go
================================================
package bitcoin_test
import (
"context"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating bitcoin network fee", func() {
It("should work", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client := bitcoin.NewClient(bitcoin.DefaultClientOptions())
// estimate fee to include tx within 1 block.
fallback1 := uint64(123)
gasEstimator1 := bitcoin.NewGasEstimator(client, 1, pack.NewU256FromUint64(fallback1))
gasPrice1, _, err := gasEstimator1.EstimateGas(ctx)
if err != nil {
Expect(gasPrice1).To(Equal(pack.NewU256FromUint64(fallback1)))
}
// estimate fee to include tx within 10 blocks.
fallback2 := uint64(234)
gasEstimator2 := bitcoin.NewGasEstimator(client, 10, pack.NewU256FromUint64(fallback2))
gasPrice2, _, err := gasEstimator2.EstimateGas(ctx)
if err != nil {
Expect(gasPrice2).To(Equal(pack.NewU256FromUint64(fallback2)))
}
// estimate fee to include tx within 100 blocks.
fallback3 := uint64(345)
gasEstimator3 := bitcoin.NewGasEstimator(client, 100, pack.NewU256FromUint64(fallback3))
gasPrice3, _, err := gasEstimator3.EstimateGas(ctx)
if err != nil {
Expect(gasPrice3).To(Equal(pack.NewU256FromUint64(fallback3)))
}
// expect fees in this order at the very least.
if err == nil {
Expect(gasPrice1.GreaterThanEqual(gasPrice2)).To(BeTrue())
Expect(gasPrice2.GreaterThanEqual(gasPrice3)).To(BeTrue())
}
})
})
})
================================================
FILE: chain/bitcoin/utxo.go
================================================
package bitcoin
import (
"bytes"
"fmt"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/pack"
)
// Version of Bitcoin transactions supported by the multichain.
const Version int32 = 2
// The TxBuilder is an implementation of a UTXO-compatible transaction builder
// for Bitcoin.
type TxBuilder struct {
params *chaincfg.Params
}
// NewTxBuilder returns a transaction builder that builds UTXO-compatible
// Bitcoin transactions for the given chain configuration (this means that it
// can be used for regnet, testnet, and mainnet, but also for networks that are
// minimally modified forks of the Bitcoin network).
func NewTxBuilder(params *chaincfg.Params) TxBuilder {
return TxBuilder{params: params}
}
// BuildTx returns a Bitcoin transaction that consumes funds from the given
// inputs, and sends them to the given recipients. The difference in the sum
// value of the inputs and the sum value of the recipients is paid as a fee to
// the Bitcoin network. This fee must be calculated independently of this
// function. Outputs produced for recipients will use P2PKH, P2SH, P2WPKH, or
// P2WSH scripts as the pubkey script, based on the format of the recipient
// address.
func (txBuilder TxBuilder) BuildTx(inputs []utxo.Input, recipients []utxo.Recipient) (utxo.Tx, error) {
msgTx := wire.NewMsgTx(Version)
// Inputs
for _, input := range inputs {
hash := chainhash.Hash{}
copy(hash[:], input.Hash)
index := input.Index.Uint32()
msgTx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&hash, index), nil, nil))
}
// Outputs
for _, recipient := range recipients {
addr, err := btcutil.DecodeAddress(string(recipient.To), txBuilder.params)
if err != nil {
return nil, err
}
if !addr.IsForNet(txBuilder.params) {
return nil, fmt.Errorf("addr of a different network")
}
script, err := txscript.PayToAddrScript(addr)
if err != nil {
return nil, err
}
value := recipient.Value.Int().Int64()
if value < 0 {
return nil, fmt.Errorf("expected value >= 0, got value %v", value)
}
msgTx.AddTxOut(wire.NewTxOut(value, script))
}
return &Tx{inputs: inputs, recipients: recipients, msgTx: msgTx, signed: false}, nil
}
// Tx represents a simple Bitcoin transaction that implements the Bitcoin Compat
// API.
type Tx struct {
inputs []utxo.Input
recipients []utxo.Recipient
msgTx *wire.MsgTx
signed bool
}
// Hash returns the transaction hash of the given underlying transaction.
func (tx *Tx) Hash() (pack.Bytes, error) {
txhash := tx.msgTx.TxHash()
return pack.NewBytes(txhash[:]), nil
}
// Inputs returns the UTXO inputs in the underlying transaction.
func (tx *Tx) Inputs() ([]utxo.Input, error) {
return tx.inputs, nil
}
// Outputs returns the UTXO outputs in the underlying transaction.
func (tx *Tx) Outputs() ([]utxo.Output, error) {
hash, err := tx.Hash()
if err != nil {
return nil, fmt.Errorf("bad hash: %v", err)
}
outputs := make([]utxo.Output, len(tx.msgTx.TxOut))
for i := range outputs {
outputs[i].Outpoint = utxo.Outpoint{
Hash: hash,
Index: pack.NewU32(uint32(i)),
}
outputs[i].PubKeyScript = pack.Bytes(tx.msgTx.TxOut[i].PkScript)
if tx.msgTx.TxOut[i].Value < 0 {
return nil, fmt.Errorf("bad output %v: value is less than zero", i)
}
outputs[i].Value = pack.NewU256FromU64(pack.NewU64(uint64(tx.msgTx.TxOut[i].Value)))
}
return outputs, nil
}
// Sighashes returns the digests that must be signed before the transaction
// can be submitted by the client.
func (tx *Tx) Sighashes() ([]pack.Bytes32, error) {
sighashes := make([]pack.Bytes32, len(tx.inputs))
for i, txin := range tx.inputs {
pubKeyScript := txin.PubKeyScript
sigScript := txin.SigScript
value := txin.Value.Int().Int64()
if value < 0 {
return []pack.Bytes32{}, fmt.Errorf("expected value >= 0, got value %v", value)
}
var hash []byte
var err error
if sigScript == nil {
if txscript.IsPayToWitnessPubKeyHash(pubKeyScript) {
hash, err = txscript.CalcWitnessSigHash(pubKeyScript, txscript.NewTxSigHashes(tx.msgTx), txscript.SigHashAll, tx.msgTx, i, value)
} else {
hash, err = txscript.CalcSignatureHash(pubKeyScript, txscript.SigHashAll, tx.msgTx, i)
}
} else {
if txscript.IsPayToWitnessScriptHash(pubKeyScript) {
hash, err = txscript.CalcWitnessSigHash(sigScript, txscript.NewTxSigHashes(tx.msgTx), txscript.SigHashAll, tx.msgTx, i, value)
} else {
hash, err = txscript.CalcSignatureHash(sigScript, txscript.SigHashAll, tx.msgTx, i)
}
}
if err != nil {
return []pack.Bytes32{}, err
}
sighash := [32]byte{}
copy(sighash[:], hash)
sighashes[i] = pack.NewBytes32(sighash)
}
return sighashes, nil
}
// Sign consumes a list of signatures, and adds them to the list of UTXOs in
// the underlying transactions.
func (tx *Tx) Sign(signatures []pack.Bytes65, pubKey pack.Bytes) error {
if tx.signed {
return fmt.Errorf("already signed")
}
if len(signatures) != len(tx.msgTx.TxIn) {
return fmt.Errorf("expected %v signatures, got %v signatures", len(tx.msgTx.TxIn), len(signatures))
}
for i, rsv := range signatures {
var err error
// Decode the signature and the pubkey script.
r := new(big.Int).SetBytes(rsv[:32])
s := new(big.Int).SetBytes(rsv[32:64])
signature := btcec.Signature{
R: r,
S: s,
}
pubKeyScript := tx.inputs[i].Output.PubKeyScript
sigScript := tx.inputs[i].SigScript
// Support segwit.
if sigScript == nil {
if txscript.IsPayToWitnessPubKeyHash(pubKeyScript) || txscript.IsPayToWitnessScriptHash(pubKeyScript) {
tx.msgTx.TxIn[i].Witness = wire.TxWitness([][]byte{append(signature.Serialize(), byte(txscript.SigHashAll)), pubKey})
continue
}
} else {
if txscript.IsPayToWitnessPubKeyHash(sigScript) || txscript.IsPayToWitnessScriptHash(sigScript) {
tx.msgTx.TxIn[i].Witness = wire.TxWitness([][]byte{append(signature.Serialize(), byte(txscript.SigHashAll)), pubKey, sigScript})
continue
}
}
// Support non-segwit
builder := txscript.NewScriptBuilder()
builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll)))
builder.AddData(pubKey)
if sigScript != nil {
builder.AddData(sigScript)
}
tx.msgTx.TxIn[i].SignatureScript, err = builder.Script()
if err != nil {
return err
}
}
tx.signed = true
return nil
}
// Serialize serializes the UTXO transaction to bytes
func (tx *Tx) Serialize() (pack.Bytes, error) {
buf := new(bytes.Buffer)
if err := tx.msgTx.Serialize(buf); err != nil {
return pack.Bytes{}, err
}
return pack.NewBytes(buf.Bytes()), nil
}
================================================
FILE: chain/bitcoin/utxo_test.go
================================================
package bitcoin_test
================================================
FILE: chain/bitcoincash/address.go
================================================
package bitcoincash
import (
"errors"
"fmt"
"strings"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/base58"
"github.com/btcsuite/btcutil/bech32"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
"golang.org/x/crypto/ripemd160"
)
var (
// Alphabet used by Bitcoin Cash to encode addresses.
Alphabet = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
// AlphabetReverseLookup used by Bitcoin Cash to decode addresses.
AlphabetReverseLookup = func() map[rune]byte {
lookup := map[rune]byte{}
for i, char := range Alphabet {
lookup[char] = byte(i)
}
return lookup
}()
)
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// NewAddressEncodeDecoder constructs a new AddressEncodeDecoder with the
// chain specific configurations
func NewAddressEncodeDecoder(params *chaincfg.Params) AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: NewAddressEncoder(params),
AddressDecoder: NewAddressDecoder(params),
}
}
// AddressEncoder encapsulates the chain specific configurations and implements
// the address.Encoder interface
type AddressEncoder struct {
params *chaincfg.Params
}
// NewAddressEncoder constructs a new AddressEncoder with the chain specific
// configurations
func NewAddressEncoder(params *chaincfg.Params) AddressEncoder {
return AddressEncoder{params: params}
}
// AddressDecoder encapsulates the chain specific configurations and implements
// the address.Decoder interface
type AddressDecoder struct {
params *chaincfg.Params
}
// NewAddressDecoder constructs a new AddressDecoder with the chain specific
// configurations
func NewAddressDecoder(params *chaincfg.Params) AddressDecoder {
return AddressDecoder{params: params}
}
// EncodeAddress implements the address.Encoder interface
func (encoder AddressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error) {
rawAddrBytes := []byte(rawAddr)
var encodedAddr string
var err error
switch len(rawAddrBytes) - 1 {
case ripemd160.Size: // P2PKH or P2SH
switch rawAddrBytes[0] {
case 0: // P2PKH
encodedAddr, err = encodeAddress(0x00, rawAddrBytes[1:21], encoder.params)
case 8: // P2SH
encodedAddr, err = encodeAddress(8, rawAddrBytes[1:21], encoder.params)
default:
return address.Address(""), btcutil.ErrUnknownAddressType
}
default:
return encodeLegacyAddress(rawAddr, encoder.params)
}
if err != nil {
return address.Address(""), fmt.Errorf("encoding: %v", err)
}
return address.Address(encodedAddr), nil
}
// DecodeAddress implements the address.Decoder interface
func (decoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error) {
// Legacy address decoding
if legacyAddr, err := btcutil.DecodeAddress(string(addr), decoder.params); err == nil {
if !legacyAddr.IsForNet(decoder.params) {
return nil, fmt.Errorf("address of different network")
}
switch legacyAddr.(type) {
case *btcutil.AddressPubKeyHash, *btcutil.AddressScriptHash, *btcutil.AddressPubKey:
return decodeLegacyAddress(addr, decoder.params)
case *btcutil.AddressWitnessPubKeyHash, *btcutil.AddressWitnessScriptHash:
return nil, fmt.Errorf("unsuported segwit bitcoin address type %T", legacyAddr)
default:
return nil, fmt.Errorf("unsuported legacy bitcoin address type %T", legacyAddr)
}
}
if addrParts := strings.Split(string(addr), ":"); len(addrParts) != 1 {
addr = address.Address(addrParts[1])
}
decoded := DecodeString(string(addr))
if !VerifyChecksum(AddressPrefix(decoder.params), decoded) {
return nil, btcutil.ErrChecksumMismatch
}
addrBytes, err := bech32.ConvertBits(decoded[:len(decoded)-8], 5, 8, false)
if err != nil {
return nil, err
}
switch len(addrBytes) - 1 {
case ripemd160.Size: // P2PKH or P2SH
switch addrBytes[0] {
case 0, 8: // P2PKH or P2SH
return address.RawAddress(addrBytes), nil
default:
return nil, btcutil.ErrUnknownAddressType
}
default:
return nil, errors.New("decoded address is of unknown size")
}
}
func encodeLegacyAddress(rawAddr address.RawAddress, params *chaincfg.Params) (address.Address, error) {
// Validate that the base58 address is in fact in correct format.
encodedAddr := base58.Encode([]byte(rawAddr))
if _, err := btcutil.DecodeAddress(encodedAddr, params); err != nil {
return address.Address(""), fmt.Errorf("address validation error: %v", err)
}
return address.Address(encodedAddr), nil
}
func decodeLegacyAddress(addr address.Address, params *chaincfg.Params) (address.RawAddress, error) {
// Decode the checksummed base58 format address.
decoded, ver, err := base58.CheckDecode(string(addr))
if err != nil {
return nil, fmt.Errorf("checking: %v", err)
}
if len(decoded) != 20 {
return nil, fmt.Errorf("expected len 20, got len %v", len(decoded))
}
// Validate the address format.
switch ver {
case params.PubKeyHashAddrID, params.ScriptHashAddrID:
return address.RawAddress(pack.NewBytes(base58.Decode(string(addr)))), nil
default:
return nil, fmt.Errorf("unexpected address prefix")
}
}
// An Address represents a Bitcoin Cash address.
type Address interface {
btcutil.Address
BitcoinAddress() btcutil.Address
}
// AddressLegacy represents a legacy Bitcoin address.
type AddressLegacy struct {
btcutil.Address
}
// BitcoinAddress returns the address as if it was a Bitcoin address.
func (addr AddressLegacy) BitcoinAddress() btcutil.Address {
return addr.Address
}
// AddressPubKeyHash represents an address for P2PKH transactions for
// Bitcoin Cash that is compatible with the Bitcoin-compat API.
type AddressPubKeyHash struct {
*btcutil.AddressPubKeyHash
params *chaincfg.Params
}
// NewAddressPubKeyHash returns a new AddressPubKeyHash
// that is compatible with the Bitcoin-compat API.
func NewAddressPubKeyHash(pkh []byte, params *chaincfg.Params) (AddressPubKeyHash, error) {
addr, err := btcutil.NewAddressPubKeyHash(pkh, params)
return AddressPubKeyHash{AddressPubKeyHash: addr, params: params}, err
}
// NewAddressPubKey returns a new AddressPubKey
// that is compatible with the Bitcoin-compat API.
func NewAddressPubKey(pk []byte, params *chaincfg.Params) (AddressPubKeyHash, error) {
return NewAddressPubKeyHash(btcutil.Hash160(pk), params)
}
// String returns the string encoding of the transaction output
// destination.
//
// Please note that String differs subtly from EncodeAddress: String
// will return the value as a string without any conversion, while
// EncodeAddress may convert destination types (for example,
// converting pubkeys to P2PKH addresses) before encoding as a
// payment address string.
func (addr AddressPubKeyHash) String() string {
return addr.EncodeAddress()
}
// EncodeAddress returns the string encoding of the payment address
// associated with the Address value. See the comment on String
// for how this method differs from String.
func (addr AddressPubKeyHash) EncodeAddress() string {
hash := *addr.AddressPubKeyHash.Hash160()
encoded, err := encodeAddress(0x00, hash[:], addr.params)
if err != nil {
panic(fmt.Errorf("invalid address: %v", err))
}
return encoded
}
// ScriptAddress returns the raw bytes of the address to be used
// when inserting the address into a txout's script.
func (addr AddressPubKeyHash) ScriptAddress() []byte {
return addr.AddressPubKeyHash.ScriptAddress()
}
// IsForNet returns whether or not the address is associated with the passed
// bitcoin network.
func (addr AddressPubKeyHash) IsForNet(params *chaincfg.Params) bool {
return addr.AddressPubKeyHash.IsForNet(params)
}
// BitcoinAddress returns the address as if it was a Bitcoin address.
func (addr AddressPubKeyHash) BitcoinAddress() btcutil.Address {
return addr.AddressPubKeyHash
}
// AddressScriptHash represents an address for P2SH transactions for
// Bitcoin Cash that is compatible with the Bitcoin-compat API.
type AddressScriptHash struct {
*btcutil.AddressScriptHash
params *chaincfg.Params
}
// NewAddressScriptHash returns a new AddressScriptHash
// that is compatible with the Bitcoin-compat API.
func NewAddressScriptHash(script []byte, params *chaincfg.Params) (AddressScriptHash, error) {
addr, err := btcutil.NewAddressScriptHash(script, params)
return AddressScriptHash{AddressScriptHash: addr, params: params}, err
}
// NewAddressScriptHashFromHash returns a new AddressScriptHash
// that is compatible with the Bitcoin-compat API.
func NewAddressScriptHashFromHash(scriptHash []byte, params *chaincfg.Params) (AddressScriptHash, error) {
addr, err := btcutil.NewAddressScriptHashFromHash(scriptHash, params)
return AddressScriptHash{AddressScriptHash: addr, params: params}, err
}
// String returns the string encoding of the transaction output
// destination.
//
// Please note that String differs subtly from EncodeAddress: String
// will return the value as a string without any conversion, while
// EncodeAddress may convert destination types (for example,
// converting pubkeys to P2PKH addresses) before encoding as a
// payment address string.
func (addr AddressScriptHash) String() string {
return addr.EncodeAddress()
}
// EncodeAddress returns the string encoding of the payment address
// associated with the Address value. See the comment on String
// for how this method differs from String.
func (addr AddressScriptHash) EncodeAddress() string {
hash := *addr.AddressScriptHash.Hash160()
encoded, err := encodeAddress(8, hash[:], addr.params)
if err != nil {
panic(fmt.Errorf("invalid address: %v", err))
}
return encoded
}
// ScriptAddress returns the raw bytes of the address to be used
// when inserting the address into a txout's script.
func (addr AddressScriptHash) ScriptAddress() []byte {
return addr.AddressScriptHash.ScriptAddress()
}
// IsForNet returns whether or not the address is associated with the passed
// bitcoin network.
func (addr AddressScriptHash) IsForNet(params *chaincfg.Params) bool {
return addr.AddressScriptHash.IsForNet(params)
}
// BitcoinAddress returns the address as if it was a Bitcoin address.
func (addr AddressScriptHash) BitcoinAddress() btcutil.Address {
return addr.AddressScriptHash
}
// encodeAddress using Bitcoin Cash address encoding, assuming that the hash
// data has no prefix or checksum.
func encodeAddress(version byte, hash []byte, params *chaincfg.Params) (string, error) {
if (len(hash)-20)/4 != int(version)%8 {
return "", fmt.Errorf("invalid version: %d", version)
}
data, err := bech32.ConvertBits(append([]byte{version}, hash...), 8, 5, true)
if err != nil {
return "", fmt.Errorf("invalid bech32 encoding: %v", err)
}
return EncodeToString(AppendChecksum(AddressPrefix(params), data)), nil
}
// addressFromRawBytes consumes raw bytes representation of a bitcoincash
// address and returns a type that implements the bitcoincash.Address interface.
func addressFromRawBytes(addrBytes []byte, params *chaincfg.Params) (Address, error) {
switch len(addrBytes) - 1 {
case ripemd160.Size: // P2PKH or P2SH
switch addrBytes[0] {
case 0: // P2PKH
return NewAddressPubKeyHash(addrBytes[1:21], params)
case 8: // P2SH
return NewAddressScriptHashFromHash(addrBytes[1:21], params)
default:
return nil, btcutil.ErrUnknownAddressType
}
default:
addr, err := btcutil.DecodeAddress(base58.Encode(addrBytes), params)
if err != nil {
return nil, err
}
return AddressLegacy{Address: addr}, nil
}
}
// EncodeToString using Bitcoin Cash address encoding, assuming that the data
// has a prefix and checksum.
func EncodeToString(data []byte) string {
addr := strings.Builder{}
for _, d := range data {
addr.WriteByte(Alphabet[d])
}
return addr.String()
}
// DecodeString using Bitcoin Cash address encoding.
func DecodeString(address string) []byte {
data := []byte{}
for _, c := range address {
data = append(data, AlphabetReverseLookup[c])
}
return data
}
// AppendChecksum to the data payload.
//
// https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md#checksum
func AppendChecksum(prefix string, payload []byte) []byte {
prefixedPayload := append(EncodePrefix(prefix), payload...)
// Append 8 zeroes.
prefixedPayload = append(prefixedPayload, 0, 0, 0, 0, 0, 0, 0, 0)
// Determine what to XOR into those 8 zeroes.
mod := PolyMod(prefixedPayload)
checksum := make([]byte, 8)
for i := 0; i < 8; i++ {
// Convert the 5-bit groups in mod to checksum values.
checksum[i] = byte((mod >> uint(5*(7-i))) & 0x1f)
}
return append(payload, checksum...)
}
// VerifyChecksum verifies whether the given payload is well-formed.
//
// https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md#checksum
func VerifyChecksum(prefix string, payload []byte) bool {
return PolyMod(append(EncodePrefix(prefix), payload...)) == 0
}
// EncodePrefix string into bytes.
//
// https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md#checksum
func EncodePrefix(prefixString string) []byte {
prefixBytes := make([]byte, len(prefixString)+1)
for i := 0; i < len(prefixString); i++ {
prefixBytes[i] = byte(prefixString[i]) & 0x1f
}
prefixBytes[len(prefixString)] = 0
return prefixBytes
}
// AddressPrefix returns the string representations of an address prefix based
// on the network parameters: "bitcoincash" (for mainnet), "bchtest" (for
// testnet), and "bchreg" (for regtest). This function panics if the network
// parameters are not recognised.
func AddressPrefix(params *chaincfg.Params) string {
if params == nil {
panic(fmt.Errorf("non-exhaustive pattern: params %v", params))
}
switch params {
case &chaincfg.MainNetParams:
return "bitcoincash"
case &chaincfg.TestNet3Params:
return "bchtest"
case &chaincfg.RegressionNetParams:
return "bchreg"
default:
panic(fmt.Errorf("non-exhaustive pattern: params %v", params.Name))
}
}
// PolyMod is used to calculate the checksum for Bitcoin Cash
// addresses.
//
// uint64_t PolyMod(const data &v) {
// uint64_t c = 1;
// for (uint8_t d : v) {
// uint8_t c0 = c >> 35;
// c = ((c & 0x07ffffffff) << 5) ^ d;
// if (c0 & 0x01) c ^= 0x98f2bc8e61;
// if (c0 & 0x02) c ^= 0x79b76d99e2;
// if (c0 & 0x04) c ^= 0xf33e5fb3c4;
// if (c0 & 0x08) c ^= 0xae2eabe2a8;
// if (c0 & 0x10) c ^= 0x1e4f43e470;
// }
// return c ^ 1;
// }
//
// https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
func PolyMod(v []byte) uint64 {
c := uint64(1)
for _, d := range v {
c0 := byte(c >> 35)
c = ((c & 0x07ffffffff) << 5) ^ uint64(d)
if c0&0x01 > 0 {
c ^= 0x98f2bc8e61
}
if c0&0x02 > 0 {
c ^= 0x79b76d99e2
}
if c0&0x04 > 0 {
c ^= 0xf33e5fb3c4
}
if c0&0x08 > 0 {
c ^= 0xae2eabe2a8
}
if c0&0x10 > 0 {
c ^= 0x1e4f43e470
}
}
return c ^ 1
}
================================================
FILE: chain/bitcoincash/address_test.go
================================================
package bitcoincash_test
import (
"fmt"
"math/rand"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/bitcoincash"
)
var _ = Describe("Bitcoin Cash", func() {
Context("Address Encode/Decode", func() {
addrEncodeDecoders := []struct {
network *chaincfg.Params
encodeDecoder bitcoincash.AddressEncodeDecoder
}{
{
&chaincfg.MainNetParams,
bitcoincash.NewAddressEncodeDecoder(&chaincfg.MainNetParams),
},
{
&chaincfg.TestNet3Params,
bitcoincash.NewAddressEncodeDecoder(&chaincfg.TestNet3Params),
},
{
&chaincfg.RegressionNetParams,
bitcoincash.NewAddressEncodeDecoder(&chaincfg.RegressionNetParams),
},
}
for _, addrEncodeDecoder := range addrEncodeDecoders {
addrEncodeDecoder := addrEncodeDecoder
Context(fmt.Sprintf("Encode/Decode for %v network", addrEncodeDecoder.network.Name), func() {
Specify("AddressPubKeyHash", func() {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), addrEncodeDecoder.network, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := bitcoincash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), addrEncodeDecoder.network)
Expect(err).NotTo(HaveOccurred())
addr := address.Address(addrPubKeyHash.EncodeAddress())
decodedRawAddr, err := addrEncodeDecoder.encodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := addrEncodeDecoder.encodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
Specify("AddressScriptHash", func() {
script := make([]byte, rand.Intn(100))
rand.Read(script)
addrScriptHash, err := bitcoincash.NewAddressScriptHash(script, addrEncodeDecoder.network)
Expect(err).NotTo(HaveOccurred())
addr := address.Address(addrScriptHash.EncodeAddress())
decodedRawAddr, err := addrEncodeDecoder.encodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := addrEncodeDecoder.encodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
Specify("AddressLegacy", func() {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), addrEncodeDecoder.network, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), addrEncodeDecoder.network)
Expect(err).NotTo(HaveOccurred())
addr := address.Address(addrPubKeyHash.EncodeAddress())
decodedRawAddr, err := addrEncodeDecoder.encodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := addrEncodeDecoder.encodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
})
}
})
})
================================================
FILE: chain/bitcoincash/bitcoincash.go
================================================
package bitcoincash
================================================
FILE: chain/bitcoincash/bitcoincash_suite_test.go
================================================
package bitcoincash_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestBitcoinCash(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Bitcoin Cash Suite")
}
================================================
FILE: chain/bitcoincash/bitcoincash_test.go
================================================
package bitcoincash_test
import (
"context"
"log"
"os"
"reflect"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/bitcoincash"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bitcoin Cash", func() {
Context("when submitting transactions", func() {
Context("when sending BCH to multiple addresses", func() {
It("should work", func() {
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting BITCOINCASH_PK to
// the value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("BITCOINCASH_PK")
if pkEnv == "" {
panic("BITCOINCASH_PK is undefined")
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).ToNot(HaveOccurred())
// PKH
pkhAddr, err := bitcoincash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &chaincfg.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
pkhAddrUncompressed, err := bitcoincash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &chaincfg.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("PKH %v", pkhAddr.EncodeAddress())
log.Printf("PKH (uncompressed) %v", pkhAddrUncompressed.EncodeAddress())
// Setup the client and load the unspent transaction outputs.
client := bitcoincash.NewClient(bitcoincash.DefaultClientOptions())
outputs, err := client.UnspentOutputs(context.Background(), 0, 999999999, address.Address(pkhAddr.EncodeAddress()))
Expect(err).ToNot(HaveOccurred())
Expect(len(outputs)).To(BeNumerically(">", 0))
output := outputs[0]
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err := client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Build the transaction by consuming the outputs and spending
// them to a set of recipients.
inputs := []utxo.Input{
{Output: output},
}
recipients := []utxo.Recipient{
{
To: address.Address(pkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
{
To: address.Address(pkhAddrUncompressed.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
}
tx, err := bitcoincash.NewTxBuilder(&chaincfg.RegressionNetParams).BuildTx(inputs, recipients)
Expect(err).ToNot(HaveOccurred())
// Get the digests that need signing from the transaction, and
// sign them. In production, this would be done using the RZL
// MPC algorithm, but for the purposes of this test, using an
// explicit privkey is ok.
sighashes, err := tx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(tx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the transaction to the Bitcoin Cash node. Again, this
// should be running a la `./multichaindeploy`.
txHash, err := tx.Hash()
Expect(err).ToNot(HaveOccurred())
err = client.SubmitTx(context.Background(), tx)
Expect(err).ToNot(HaveOccurred())
log.Printf("TXID %v", txHash)
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a Bitcoin Cash transaction!
confs, err := client.Confirmations(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
log.Printf(" %v/3 confirmations", confs)
if confs >= 3 {
break
}
time.Sleep(10 * time.Second)
}
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err = client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Check we can get the transaction inputs
senders, err := client.TxSenders(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
Expect(len(senders)).Should(Equal(1))
Expect(senders[0]).Should(Equal(pkhAddr.EncodeAddress()))
})
})
})
})
================================================
FILE: chain/bitcoincash/gas.go
================================================
package bitcoincash
import (
"context"
"fmt"
"math"
"github.com/renproject/pack"
)
const (
bchToSatoshis = 1e8
kilobyteToByte = 1024
)
// A GasEstimator returns the SATs-per-byte that is needed in order to confirm
// transactions with an estimated maximum delay of one block. In distributed
// networks that collectively build, sign, and submit transactions, it is
// important that all nodes in the network have reached consensus on the
// SATs-per-byte.
type GasEstimator struct {
client Client
fallbackGas pack.U256
}
// NewGasEstimator returns a simple gas estimator that always returns the given
// number of SATs-per-byte.
func NewGasEstimator(client Client, fallbackGas pack.U256) GasEstimator {
return GasEstimator{
client: client,
fallbackGas: fallbackGas,
}
}
// EstimateGas returns the number of SATs-per-byte (for both price and cap) that
// is needed in order to confirm transactions with a minimal delay. It is the
// responsibility of the caller to know the number of bytes in their
// transaction. This method calls the `estimatefee` RPC call to the node, which
// based on a conservative (considering longer history) strategy returns the
// estimated BCH per kilobyte of data in the transaction. An error will be
// returned if the node hasn't observed enough blocks to make an estimate.
func (gasEstimator GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
feeRate, err := gasEstimator.client.EstimateFeeLegacy(ctx, int64(0))
if err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, err
}
if feeRate <= 0.0 {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, fmt.Errorf("invalid fee rate: %v", feeRate)
}
satsPerByte := uint64(math.Ceil(feeRate * bchToSatoshis / kilobyteToByte))
return pack.NewU256FromUint64(satsPerByte), pack.NewU256FromUint64(satsPerByte), nil
}
================================================
FILE: chain/bitcoincash/gas_test.go
================================================
package bitcoincash_test
import (
"context"
"github.com/renproject/multichain/chain/bitcoincash"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating bitcoincash network fee", func() {
It("should work", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client := bitcoincash.NewClient(bitcoincash.DefaultClientOptions())
fallbackGas := uint64(123)
gasEstimator := bitcoincash.NewGasEstimator(client, pack.NewU256FromUint64(fallbackGas))
gasPrice, _, err := gasEstimator.EstimateGas(ctx)
if err != nil {
Expect(gasPrice).To(Equal(pack.NewU256FromUint64(fallbackGas)))
} else {
Expect(gasPrice.Int().Uint64()).To(BeNumerically(">", 0))
}
})
})
})
================================================
FILE: chain/bitcoincash/utxo.go
================================================
package bitcoincash
import (
"bytes"
"encoding/binary"
"fmt"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/pack"
)
// SighashForkID used to distinguish between Bitcoin Cash and Bitcoin
// transactions by masking hash types.
const SighashForkID = txscript.SigHashType(0x40)
// SighashMask used to mask hash types.
const SighashMask = txscript.SigHashType(0x1F)
// Version of Bitcoin Cash transactions supported by the multichain.
const Version int32 = 1
// ClientOptions are used to parameterise the behaviour of the Client.
type ClientOptions = bitcoin.ClientOptions
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return bitcoin.DefaultClientOptions().WithHost("http://127.0.0.1:19443")
}
// A Client interacts with an instance of the Bitcoin network using the RPC
// interface exposed by a Bitcoin node.
type Client = bitcoin.Client
// NewClient returns a new Client.
var NewClient = bitcoin.NewClient
// The TxBuilder is an implementation of a UTXO-compatible transaction builder
// for Bitcoin.
type TxBuilder struct {
params *chaincfg.Params
}
// NewTxBuilder returns an implementation of the transaction builder interface
// from the Bitcoin Compat API, and exposes the functionality to build simple
// Bitcoin Cash transactions.
func NewTxBuilder(params *chaincfg.Params) utxo.TxBuilder {
return TxBuilder{params: params}
}
// BuildTx returns a simple Bitcoin Cash transaction that consumes the funds
// from the given outputs, and sends the to the given recipients. The difference
// in the sum value of the inputs and the sum value of the recipients is paid as
// a fee to the Bitcoin Cash network.
//
// It is assumed that the required signature scripts require the SIGHASH_ALL
// signatures and the serialized public key:
//
// builder := txscript.NewScriptBuilder()
// builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll|SighashForkID)))
// builder.AddData(serializedPubKey)
//
// Outputs produced for recipients will use P2PKH, or P2SH scripts as the pubkey
// script, based on the format of the recipient address.
func (txBuilder TxBuilder) BuildTx(inputs []utxo.Input, recipients []utxo.Recipient) (utxo.Tx, error) {
msgTx := wire.NewMsgTx(Version)
// Address encoder-decoder
addrEncodeDecoder := NewAddressEncodeDecoder(txBuilder.params)
// Inputs
for _, input := range inputs {
hash := chainhash.Hash{}
copy(hash[:], input.Hash)
index := input.Index.Uint32()
msgTx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&hash, index), nil, nil))
}
// Outputs
for _, recipient := range recipients {
addrBytes, err := addrEncodeDecoder.DecodeAddress(recipient.To)
if err != nil {
return &Tx{}, err
}
addr, err := addressFromRawBytes(addrBytes, txBuilder.params)
if err != nil {
return &Tx{}, err
}
script, err := txscript.PayToAddrScript(addr.BitcoinAddress())
if err != nil {
return &Tx{}, err
}
value := recipient.Value.Int().Int64()
if value < 0 {
return nil, fmt.Errorf("expected value >= 0, got value = %v", value)
}
msgTx.AddTxOut(wire.NewTxOut(value, script))
}
return &Tx{inputs: inputs, recipients: recipients, msgTx: msgTx, signed: false}, nil
}
// Tx represents a simple Bitcoin Cash transaction that implements the Bitcoin
// Compat API.
type Tx struct {
inputs []utxo.Input
recipients []utxo.Recipient
msgTx *wire.MsgTx
signed bool
}
// Hash returns the transaction hash of the given underlying transaction. It
// implements the multichain.UTXOTx interface
func (tx *Tx) Hash() (pack.Bytes, error) {
txhash := tx.msgTx.TxHash()
return pack.NewBytes(txhash[:]), nil
}
// Inputs returns the UTXO inputs in the underlying transaction. It implements
// the multichain.UTXOTx interface
func (tx *Tx) Inputs() ([]utxo.Input, error) {
return tx.inputs, nil
}
// Outputs returns the UTXO outputs in the underlying transaction. It implements
// the multichain.UTXOTx interface
func (tx *Tx) Outputs() ([]utxo.Output, error) {
hash, err := tx.Hash()
if err != nil {
return nil, err
}
outputs := make([]utxo.Output, len(tx.msgTx.TxOut))
for i := range outputs {
outputs[i].Outpoint = utxo.Outpoint{
Hash: hash,
Index: pack.NewU32(uint32(i)),
}
outputs[i].PubKeyScript = pack.Bytes(tx.msgTx.TxOut[i].PkScript)
if tx.msgTx.TxOut[i].Value < 0 {
return nil, fmt.Errorf("bad output %v: value is less than zero", i)
}
outputs[i].Value = pack.NewU256FromU64(pack.NewU64(uint64(tx.msgTx.TxOut[i].Value)))
}
return outputs, nil
}
// Sighashes returns the digests that must be signed before the transaction
// can be submitted by the client.
func (tx *Tx) Sighashes() ([]pack.Bytes32, error) {
sighashes := make([]pack.Bytes32, len(tx.inputs))
for i, txin := range tx.inputs {
pubKeyScript := txin.Output.PubKeyScript
sigScript := txin.SigScript
value := txin.Output.Value.Int().Int64()
if value < 0 {
return []pack.Bytes32{}, fmt.Errorf("expected value >= 0, got value = %v", value)
}
var hash []byte
if sigScript == nil {
hash = CalculateBip143Sighash(pubKeyScript, txscript.NewTxSigHashes(tx.msgTx), txscript.SigHashAll, tx.msgTx, i, value)
} else {
hash = CalculateBip143Sighash(sigScript, txscript.NewTxSigHashes(tx.msgTx), txscript.SigHashAll, tx.msgTx, i, value)
}
sighash := [32]byte{}
copy(sighash[:], hash)
sighashes[i] = pack.NewBytes32(sighash)
}
return sighashes, nil
}
// Sign consumes a list of signatures, and adds them to the list of UTXOs in
// the underlying transactions. It implements the multichain.UTXOTx interface
func (tx *Tx) Sign(signatures []pack.Bytes65, pubKey pack.Bytes) error {
if tx.signed {
return fmt.Errorf("already signed")
}
if len(signatures) != len(tx.msgTx.TxIn) {
return fmt.Errorf("expected %v signatures, got %v signatures", len(tx.msgTx.TxIn), len(signatures))
}
for i, rsv := range signatures {
r := new(big.Int).SetBytes(rsv[:32])
s := new(big.Int).SetBytes(rsv[32:64])
signature := btcec.Signature{
R: r,
S: s,
}
builder := txscript.NewScriptBuilder()
builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll|SighashForkID)))
builder.AddData(pubKey)
if tx.inputs[i].SigScript != nil {
builder.AddData(tx.inputs[i].SigScript)
}
signatureScript, err := builder.Script()
if err != nil {
return err
}
tx.msgTx.TxIn[i].SignatureScript = signatureScript
}
tx.signed = true
return nil
}
// Serialize serializes the UTXO transaction to bytes
func (tx *Tx) Serialize() (pack.Bytes, error) {
buf := new(bytes.Buffer)
if err := tx.msgTx.Serialize(buf); err != nil {
return pack.Bytes{}, err
}
return pack.NewBytes(buf.Bytes()), nil
}
// CalculateBip143Sighash computes the sighash digest of a transaction's input
// using the new, optimized digest calculation algorithm defined in BIP0143.
// This function makes use of pre-calculated sighash fragments stored within the
// passed HashCache to eliminate duplicate hashing computations when calculating
// the final digest, reducing the complexity from O(N^2) to O(N). Additionally,
// signatures now cover the input value of the referenced unspent output. This
// allows offline, or hardware wallets to compute the exact amount being spent,
// in addition to the final transaction fee. In the case the wallet if fed an
// invalid input amount, the real sighash will differ causing the produced
// signature to be invalid.
//
// https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki
func CalculateBip143Sighash(subScript []byte, sigHashes *txscript.TxSigHashes, hashType txscript.SigHashType, tx *wire.MsgTx, idx int, amt int64) []byte {
// As a sanity check, ensure the passed input index for the transaction
// is valid.
if idx > len(tx.TxIn)-1 {
fmt.Printf("CalculateBip143Sighash: i %d with %d inputs", idx, len(tx.TxIn))
return nil
}
// We'll utilize this buffer throughout to incrementally calculate
// the signature hash for this transaction.
var sigHash bytes.Buffer
// First write out, then encode the transaction's version number.
var bVersion [4]byte
binary.LittleEndian.PutUint32(bVersion[:], uint32(tx.Version))
sigHash.Write(bVersion[:])
// Next write out the possibly pre-calculated hashes for the sequence
// numbers of all inputs, and the hashes of the previous outs for all
// outputs.
var zeroHash chainhash.Hash
// If anyone can pay isn't active, then we can use the cached
// hashPrevOuts, otherwise we just write zeroes for the prev outs.
if hashType&txscript.SigHashAnyOneCanPay == 0 {
sigHash.Write(sigHashes.HashPrevOuts[:])
} else {
sigHash.Write(zeroHash[:])
}
// If the sighash isn't anyone can pay, single, or none, the use the
// cached hash sequences, otherwise write all zeroes for the
// hashSequence.
if hashType&txscript.SigHashAnyOneCanPay == 0 &&
hashType&SighashMask != txscript.SigHashSingle &&
hashType&SighashMask != txscript.SigHashNone {
sigHash.Write(sigHashes.HashSequence[:])
} else {
sigHash.Write(zeroHash[:])
}
// Next, write the outpoint being spent.
sigHash.Write(tx.TxIn[idx].PreviousOutPoint.Hash[:])
var bIndex [4]byte
binary.LittleEndian.PutUint32(bIndex[:], tx.TxIn[idx].PreviousOutPoint.Index)
sigHash.Write(bIndex[:])
// For p2wsh outputs, and future outputs, the script code is the
// original script, with all code separators removed, serialized
// with a var int length prefix.
wire.WriteVarBytes(&sigHash, 0, subScript)
// Next, add the input amount, and sequence number of the input being
// signed.
var bAmount [8]byte
binary.LittleEndian.PutUint64(bAmount[:], uint64(amt))
sigHash.Write(bAmount[:])
var bSequence [4]byte
binary.LittleEndian.PutUint32(bSequence[:], tx.TxIn[idx].Sequence)
sigHash.Write(bSequence[:])
// If the current signature mode isn't single, or none, then we can
// re-use the pre-generated hashoutputs sighash fragment. Otherwise,
// we'll serialize and add only the target output index to the signature
// pre-image.
if hashType&SighashMask != txscript.SigHashSingle &&
hashType&SighashMask != txscript.SigHashNone {
sigHash.Write(sigHashes.HashOutputs[:])
} else if hashType&SighashMask == txscript.SigHashSingle && idx < len(tx.TxOut) {
var b bytes.Buffer
wire.WriteTxOut(&b, 0, 0, tx.TxOut[idx])
sigHash.Write(chainhash.DoubleHashB(b.Bytes()))
} else {
sigHash.Write(zeroHash[:])
}
// Finally, write out the transaction's locktime, and the sig hash
// type.
var bLockTime [4]byte
binary.LittleEndian.PutUint32(bLockTime[:], tx.LockTime)
sigHash.Write(bLockTime[:])
var bHashType [4]byte
binary.LittleEndian.PutUint32(bHashType[:], uint32(hashType|SighashForkID))
sigHash.Write(bHashType[:])
return chainhash.DoubleHashB(sigHash.Bytes())
}
================================================
FILE: chain/bitcoincash/utxo_test.go
================================================
package bitcoincash_test
================================================
FILE: chain/bsc/address.go
================================================
package bsc
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/bsc/address_test.go
================================================
package bsc_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/bsc"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := bsc.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr bsc.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := bsc.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr bsc.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr bsc.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr bsc.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr bsc.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/bsc/client.go
================================================
package bsc
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// bsc node.
DefaultClientRPCURL = "http://127.0.0.1:8575/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/bsc/encode.go
================================================
package bsc
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/bsc/encode_test.go
================================================
package bsc_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/bsc"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := bsc.Address(x)
resBytes := bsc.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { bsc.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr bsc.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := bsc.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/bsc/gas.go
================================================
package bsc
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/bsc/tx.go
================================================
package bsc
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/cosmos/address.go
================================================
package cosmos
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/renproject/multichain/api/address"
)
// An Address is a public address that can be encoded/decoded to/from strings.
// Addresses are usually formatted different between different network
// configurations.
type Address sdk.AccAddress
// AccAddress convert Address to sdk.AccAddress
func (addr Address) AccAddress() sdk.AccAddress {
return sdk.AccAddress(addr)
}
// String implements the Stringer interface
func (addr Address) String() string {
return sdk.AccAddress(addr).String()
}
// AddressEncodeDecoder encapsulates fields that implement the
// address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// NewAddressEncodeDecoder creates a new address encoder-decoder
func NewAddressEncodeDecoder() AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: NewAddressEncoder(),
AddressDecoder: NewAddressDecoder(),
}
}
// AddressEncoder implements the address.Encoder interface
type AddressEncoder struct {
}
// AddressDecoder implements the address.Decoder interface
type AddressDecoder struct {
}
// NewAddressDecoder creates a new address decoder
func NewAddressDecoder() AddressDecoder {
return AddressDecoder{}
}
// NewAddressEncoder creates a new address encoder
func NewAddressEncoder() AddressEncoder {
return AddressEncoder{}
}
// DecodeAddress consumes a human-readable representation of a cosmos
// compatible address and decodes it to its raw bytes representation.
func (decoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error) {
rawAddr, err := sdk.AccAddressFromBech32(string(addr))
if err != nil {
return nil, err
}
return address.RawAddress(rawAddr), nil
}
// EncodeAddress consumes raw bytes and encodes them to a human-readable
// address format.
func (encoder AddressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error) {
if err := sdk.VerifyAddressFormat(rawAddr); err != nil {
return address.Address(""), err
}
bech32Addr := sdk.AccAddress(rawAddr)
return address.Address(bech32Addr.String()), nil
}
================================================
FILE: chain/cosmos/address_test.go
================================================
package cosmos_test
================================================
FILE: chain/cosmos/client.go
================================================
package cosmos
import (
"context"
"encoding/hex"
"fmt"
"net/http"
"net/url"
"time"
codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
cosmClient "github.com/cosmos/cosmos-sdk/client"
cliRpc "github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx"
cosmTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
bankType "github.com/cosmos/cosmos-sdk/x/bank/types"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
const (
// DefaultClientTimeout used by the Client.
DefaultClientTimeout = time.Minute
// DefaultClientTimeoutRetry used by the Client.
DefaultClientTimeoutRetry = time.Second
// DefaultClientHost used by the Client. This should only be used for local
// deployments of the multichain.
DefaultClientHost = pack.String("http://0.0.0.0:26657")
// DefaultBroadcastMode configures the behaviour of a cosmos client while it
// interacts with the cosmos node. Allowed broadcast modes can be async, sync
// and block. "async" returns immediately after broadcasting, "sync" returns
// after the transaction has been checked and "block" waits until the
// transaction is committed to the chain.
DefaultBroadcastMode = pack.String("sync")
// DefaultCoinDenom used by the Client.
DefaultCoinDenom = pack.String("uluna")
)
// ClientOptions are used to parameterise the behaviour of the Client.
type ClientOptions struct {
Timeout time.Duration
TimeoutRetry time.Duration
Host pack.String
BroadcastMode pack.String
CoinDenom pack.String
ChainID pack.String
}
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return ClientOptions{
Timeout: DefaultClientTimeout,
TimeoutRetry: DefaultClientTimeoutRetry,
Host: DefaultClientHost,
BroadcastMode: DefaultBroadcastMode,
CoinDenom: DefaultCoinDenom,
ChainID: DefaultChainID,
}
}
// WithTimeout sets the timeout used by the Client.
func (opts ClientOptions) WithTimeout(timeout time.Duration) ClientOptions {
opts.Timeout = timeout
return opts
}
// WithTimeoutRetry sets the timeout retry used by the Client.
func (opts ClientOptions) WithTimeoutRetry(timeoutRetry time.Duration) ClientOptions {
opts.TimeoutRetry = timeoutRetry
return opts
}
// WithHost sets the URL of the node.
func (opts ClientOptions) WithHost(host pack.String) ClientOptions {
opts.Host = host
return opts
}
// WithBroadcastMode sets the behaviour of the Client when interacting with the
// underlying node.
func (opts ClientOptions) WithBroadcastMode(broadcastMode pack.String) ClientOptions {
opts.BroadcastMode = broadcastMode
return opts
}
// WithCoinDenom sets the coin denomination used by the Client.
func (opts ClientOptions) WithCoinDenom(coinDenom pack.String) ClientOptions {
opts.CoinDenom = coinDenom
return opts
}
// WithChainID sets the chain id used by the Client.
func (opts ClientOptions) WithChainID(chainid pack.String) ClientOptions {
opts.ChainID = chainid
return opts
}
// Client interacts with an instance of the Cosmos based network using the REST
// interface exposed by a lightclient node.
type Client struct {
opts ClientOptions
ctx cosmClient.Context
hrp string
}
// NewClient returns a new Client.
func NewClient(opts ClientOptions, cdc codec.Codec, txConfig cosmClient.TxConfig, interfaceReg codecTypes.InterfaceRegistry, amino *codec.LegacyAmino, hrp string) *Client {
httpClient, err := rpchttp.NewWithClient(
string(opts.Host),
"websocket",
&http.Client{
Timeout: opts.Timeout,
// We override the transport layer with a custom implementation as
// there is an issue with the Cosmos SDK that causes it to
// incorrectly parse URLs.
Transport: newTransport(string(opts.Host), &http.Transport{}),
})
if err != nil {
panic(err)
}
cliCtx := cosmClient.Context{}.WithCodec(cdc).WithClient(httpClient).WithTxConfig(txConfig).WithInterfaceRegistry(interfaceReg).WithAccountRetriever(authTypes.AccountRetriever{}).WithLegacyAmino(amino).WithChainID(string(opts.ChainID))
return &Client{
opts: opts,
ctx: cliCtx,
hrp: hrp,
}
}
// LatestBlock returns the most recent block's number.
func (client *Client) LatestBlock(ctx context.Context) (pack.U64, error) {
height, err := cliRpc.GetChainHeight(client.ctx)
if err != nil {
return pack.NewU64(0), fmt.Errorf("get chain height: %v", err)
}
if height < 0 {
return pack.NewU64(0), fmt.Errorf("unexpected chain height, expected > 0, got: %v", height)
}
return pack.NewU64(uint64(height)), nil
}
// Tx query transaction with txHash
func (client *Client) Tx(ctx context.Context, txHash pack.Bytes) (account.Tx, pack.U64, error) {
res, err := cosmTx.QueryTx(client.ctx, hex.EncodeToString(txHash[:]))
if err != nil {
return &Tx{}, pack.NewU64(0), fmt.Errorf("query fail: %v", err)
}
authStdTx := res.Tx.GetCachedValue().(*tx.Tx)
if res.Code != 0 {
return &Tx{}, pack.NewU64(0), fmt.Errorf("tx failed code: %v, log: %v", res.Code, res.RawLog)
}
return &Tx{originalTx: authStdTx, encoder: client.ctx.TxConfig.TxEncoder(), denom: string(client.opts.CoinDenom)}, pack.NewU64(1), nil
}
// SubmitTx to the Cosmos based network.
func (client *Client) SubmitTx(ctx context.Context, tx account.Tx) error {
txBytes, err := tx.Serialize()
if err != nil {
return fmt.Errorf("bad \"submittx\": %v", err)
}
res, err := client.ctx.WithBroadcastMode(client.opts.BroadcastMode.String()).BroadcastTx(txBytes)
if err != nil {
return fmt.Errorf("failed to broadcast tx : %w", err)
}
if res.Code != 0 {
return fmt.Errorf("tx failed code: %v, log: %v", res.Code, res.RawLog)
}
return nil
}
// AccountNonce returns the current nonce of the account. This is the nonce to
// be used while building a new transaction.
func (client *Client) AccountNonce(ctx context.Context, addr address.Address) (pack.U256, error) {
cosmosAddr, err := types.AccAddressFromBech32(string(addr))
if err != nil {
return pack.U256{}, fmt.Errorf("bad address: '%v': %v", addr, err)
}
acc, err := client.ctx.AccountRetriever.GetAccount(client.ctx, Address(cosmosAddr).AccAddress())
if err != nil {
return pack.U256{}, fmt.Errorf("failed to get account nonce : '%v': %v", addr, err)
}
return pack.NewU256FromU64(pack.NewU64(acc.GetSequence())), nil
}
// AccountNumber returns the account number for a given address.
func (client *Client) AccountNumber(ctx context.Context, addr address.Address) (pack.U64, error) {
cosmosAddr, err := types.AccAddressFromBech32(string(addr))
if err != nil {
return 0, fmt.Errorf("bad address: '%v': %v", addr, err)
}
acc, err := client.ctx.AccountRetriever.GetAccount(client.ctx, Address(cosmosAddr).AccAddress())
if err != nil {
return 0, fmt.Errorf("failed to get account : '%v': %w", addr, err)
}
return pack.U64(acc.GetAccountNumber()), nil
}
// AccountBalance returns the account balancee for a given address.
func (client *Client) AccountBalance(ctx context.Context, addr address.Address) (pack.U256, error) {
cosmosAddr, err := types.AccAddressFromBech32(string(addr))
if err != nil {
return pack.U256{}, fmt.Errorf("bad address: '%v': %v", addr, err)
}
balResp, err := bankType.NewQueryClient(client.ctx).Balance(ctx, bankType.NewQueryBalanceRequest(Address(cosmosAddr).AccAddress(), string(client.opts.CoinDenom)))
if err != nil {
return pack.U256{}, fmt.Errorf("failed to get account balance : '%v': %v", addr, err)
}
balance := balResp.GetBalance().Amount.BigInt()
// If the balance exceeds `MaxU256`, return an error.
if pack.MaxU256.Int().Cmp(balance) == -1 {
return pack.U256{}, fmt.Errorf("balance %v for %v exceeds MaxU256", balance.String(), addr)
}
return pack.NewU256FromInt(balance), nil
}
type transport struct {
remote string
proxy http.RoundTripper
}
// newTransport returns a custom implementation of http.RoundTripper that
// overrides the request URL prior to sending the request.
func newTransport(remote string, proxy http.RoundTripper) *transport {
return &transport{
remote: remote,
proxy: proxy,
}
}
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
u, err := url.Parse(t.remote)
if err != nil {
return nil, err
}
req.URL = u
req.Host = u.Host
// Proxy request.
return t.proxy.RoundTrip(req)
}
================================================
FILE: chain/cosmos/cosmos.go
================================================
package cosmos
================================================
FILE: chain/cosmos/cosmos_suite_test.go
================================================
package cosmos_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestCosmos(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cosmos Suite")
}
================================================
FILE: chain/cosmos/cosmos_test.go
================================================
package cosmos_test
================================================
FILE: chain/cosmos/gas.go
================================================
package cosmos
import (
"context"
"github.com/renproject/multichain/api/gas"
"github.com/renproject/pack"
)
// A GasEstimator returns the gas-per-byte that is needed in order to confirm
// transactions with an estimated maximum delay of one block. In distributed
// networks that collectively build, sign, and submit transactions, it is
// important that all nodes in the network have reached consensus on the
// gas-per-byte.
type GasEstimator struct {
gasPerByte pack.U256
}
// NewGasEstimator returns a simple gas estimator that always returns the same
// amount of gas-per-byte.
func NewGasEstimator(gasPerByte pack.U256) gas.Estimator {
return &GasEstimator{
gasPerByte: gasPerByte,
}
}
// EstimateGas returns gas required per byte for Cosmos-compatible chains. This
// value is used for both the price and cap, because Cosmos-compatible chains do
// not have a distinct concept of cap.
func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
return gasEstimator.gasPerByte, gasEstimator.gasPerByte, nil
}
================================================
FILE: chain/cosmos/gas_test.go
================================================
package cosmos_test
import (
"context"
"testing/quick"
"github.com/renproject/multichain/chain/cosmos"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating gas parameters", func() {
It("should work", func() {
f := func(gasPerByte pack.U256) bool {
gasEstimator := cosmos.NewGasEstimator(gasPerByte)
gasPrice, _, err := gasEstimator.EstimateGas(context.Background())
Expect(err).NotTo(HaveOccurred())
Expect(gasPrice).To(Equal(gasPerByte))
return true
}
Expect(quick.Check(f, nil)).To(Succeed())
})
})
})
================================================
FILE: chain/cosmos/tx.go
================================================
package cosmos
import (
"context"
"crypto/sha256"
"fmt"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/types"
txTypes "github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
bankType "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/renproject/id"
"github.com/renproject/multichain"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
"github.com/renproject/surge"
"github.com/tendermint/tendermint/crypto/tmhash"
)
const (
// DefaultChainID used by the Client.
DefaultChainID = pack.String("testnet")
// DefaultSignMode used in signing the tx
DefaultSignMode = 1
// DefaultDecimalsDivisor is used when estimating gas prices for some Cosmos
// chains, so that the result is an integer.
// For example, the recommended Terra gas price is currently 0.01133 uluna.
// To ensure we're only dealing with integers, the value can be represented
// as 1133. When the transaction builder is calculating fees, it will divide
// the total by the divisor (in this case 1e5), to calculate the actual
// value.
DefaultDecimalsDivisor = 1
)
// TxBuilderOptions only contains necessary options to build tx from tx builder
type TxBuilderOptions struct {
ChainID pack.String
DecimalsDivisor pack.U256
}
// DefaultTxBuilderOptions returns TxBuilderOptions with the default settings.
func DefaultTxBuilderOptions() TxBuilderOptions {
return TxBuilderOptions{
ChainID: DefaultChainID,
DecimalsDivisor: pack.NewU256FromU64(DefaultDecimalsDivisor),
}
}
// WithChainID sets the chain ID used by the transaction builder.
func (opts TxBuilderOptions) WithChainID(chainID pack.String) TxBuilderOptions {
opts.ChainID = chainID
return opts
}
func (opts TxBuilderOptions) WithDecimalsDivisor(decimalDivisor pack.U256) TxBuilderOptions {
opts.DecimalsDivisor = decimalDivisor
return opts
}
type txBuilder struct {
client *Client
chainID pack.String
signMode int32
decimalsDivisor pack.U256
}
// NewTxBuilder returns an implementation of the transaction builder interface
// from the Cosmos Compat API, and exposes the functionality to build simple
// Cosmos based transactions.
func NewTxBuilder(options TxBuilderOptions, client *Client) account.TxBuilder {
return txBuilder{
signMode: DefaultSignMode,
client: client,
chainID: options.ChainID,
decimalsDivisor: options.DecimalsDivisor,
}
}
// WithSignMode ad custom sign mode to the txBuilder
func (builder txBuilder) WithSignMode(signMode int32) txBuilder {
builder.signMode = signMode
return builder
}
// BuildTx consumes a list of MsgSend to build and return a cosmos transaction.
// This transaction is unsigned, and must be signed before submitting to the
// cosmos chain.
func (builder txBuilder) BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gasLimit, gasPrice, gasCap pack.U256, payload pack.Bytes) (account.Tx, error) {
pubKeyBytes, err := surge.ToBinary(fromPubKey)
if err != nil {
return nil, err
}
pubKey := secp256k1.PubKey{Key: pubKeyBytes}
from := multichain.Address(types.AccAddress(pubKey.Address()).String())
fromAddr, err := types.AccAddressFromBech32(string(from))
if err != nil {
return nil, err
}
toAddr, err := types.AccAddressFromBech32(string(to))
if err != nil {
return nil, err
}
sendMsg := MsgSend{
FromAddress: Address(fromAddr),
ToAddress: Address(toAddr),
Amount: []Coin{
{
Denom: builder.client.opts.CoinDenom,
Amount: pack.NewU64(value.Int().Uint64()),
},
},
}
fees := Coins{Coin{
Denom: builder.client.opts.CoinDenom,
Amount: pack.NewU64(gasPrice.Mul(gasLimit).Div(builder.decimalsDivisor).Int().Uint64()),
}}
accountNumber, err := builder.client.AccountNumber(ctx, from)
if err != nil {
return nil, err
}
txBuilder := builder.client.ctx.TxConfig.NewTxBuilder()
txBuilder.SetFeeAmount(fees.Coins())
txBuilder.SetGasLimit(gasLimit.Int().Uint64())
txBuilder.SetMemo(string(payload))
err = txBuilder.SetMsgs(sendMsg.Msg())
if err != nil {
return nil, err
}
if err != nil {
return nil, err
}
sigData := signing.SingleSignatureData{
SignMode: signing.SignMode(builder.signMode),
Signature: nil,
}
sig := signing.SignatureV2{
PubKey: &pubKey,
Data: &sigData,
Sequence: nonce.Int().Uint64(),
}
if err = txBuilder.SetSignatures(sig); err != nil {
return nil, err
}
signerData := authsigning.SignerData{
AccountNumber: accountNumber.Uint64(),
ChainID: string(builder.chainID),
Sequence: nonce.Int().Uint64(),
}
txConfig := builder.client.ctx.TxConfig
signMsg, err := txConfig.SignModeHandler().GetSignBytes(signing.SignMode(builder.signMode), signerData, txBuilder.GetTx())
if err != nil {
return nil, err
}
return &Tx{
encoder: builder.client.ctx.TxConfig.TxEncoder(),
signMsg: signMsg,
sigV2: sig,
txBuilder: txBuilder,
sendMsg: &sendMsg,
memo: string(payload),
denom: string(builder.client.opts.CoinDenom),
}, nil
}
// Coin copy type from types.coin
type Coin struct {
Denom pack.String `json:"denom"`
Amount pack.U64 `json:"amount"`
}
// Coins array of Coin
type Coins []Coin
// Coins parse pack coins to sdk coins
func (coins Coins) Coins() types.Coins {
sdkCoins := make(types.Coins, 0, len(coins))
for _, coin := range coins {
sdkCoins = append(sdkCoins, types.Coin{
Denom: coin.Denom.String(),
Amount: types.NewInt(int64(coin.Amount.Uint64())),
})
}
sdkCoins.Sort()
return sdkCoins
}
// MsgSend - high level transaction of the coin module
type MsgSend struct {
FromAddress Address `json:"from_address" yaml:"from_address"`
ToAddress Address `json:"to_address" yaml:"to_address"`
Amount Coins `json:"amount" yaml:"amount"`
}
// Msg convert MsgSend to types.Msg
func (msg MsgSend) Msg() types.Msg {
return bankType.NewMsgSend(
msg.FromAddress.AccAddress(),
msg.ToAddress.AccAddress(),
msg.Amount.Coins(),
)
}
// Tx is a tx.Tx wrapper
type Tx struct {
// Always present
originalTx *txTypes.Tx
encoder types.TxEncoder
denom string
// Fields only used when constucting with a tx builder
sendMsg *MsgSend
memo string
signMsg []byte
sigV2 signing.SignatureV2
txBuilder client.TxBuilder
}
// From returns the sender of the transaction
func (t Tx) From() address.Address {
if t.originalTx != nil {
return address.Address(t.originalTx.GetBody().Messages[0].GetCachedValue().(*bankType.MsgSend).FromAddress)
}
if t.sendMsg != nil {
return address.Address(t.sendMsg.FromAddress.String())
}
return address.Address("")
}
// To returns the recipients of the transaction. For the cosmos chain, there
// can be multiple recipients from a single transaction.
func (t Tx) To() address.Address {
if t.originalTx != nil {
return address.Address(t.originalTx.GetBody().Messages[0].GetCachedValue().(*bankType.MsgSend).ToAddress)
}
if t.sendMsg != nil {
return address.Address(t.sendMsg.ToAddress.String())
}
return address.Address("")
}
// Value returns the values being transferred in a transaction. For the cosmos
// chain, there can be multiple messages (each with a different value being
// transferred) in a single transaction.
func (t Tx) Value() pack.U256 {
value := pack.NewU64(0)
if t.originalTx != nil {
msgs := t.originalTx.GetBody().Messages
for _, msg := range msgs {
amount := msg.GetCachedValue().(*bankType.MsgSend).Amount[0]
if amount.Denom == t.denom {
value.AddAssign(pack.NewU64(amount.Amount.Uint64()))
}
}
} else if t.sendMsg != nil {
value.AddAssign(pack.NewU64(t.sendMsg.Amount.Coins()[0].Amount.Uint64()))
}
return pack.NewU256FromU64(value)
}
// Nonce returns the transaction count of the transaction sender.
func (t Tx) Nonce() pack.U256 {
if t.originalTx != nil {
return pack.NewU256FromUint64(t.originalTx.GetAuthInfo().SignerInfos[0].Sequence)
}
if t.sendMsg != nil {
return pack.NewU256FromU64(pack.NewU64(t.sigV2.Sequence))
}
return pack.NewU256FromU64(0)
}
// Payload returns the memo attached to the transaction.
func (t Tx) Payload() contract.CallData {
if t.originalTx != nil {
return contract.CallData(t.originalTx.GetBody().Memo)
}
if t.sendMsg != nil {
return contract.CallData(t.memo)
}
return contract.CallData("")
}
// Hash return txhash bytes.
func (t Tx) Hash() pack.Bytes {
txBytes, err := t.Serialize()
if err != nil {
return pack.Bytes{}
}
return pack.NewBytes(tmhash.Sum(txBytes))
}
// Sighashes that need to be signed before this transaction can be submitted.
func (t Tx) Sighashes() ([]pack.Bytes32, error) {
return []pack.Bytes32{sha256.Sum256(t.signMsg)}, nil
}
// Sign the transaction by injecting signatures and the serialized pubkey of
// the signer.
func (t *Tx) Sign(signatures []pack.Bytes65, pubKey pack.Bytes) error {
if len(signatures) == 0 {
return fmt.Errorf("zero signatures found")
}
sig := serializeSig(signatureFromBytes(signatures[0].Bytes()))
singleData := t.sigV2.Data.(*signing.SingleSignatureData)
singleData.Signature = sig
t.sigV2.Data = singleData
err := t.txBuilder.SetSignatures(t.sigV2)
if err != nil {
return err
}
return nil
}
// Serialize the transaction.
func (t Tx) Serialize() (pack.Bytes, error) {
var txBytes []byte
var err error = nil
if t.originalTx != nil {
txBytes, err = t.encoder(tx.WrapTx(t.originalTx).GetTx())
} else if t.sendMsg != nil {
txBytes, err = t.encoder(t.txBuilder.GetTx())
}
if err != nil {
return pack.Bytes{}, err
}
return txBytes, nil
}
func signatureFromBytes(sigStr []byte) *btcec.Signature {
return &btcec.Signature{
R: new(big.Int).SetBytes(sigStr[:32]),
S: new(big.Int).SetBytes(sigStr[32:64]),
}
}
// Serialize signature to R || S.
// R, S are padded to 32 bytes respectively.
func serializeSig(sig *btcec.Signature) []byte {
rBytes := sig.R.Bytes()
sBytes := sig.S.Bytes()
sigBytes := make([]byte, 64)
// 0 pad the byte arrays from the left if they aren't big enough.
copy(sigBytes[32-len(rBytes):32], rBytes)
copy(sigBytes[64-len(sBytes):64], sBytes)
return sigBytes
}
================================================
FILE: chain/digibyte/address.go
================================================
package digibyte
import "github.com/renproject/multichain/chain/bitcoin"
// AddressEncoder encapsulates the chain specific configurations and implements
// the address.Encoder interface
type AddressEncoder = bitcoin.AddressEncoder
// AddressDecoder encapsulates the chain specific configurations and implements
// the address.Decoder interface
type AddressDecoder = bitcoin.AddressDecoder
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder = bitcoin.AddressEncodeDecoder
================================================
FILE: chain/digibyte/address_test.go
================================================
package digibyte_test
import (
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/multichain/chain/digibyte"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DigiByte", func() {
Context("when decoding an address", func() {
It("should work without errors", func() {
_, err := bitcoin.NewAddressDecoder(&digibyte.MainNetParams).DecodeAddress(address.Address("DBLsEv4FdFPGrMWzcagDQvoKgUL2CikhMf"))
Expect(err).NotTo(HaveOccurred())
})
})
})
================================================
FILE: chain/digibyte/digibyte.go
================================================
package digibyte
import (
"math/big"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
)
func init() {
if err := chaincfg.Register(&MainNetParams); err != nil {
panic(err)
}
if err := chaincfg.Register(&TestnetParams); err != nil {
panic(err)
}
if err := chaincfg.Register(&RegressionNetParams); err != nil {
panic(err)
}
}
var (
bigOne = big.NewInt(1)
mainPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 224), bigOne)
)
const (
// DeploymentTestDummy ...
DeploymentTestDummy = iota
// DeploymentCSV ...
DeploymentCSV
// DeploymentSegwit ...
DeploymentSegwit
// DefinedDeployments ...
DefinedDeployments
)
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
// the main network, regression test network, and test network (version 3).
var genesisCoinbaseTx = wire.MsgTx{
Version: 1,
TxIn: []*wire.TxIn{
{
PreviousOutPoint: wire.OutPoint{
Hash: chainhash.Hash{},
Index: 0xffffffff,
},
SignatureScript: []byte{
0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, 0x45, 0x55, 0x53, 0x41, 0x20, 0x54, 0x6f, 0x64, 0x61, /* |.......EUSA Toda| */
0x79, 0x3a, 0x20, 0x31, 0x30, 0x2f, 0x4a, 0x61, 0x6e, 0x2f, 0x32, 0x30, 0x31, 0x34, 0x2c, 0x20, /* |y: 10/Jan/2014, | */
0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3a, 0x20, 0x44, 0x61, 0x74, 0x61, 0x20, 0x73, 0x74, 0x6f, /* |Target: Data sto| */
0x6c, 0x65, 0x6e, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x75, 0x70, 0x20, 0x74, 0x6f, 0x20, 0x31, /* |len from up to 1| */
0x31, 0x30, 0x4d, 0x20, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x73, 0x61, 0x32, 0x30, /* |10M customers| */
},
Sequence: 0xffffffff,
},
},
TxOut: []*wire.TxOut{
{
Value: 0x12a05f200,
PkScript: []byte{ // ToDo
0x41, 0x04, 0x67, 0x8a, 0xfd, 0xb0, 0xfe, 0x55, /* |A.g....U| */
0x48, 0x27, 0x19, 0x67, 0xf1, 0xa6, 0x71, 0x30, /* |H'.g..q0| */
0xb7, 0x10, 0x5c, 0xd6, 0xa8, 0x28, 0xe0, 0x39, /* |..\..(.9| */
0x09, 0xa6, 0x79, 0x62, 0xe0, 0xea, 0x1f, 0x61, /* |..yb...a| */
0xde, 0xb6, 0x49, 0xf6, 0xbc, 0x3f, 0x4c, 0xef, /* |..I..?L.| */
0x38, 0xc4, 0xf3, 0x55, 0x04, 0xe5, 0x1e, 0xc1, /* |8..U....| */
0x12, 0xde, 0x5c, 0x38, 0x4d, 0xf7, 0xba, 0x0b, /* |..\8M...| */
0x8d, 0x57, 0x8a, 0x4c, 0x70, 0x2b, 0x6b, 0xf1, /* |.W.Lp+k.| */
0x1d, 0x5f, 0xac, /* |._.| */
},
},
},
LockTime: 0,
}
// USA Today: 10/Jan/2014, Target: Data stolen from up to 110M customers
var genesisMerkleRoot = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
0x96, 0x84, 0x1e, 0x6e, 0xcc, 0x8d,
0xc9, 0x64, 0x3a, 0xad, 0xdf, 0xb6,
0xfc, 0xd6, 0x16, 0xe0, 0x8f, 0x07,
0x77, 0xc8, 0x7b, 0x50, 0x8f, 0x1c,
0x9f, 0xb3, 0x5e, 0x46, 0x1b, 0xea,
0x97, 0x74,
})
var genesisBlock = wire.MsgBlock{
Header: wire.BlockHeader{
Version: 1,
PrevBlock: chainhash.Hash{}, // 0000000000000000000000000000000000000000000000000000000000000000
MerkleRoot: genesisMerkleRoot, // 7497ea1b465eb39f1c8f507bc877078fe016d6fcb6dfad3a64c98dcc6e1e8496
Timestamp: time.Unix(1389388394, 0), // 2014-01-10T21:13:14.000Z
Bits: 0x1e0ffff0, // 486604799 [00000000ffff0000000000000000000000000000000000000000000000000000]
Nonce: 2447652,
},
Transactions: []*wire.MsgTx{&genesisCoinbaseTx},
}
var genesisHash = chainhash.Hash([chainhash.HashSize]byte{ // Make go vet happy.
0x96, 0x84, 0x1e, 0x6e, 0xcc, 0x8d, 0xc9, 0x64,
0x3a, 0xad, 0xdf, 0xb6, 0xfc, 0xd6, 0x16, 0xe0,
0x8f, 0x07, 0x77, 0xc8, 0x7b, 0x50, 0x8f, 0x1c,
0x9f, 0xb3, 0x5e, 0x46, 0x1b, 0xea, 0x97, 0x74,
})
func newHashFromStr(hexStr string) *chainhash.Hash {
hash, err := chainhash.NewHashFromStr(hexStr)
if err != nil {
panic(err)
}
return hash
}
// MainNetParams returns the chain configuration for mainnet
var MainNetParams = chaincfg.Params{
Name: "mainnet",
Net: 0xdab6c3fa,
DefaultPort: "12024",
// Chain parameters
GenesisBlock: &genesisBlock,
GenesisHash: &genesisHash,
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173.
Bech32HRPSegwit: "dgb", // always bc for main net
// Address encoding magics
PubKeyHashAddrID: 0x1e, // starts with 1
ScriptHashAddrID: 0x3f, // starts with 3
PrivateKeyID: 0x80, // starts with 5 (uncompressed) or K (compressed)
WitnessPubKeyHashAddrID: 0x06, // starts with p2
WitnessScriptHashAddrID: 0x0A, // starts with 7Xh
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x88, 0xad, 0xe4}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x88, 0xb2, 0x1e}, // starts with xpub
// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
HDCoinType: 0x14,
}
// TestnetParams returns the chain configuration for testnet
var TestnetParams = chaincfg.Params{
Name: "testnet",
// DigiByte has 0xdab5bffa as RegTest (same as Bitcoin's RegTest).
// Setting it to an arbitrary value (leet_hex(digibyte)), so that we can
// register the regtest network.
// DigiByte Core Developers will change this soon.
Net: 0xddbdc8fd,
DefaultPort: "12026",
// Chain parameters
GenesisBlock: &genesisBlock,
GenesisHash: &genesisHash,
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173.
Bech32HRPSegwit: "dgbt", // always bc for main net
// Address encoding magics
PubKeyHashAddrID: 0x7e, // starts with 1
ScriptHashAddrID: 0x8c, // starts with 3
PrivateKeyID: 0xfe, // starts with 5 (uncompressed) or K (compressed)
WitnessPubKeyHashAddrID: 0x06, // starts with p2
WitnessScriptHashAddrID: 0x0A, // starts with 7Xh
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with xpub
// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
HDCoinType: 0x14,
}
// RegressionNetParams returns the chain configuration for regression net
var RegressionNetParams = chaincfg.Params{
Name: "regtest",
// DigiByte has 0xdab5bffa as RegTest (same as Bitcoin's RegTest).
// Setting it to an arbitrary value (leet_hex(digibyte)), so that we can
// register the regtest network.
// DigiByte Core Developers will change this soon.
Net: 0xd191841e,
DefaultPort: "18444",
// Chain parameters
GenesisBlock: &genesisBlock,
GenesisHash: &genesisHash,
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173.
Bech32HRPSegwit: "dgbrt", // always bc for main net
// Address encoding magics
PubKeyHashAddrID: 0x7e, // starts with 1
ScriptHashAddrID: 0x8c, // starts with 3
PrivateKeyID: 0xfe, // starts with 5 (uncompressed) or K (compressed)
WitnessPubKeyHashAddrID: 0x06, // starts with p2
WitnessScriptHashAddrID: 0x0A, // starts with 7Xh
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with xpub
// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
HDCoinType: 0x14,
}
================================================
FILE: chain/digibyte/digibyte_suite_test.go
================================================
package digibyte_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestDigiByte(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DigiByte Suite")
}
================================================
FILE: chain/digibyte/digibyte_test.go
================================================
package digibyte_test
import (
"context"
"log"
"os"
"reflect"
"time"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/multichain/chain/digibyte"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DigiByte", func() {
Context("when submitting transactions", func() {
Context("when sending DigiByte to multiple addresses", func() {
It("should work", func() {
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting DIGIBYTE_PK to the
// value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("DIGIBYTE_PK")
if pkEnv == "" {
panic("DIGIBYTE_PK is undefined")
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).ToNot(HaveOccurred())
// PKH
wpkhAddr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &digibyte.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("WPKH %v", wpkhAddr.EncodeAddress())
// PKH
pkhAddr, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &digibyte.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
pkhAddrUncompressed, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &digibyte.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("PKH %v", pkhAddr.EncodeAddress())
log.Printf("PKH (uncompressed) %v", pkhAddrUncompressed.EncodeAddress())
// Setup the client and load the unspent transaction outputs.
client := bitcoin.NewClient(bitcoin.DefaultClientOptions().WithHost("http://127.0.0.1:20443"))
outputs, err := client.UnspentOutputs(context.Background(), 0, 999999999, address.Address(pkhAddr.EncodeAddress()))
Expect(err).ToNot(HaveOccurred())
Expect(len(outputs)).To(BeNumerically(">", 0))
output := outputs[0]
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err := client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Build the transaction by consuming the outputs and spending
// them to a set of recipients.
inputs := []utxo.Input{
{Output: output},
}
recipients := []utxo.Recipient{
{
To: address.Address(wpkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
{
To: address.Address(pkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
{
To: address.Address(pkhAddrUncompressed.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 3)),
},
}
tx, err := digibyte.NewTxBuilder(&digibyte.RegressionNetParams).BuildTx(inputs, recipients)
Expect(err).ToNot(HaveOccurred())
// Get the digests that need signing from the transaction, and
// sign them. In production, this would be done using the RZL
// MPC algorithm, but for the purposes of this test, using an
// explicit privkey is ok.
sighashes, err := tx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(tx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the transaction to the DigiByte node. Again, this
// should be running a la `./multichaindeploy`.
txHash, err := tx.Hash()
Expect(err).ToNot(HaveOccurred())
err = client.SubmitTx(context.Background(), tx)
Expect(err).ToNot(HaveOccurred())
log.Printf("TXID %v", txHash)
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a DigiByte transaction!
confs, err := client.Confirmations(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
log.Printf(" %v/3 confirmations", confs)
if confs >= 3 {
break
}
time.Sleep(10 * time.Second)
}
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err = client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Check we can get the transaction inputs
senders, err := client.TxSenders(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
Expect(len(senders)).Should(Equal(1))
Expect(senders[0]).Should(Equal(pkhAddr.EncodeAddress()))
})
})
})
})
================================================
FILE: chain/digibyte/gas.go
================================================
package digibyte
import "github.com/renproject/multichain/chain/bitcoin"
// GasEstimator re-exports bitcoin.GasEstimator.
type GasEstimator = bitcoin.GasEstimator
// NewGasEstimator re-exports bitcoin.NewGasEstimator.
var NewGasEstimator = bitcoin.NewGasEstimator
================================================
FILE: chain/digibyte/gas_test.go
================================================
package digibyte_test
================================================
FILE: chain/digibyte/utxo.go
================================================
package digibyte
import "github.com/renproject/multichain/chain/bitcoin"
type (
// Tx represents a simple Bitcoin transaction that implements the Bitcoin Compat
// API.
Tx = bitcoin.Tx
// The TxBuilder is an implementation of a UTXO-compatible transaction builder
// for Bitcoin.
TxBuilder = bitcoin.TxBuilder
// A Client interacts with an instance of the Bitcoin network using the RPC
// interface exposed by a Bitcoin node.
Client = bitcoin.Client
// ClientOptions are used to parameterise the behaviour of the Client.
ClientOptions = bitcoin.ClientOptions
)
var (
// NewTxBuilder re-exports bitoin.NewTxBuilder
NewTxBuilder = bitcoin.NewTxBuilder
// NewClient re-exports bitcoin.NewClient
NewClient = bitcoin.NewClient
)
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return bitcoin.DefaultClientOptions().WithHost("http://0.0.0.0:20443")
}
================================================
FILE: chain/digibyte/utxo_test.go
================================================
package digibyte_test
================================================
FILE: chain/dogecoin/address.go
================================================
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
type (
// AddressEncoder re-exports bitcoin.AddressEncoder.
AddressEncoder = bitcoin.AddressEncoder
// AddressDecoder re-exports bitcoin.AddressDecoder.
AddressDecoder = bitcoin.AddressDecoder
// AddressEncodeDecoder re-exports bitcoin.AddressEncodeDecoder.
AddressEncodeDecoder = bitcoin.AddressEncodeDecoder
)
================================================
FILE: chain/dogecoin/address_test.go
================================================
package dogecoin_test
import (
"github.com/renproject/multichain"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/multichain/chain/dogecoin"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Dogecoin", func() {
Context("when decoding segwit address", func() {
Context("when decoding an address from a different network ", func() {
It("should return an error ", func() {
// A valid bitcoin segwit address which is not a valid doge address
addr := multichain.Address("bc1qk6yk2ctcu2pmtxfzhya692h774562vlv2g7dvl")
decoder := bitcoin.NewAddressDecoder(&dogecoin.MainNetParams)
_, err := decoder.DecodeAddress(addr)
Expect(err).To(HaveOccurred())
})
})
})
})
================================================
FILE: chain/dogecoin/dogecoin.go
================================================
package dogecoin
import (
"github.com/btcsuite/btcd/chaincfg"
)
func init() {
if err := chaincfg.Register(&MainNetParams); err != nil {
panic(err)
}
if err := chaincfg.Register(&TestNetParams); err != nil {
panic(err)
}
if err := chaincfg.Register(&RegressionNetParams); err != nil {
panic(err)
}
}
// MainNetParams returns the chain configuration for mainnet.
var MainNetParams = chaincfg.Params{
Name: "mainnet",
Net: 0xc0c0c0c0,
// Address encoding magics
PubKeyHashAddrID: 30,
ScriptHashAddrID: 22,
PrivateKeyID: 158,
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x02, 0xfa, 0xc3, 0x98}, // starts with xprv
HDPublicKeyID: [4]byte{0x02, 0xfa, 0xca, 0xfd}, // starts with xpub
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173. Dogecoin does not actually support this, but we do not want to
// collide with real addresses, so we specify it.
Bech32HRPSegwit: "doge",
}
// TestNetParams returns the chain configuration for testnet.
var TestNetParams = chaincfg.Params{
Name: "testnet",
Net: 0xfcc1b7dc,
// Address encoding magics
PubKeyHashAddrID: 113,
ScriptHashAddrID: 196,
PrivateKeyID: 241,
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with xpub
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173. Dogecoin does not actually support this, but we do not want to
// collide with real addresses, so we specify it.
Bech32HRPSegwit: "doget",
}
// RegressionNetParams returns the chain configuration for regression net.
var RegressionNetParams = chaincfg.Params{
Name: "regtest",
// Dogecoin has 0xdab5bffa as RegTest (same as Bitcoin's RegTest).
// Setting it to an arbitrary value (leet_hex(dogecoin)), so that we can
// register the regtest network.
Net: 0xfabfb5da,
// Address encoding magics
PubKeyHashAddrID: 111,
ScriptHashAddrID: 196,
PrivateKeyID: 239,
// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x94}, // starts with xprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xcf}, // starts with xpub
// Human-readable part for Bech32 encoded segwit addresses, as defined in
// BIP 173. Dogecoin does not actually support this, but we do not want to
// collide with real addresses, so we specify it.
Bech32HRPSegwit: "dogert",
}
================================================
FILE: chain/dogecoin/dogecoin_suite_test.go
================================================
package dogecoin_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestDogecoin(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Dogecoin Suite")
}
================================================
FILE: chain/dogecoin/dogecoin_test.go
================================================
package dogecoin_test
import (
"context"
"log"
"os"
"reflect"
"time"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/dogecoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Dogecoin", func() {
Context("when submitting transactions", func() {
Context("when sending DOGE to multiple addresses", func() {
It("should work", func() {
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting DOGECOIN_PK to the
// value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("DOGECOIN_PK")
if pkEnv == "" {
panic("DOGECOIN_PK is undefined")
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).ToNot(HaveOccurred())
// PKH
pkhAddr, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &dogecoin.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
pkhAddrUncompressed, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &dogecoin.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("PKH %v", pkhAddr.EncodeAddress())
log.Printf("PKH (uncompressed) %v", pkhAddrUncompressed.EncodeAddress())
// Setup the client and load the unspent transaction outputs.
client := dogecoin.NewClient(dogecoin.DefaultClientOptions().WithHost("http://127.0.0.1:18332"))
outputs, err := client.UnspentOutputs(context.Background(), 0, 999999999, address.Address(pkhAddr.EncodeAddress()))
Expect(err).ToNot(HaveOccurred())
Expect(len(outputs)).To(BeNumerically(">", 0))
output := outputs[0]
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err := client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Build the transaction by consuming the outputs and spending
// them to a set of recipients.
inputs := []utxo.Input{
{Output: output},
}
recipients := []utxo.Recipient{
{
To: address.Address(pkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
{
To: address.Address(pkhAddrUncompressed.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
}
tx, err := dogecoin.NewTxBuilder(&dogecoin.RegressionNetParams).BuildTx(inputs, recipients)
Expect(err).ToNot(HaveOccurred())
// Get the digests that need signing from the transaction, and
// sign them. In production, this would be done using the RZL
// MPC algorithm, but for the purposes of this test, using an
// explicit privkey is ok.
sighashes, err := tx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(tx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the transaction to the Dogecoin node. Again, this
// should be running a la `./multichaindeploy`.
txHash, err := tx.Hash()
Expect(err).ToNot(HaveOccurred())
err = client.SubmitTx(context.Background(), tx)
Expect(err).ToNot(HaveOccurred())
log.Printf("TXID %v", txHash)
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a Dogecoin transaction!
confs, err := client.Confirmations(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
log.Printf(" %v/3 confirmations", confs)
if confs >= 3 {
break
}
time.Sleep(10 * time.Second)
}
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err = client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Check we can get the transaction inputs
senders, err := client.TxSenders(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
Expect(len(senders)).Should(Equal(1))
Expect(senders[0]).Should(Equal(pkhAddr.EncodeAddress()))
})
})
})
})
================================================
FILE: chain/dogecoin/gas.go
================================================
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
// GasEstimator re-exports bitcoin.GasEstimator.
type GasEstimator = bitcoin.GasEstimator
// NewGasEstimator re-exports bitcoin.NewGasEstimator.
var NewGasEstimator = bitcoin.NewGasEstimator
================================================
FILE: chain/dogecoin/gas_test.go
================================================
package dogecoin_test
import (
"context"
"github.com/renproject/multichain/chain/dogecoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating dogecoin network fee", func() {
It("should work", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client := dogecoin.NewClient(dogecoin.DefaultClientOptions())
// estimate fee to include tx within 1 block.
fallback1 := uint64(123)
gasEstimator1 := dogecoin.NewGasEstimator(client, 1, pack.NewU256FromUint64(fallback1))
gasPrice1, _, err := gasEstimator1.EstimateGas(ctx)
if err != nil {
Expect(gasPrice1).To(Equal(pack.NewU256FromUint64(fallback1)))
}
// estimate fee to include tx within 10 blocks.
fallback2 := uint64(234)
gasEstimator2 := dogecoin.NewGasEstimator(client, 10, pack.NewU256FromUint64(fallback2))
gasPrice2, _, err := gasEstimator2.EstimateGas(ctx)
if err != nil {
Expect(gasPrice2).To(Equal(pack.NewU256FromUint64(fallback2)))
}
// estimate fee to include tx within 100 blocks.
fallback3 := uint64(345)
gasEstimator3 := dogecoin.NewGasEstimator(client, 100, pack.NewU256FromUint64(fallback3))
gasPrice3, _, err := gasEstimator3.EstimateGas(ctx)
if err != nil {
Expect(gasPrice3).To(Equal(pack.NewU256FromUint64(fallback3)))
}
// expect fees in this order at the very least.
if err == nil {
Expect(gasPrice1.GreaterThanEqual(gasPrice2)).To(BeTrue())
Expect(gasPrice2.GreaterThanEqual(gasPrice3)).To(BeTrue())
}
})
})
})
================================================
FILE: chain/dogecoin/utxo.go
================================================
package dogecoin
import "github.com/renproject/multichain/chain/bitcoin"
type (
// Tx re-exports bitcoin.Tx.
Tx = bitcoin.Tx
// TxBuilder re-exports bitcoin.TxBuilder.
TxBuilder = bitcoin.TxBuilder
// Client re-exports bitcoin.Client.
Client = bitcoin.Client
// ClientOptions re-exports bitcoin.ClientOptions.
ClientOptions = bitcoin.ClientOptions
)
var (
// NewTxBuilder re-exports bitcoin.NewTxBuilder.
NewTxBuilder = bitcoin.NewTxBuilder
// NewClient re-exports bitcoin.NewClient.
NewClient = bitcoin.NewClient
)
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return bitcoin.DefaultClientOptions().WithHost("http://0.0.0.0:18332")
}
================================================
FILE: chain/dogecoin/utxo_test.go
================================================
package dogecoin_test
================================================
FILE: chain/ethereum/address.go
================================================
package ethereum
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/ethereum/address_test.go
================================================
package ethereum_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/ethereum"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := ethereum.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := ethereum.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr ethereum.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/ethereum/client.go
================================================
package ethereum
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// ethereum node.
DefaultClientRPCURL = "http://127.0.0.1:8545/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/ethereum/encode.go
================================================
package ethereum
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/ethereum/encode_test.go
================================================
package ethereum_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/ethereum"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := ethereum.Address(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { ethereum.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr ethereum.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := ethereum.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/ethereum/gas.go
================================================
package ethereum
import (
"context"
"fmt"
"math/big"
"sort"
"github.com/renproject/pack"
)
const (
// FeeHistoryBlocks specifies how many blocks to consider for priority fee estimation
FeeHistoryBlocks = 10
// FeeHistoryPercentile specifies the percentile of effective priority fees to include
FeeHistoryPercentile = 5
// FallbackMaxFeePerGas is the fallback value used when MaxFeePerGas cannot be calculated
FallbackMaxFeePerGas = 20000000000
)
var (
// PriorityFeeEstimationTrigger specifies which base fee to trigger priority fee estimation at
PriorityFeeEstimationTrigger = big.NewInt(100000000000) // WEI
// DefaultPriorityFee is returned if above trigger is not met
DefaultPriorityFee = big.NewInt(3000000000)
// PriorityFeeIncreaseBoundary signifies a big bump in fee history priority reward, due to which we choose
// not to consider values under it while calculating the median priority fee.
PriorityFeeIncreaseBoundary = big.NewInt(200)
)
// GasOptions allow a user to configure the parameters used while heuristically recommending
// fees for EIP-1559 compatible transactions.
type GasOptions struct {
FeeHistoryBlocks uint64
FeeHistoryPercentile uint64
FallbackMaxFeePerGas uint64
PriorityFeeEstimationTrigger *big.Int
DefaultPriorityFee *big.Int
PriorityFeeIncreaseBoundary *big.Int
}
// A GasEstimator returns the gas price and the provide gas limit that is needed in
// order to confirm transactions with an estimated maximum delay of one block.
type GasEstimator struct {
client *Client
options *GasOptions
}
// NewGasEstimator returns a simple gas estimator that fetches the ideal gas
// price for an ethereum transaction to be included in a block
// with minimal delay.
func NewGasEstimator(client *Client, opts GasOptions) *GasEstimator {
return &GasEstimator{
client: client,
options: &opts,
}
}
// NewDefaultGasEstimator returns a simple gas estimator with default gas options
// that fetches the ideal gas price for an ethereum transaction to be included
// in a block with minimal delay.
func NewDefaultGasEstimator(client *Client) *GasEstimator {
return &GasEstimator{
client: client,
options: &GasOptions{
FeeHistoryBlocks,
FeeHistoryPercentile,
FallbackMaxFeePerGas,
PriorityFeeEstimationTrigger,
DefaultPriorityFee,
PriorityFeeIncreaseBoundary,
},
}
}
// EstimateGas returns an estimate of the current gas price
// and returns the gas limit provided. These numbers change with congestion. These estimates
// are often a little off, and this should be considered when using them.
func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
latest, err := gasEstimator.client.EthClient.HeaderByNumber(ctx, nil)
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("failed to get eth suggested gas price: %v", err)
}
// base fee is in wei
if latest.BaseFee == nil {
// fallback values
return pack.NewU256FromInt(gasEstimator.options.DefaultPriorityFee), pack.NewU256FromUint64(gasEstimator.options.FallbackMaxFeePerGas), nil
}
baseFee := new(big.Int).Set(latest.BaseFee)
estimatedPriorityFee, err := gasEstimator.estimatePriorityFee(ctx, baseFee, latest.Number)
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), err
}
if estimatedPriorityFee == nil {
// fallback values
return pack.NewU256FromInt(gasEstimator.options.DefaultPriorityFee), pack.NewU256FromUint64(gasEstimator.options.FallbackMaxFeePerGas), nil
}
maxPriorityFeePerGas := gasEstimator.options.DefaultPriorityFee
if estimatedPriorityFee.Cmp(maxPriorityFeePerGas) == 1 {
maxPriorityFeePerGas = estimatedPriorityFee
}
potentialMaxFee := new(big.Int).Mul(baseFee, big.NewInt(12))
if baseFee.Cmp(big.NewInt(40000000000)) == -1 {
potentialMaxFee = new(big.Int).Mul(baseFee, big.NewInt(20))
} else if baseFee.Cmp(big.NewInt(100000000000)) == -1 {
potentialMaxFee = new(big.Int).Mul(baseFee, big.NewInt(16))
} else if baseFee.Cmp(big.NewInt(200000000000)) == -1 {
potentialMaxFee = new(big.Int).Mul(baseFee, big.NewInt(14))
}
potentialMaxFee.Div(potentialMaxFee, big.NewInt(10))
maxFeePerGas := potentialMaxFee
if maxPriorityFeePerGas.Cmp(potentialMaxFee) == 1 {
maxFeePerGas = potentialMaxFee.Add(potentialMaxFee, maxPriorityFeePerGas)
}
return pack.NewU256FromInt(maxPriorityFeePerGas), pack.NewU256FromInt(maxFeePerGas), nil
}
func (gasEstimator *GasEstimator) estimatePriorityFee(ctx context.Context, baseFee *big.Int, blockNumber *big.Int) (*big.Int, error) {
if baseFee.Cmp(gasEstimator.options.PriorityFeeEstimationTrigger) == -1 {
return gasEstimator.options.DefaultPriorityFee, nil
}
feeHistory, err := gasEstimator.client.EthClient.FeeHistory(ctx, gasEstimator.options.FeeHistoryBlocks, blockNumber, []float64{float64(gasEstimator.options.FeeHistoryPercentile)})
if err != nil {
return nil, fmt.Errorf("failed to get eth fee history: %v", err)
}
rewards := make([]*big.Int, 0, len(feeHistory.Reward))
for _, r := range feeHistory.Reward {
if len(r) > 0 && r[0].Cmp(big.NewInt(0)) != 0 {
rewards = append(rewards, r[0])
}
}
// sort in ascending order
sort.Slice(rewards, func(i, j int) bool { return rewards[j].Cmp(rewards[i]) >= 0 })
// if len <=1 percentage increase cannot be calculated
if len(rewards) <= 1 {
return nil, nil
}
percentageIncreases := []*big.Int{}
for i, r := range rewards {
if i == (len(rewards) - 1) {
continue
}
next := new(big.Int).Set(rewards[i+1])
temp := next.Sub(next, r)
temp = temp.Div(temp, r)
temp = temp.Mul(temp, big.NewInt(100))
percentageIncreases = append(percentageIncreases, temp)
}
highestIncrease := percentageIncreases[0]
highestIncreaseIndex := 0
for i := 1; i < len(percentageIncreases); i++ {
if highestIncrease.Cmp(percentageIncreases[i]) == -1 {
highestIncrease = percentageIncreases[i]
highestIncreaseIndex = i
}
}
if highestIncrease.Cmp(gasEstimator.options.PriorityFeeIncreaseBoundary) == 1 && highestIncreaseIndex >= (len(rewards)/2) {
rewards = rewards[highestIncreaseIndex:]
}
return rewards[len(rewards)/2], nil
}
================================================
FILE: chain/ethereum/tx.go
================================================
package ethereum
import (
"context"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/renproject/id"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/evm"
"github.com/renproject/pack"
)
// TxBuilder represents a transaction builder that builds transactions to be
// broadcasted to the ethereum network. The TxBuilder is configured using a
// chain id.
type TxBuilder struct {
ChainID *big.Int
}
// NewTxBuilder creates a new transaction builder.
func NewTxBuilder(chainID *big.Int) TxBuilder {
return TxBuilder{chainID}
}
// BuildTx receives transaction fields and constructs a new transaction.
func (txBuilder TxBuilder) BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gas, gasTipCap, gasFeeCap pack.U256, payload pack.Bytes) (account.Tx, error) {
toAddr, err := NewAddressFromHex(string(pack.String(to)))
if err != nil {
return nil, fmt.Errorf("bad to address '%v': %v", to, err)
}
addr := common.Address(toAddr)
return &evm.Tx{
EthTx: types.NewTx(&types.DynamicFeeTx{
ChainID: txBuilder.ChainID,
Nonce: nonce.Int().Uint64(),
GasTipCap: gasTipCap.Int(),
GasFeeCap: gasFeeCap.Int(),
Gas: gas.Int().Uint64(),
To: &addr,
Value: value.Int(),
Data: payload,
}),
Signer: types.LatestSignerForChainID(txBuilder.ChainID),
}, nil
}
================================================
FILE: chain/evm/address.go
================================================
package evm
import (
"encoding/hex"
"encoding/json"
"fmt"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
"github.com/renproject/surge"
)
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// AddressEncoder implements the address.Encoder interface.
type AddressEncoder interface {
EncodeAddress(address.RawAddress) (address.Address, error)
}
type addressEncoder struct{}
// NewAddressEncodeDecoder constructs a new AddressEncodeDecoder.
func NewAddressEncodeDecoder() address.EncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: NewAddressEncoder(),
AddressDecoder: NewAddressDecoder(),
}
}
// AddressDecoder implements the address.Decoder interface.
type AddressDecoder interface {
DecodeAddress(address.Address) (address.RawAddress, error)
}
type addressDecoder struct{}
// NewAddressDecoder constructs a new AddressDecoder.
func NewAddressDecoder() AddressDecoder {
return addressDecoder{}
}
// NewAddressEncoder constructs a new AddressEncoder.
func NewAddressEncoder() AddressEncoder {
return addressEncoder{}
}
func (addressDecoder) DecodeAddress(encoded address.Address) (address.RawAddress, error) {
ethaddr, err := NewAddressFromHex(string(pack.String(encoded)))
if err != nil {
return nil, err
}
return address.RawAddress(pack.Bytes(ethaddr[:])), nil
}
func (addressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error) {
addr := common.BytesToAddress([]byte(rawAddr))
return address.Address(addr.Hex()), nil
}
// An Address represents a public address on the Ethereum blockchain. It can be
// the address of an external account, or the address of a smart contract.
type Address common.Address
// NewAddressFromHex returns an Address decoded from a hex
// string.
func NewAddressFromHex(str string) (Address, error) {
if strings.HasPrefix(str, "0x") {
str = str[2:]
}
if len(str) != 40 {
return Address{}, fmt.Errorf("invalid ethaddress %v", str)
}
ethaddrData, err := hex.DecodeString(str)
if err != nil {
return Address{}, fmt.Errorf("invalid ethaddress %v: %v", str, err)
}
ethaddr := common.Address{}
copy(ethaddr[:], ethaddrData)
return Address(ethaddr), nil
}
// SizeHint returns the number of bytes needed to represent this address in
// binary.
func (Address) SizeHint() int {
return common.AddressLength
}
// Marshal the address to binary.
func (addr Address) Marshal(buf []byte, rem int) ([]byte, int, error) {
if len(buf) < common.AddressLength || rem < common.AddressLength {
return buf, rem, surge.ErrUnexpectedEndOfBuffer
}
copy(buf, addr[:])
return buf[common.AddressLength:], rem - common.AddressLength, nil
}
// Unmarshal the address from binary.
func (addr *Address) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
if len(buf) < common.AddressLength || rem < common.AddressLength {
return buf, rem, surge.ErrUnexpectedEndOfBuffer
}
copy(addr[:], buf[:common.AddressLength])
return buf[common.AddressLength:], rem - common.AddressLength, nil
}
// MarshalJSON implements JSON marshaling by encoding the address as a hex
// string.
func (addr Address) MarshalJSON() ([]byte, error) {
return json.Marshal(common.Address(addr).Hex())
}
// UnmarshalJSON implements JSON unmarshaling by expected the data be a hex
// encoded string representation of an address.
func (addr *Address) UnmarshalJSON(data []byte) error {
var str string
if err := json.Unmarshal(data, &str); err != nil {
return err
}
ethaddr, err := NewAddressFromHex(str)
if err != nil {
return err
}
*addr = ethaddr
return nil
}
// String returns the address as a human-readable hex string.
func (addr Address) String() string {
return hex.EncodeToString(addr[:])
}
// Bytes returns the address as a slice of 20 bytes.
func (addr Address) Bytes() pack.Bytes {
return pack.Bytes(addr[:])
}
================================================
FILE: chain/evm/address_test.go
================================================
package evm_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
"github.com/renproject/multichain/chain/ethereum"
"github.com/renproject/surge"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := ethereum.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := ethereum.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr ethereum.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr ethereum.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/evm/client.go
================================================
package evm
import (
"context"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// ethereum node.
DefaultClientRPCURL = "http://127.0.0.1:8545/"
)
// Client holds the underlying RPC client instance.
type Client struct {
EthClient *ethclient.Client
ChainID *big.Int
}
// NewClient creates and returns a new JSON-RPC client to the Ethereum node
func NewClient(rpcURL string, chainID *big.Int) (*Client, error) {
client, err := ethclient.Dial(rpcURL)
if err != nil {
return nil, fmt.Errorf("dialing url: %v", rpcURL)
}
clientChainID, err := client.ChainID(context.Background())
if err != nil {
return nil, fmt.Errorf("mismatched chain id: expected %v, got %v", chainID, clientChainID)
}
return &Client{
client,
chainID,
}, nil
}
// LatestBlock returns the block number at the current chain head.
func (client *Client) LatestBlock(ctx context.Context) (pack.U64, error) {
header, err := client.EthClient.HeaderByNumber(ctx, nil)
if err != nil {
return pack.NewU64(0), fmt.Errorf("fetching header: %v", err)
}
return pack.NewU64(header.Number.Uint64()), nil
}
// Tx returns the transaction uniquely identified by the given transaction
// hash. It also returns the number of confirmations for the transaction.
func (client *Client) Tx(ctx context.Context, txID pack.Bytes) (account.Tx, pack.U64, error) {
tx, pending, err := client.EthClient.TransactionByHash(ctx, common.BytesToHash(txID))
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf(fmt.Sprintf("fetching tx by hash '%v': %v", txID, err))
}
// Check the chain id for replay-protected tx.
if tx.Protected() {
chainID := tx.ChainId()
if client.ChainID != nil {
if chainID == nil {
return nil, 0, fmt.Errorf("nil chain ID")
}
if chainID.Cmp(client.ChainID) != 0 {
return nil, 0, fmt.Errorf("invalid chain ID, expected = %v, got = %v", client.ChainID.String(), chainID.String())
}
}
}
// If the transaction is still pending, use default EIP-155 Signer.
pendingTx := Tx{
EthTx: tx,
Signer: types.NewEIP155Signer(client.ChainID),
}
if pending {
// Transaction has not been included in a block yet.
return nil, 0, fmt.Errorf("tx %v is pending", txID)
}
receipt, err := client.EthClient.TransactionReceipt(ctx, common.BytesToHash(txID))
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf("fetching recipt for tx %v : %v", txID, err)
}
if receipt == nil {
// Transaction has 0 confirmations.
return &pendingTx, 0, nil
}
if receipt.Status == 0 {
// Transaction has been reverted.
return nil, pack.NewU64(0), fmt.Errorf("tx %v reverted, reciept status 0", txID)
}
// Transaction has been confirmed.
confirmedTx := Tx{
tx,
types.LatestSignerForChainID(client.ChainID),
}
header, err := client.EthClient.HeaderByNumber(ctx, nil)
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf("fetching header : %v", err)
}
return &confirmedTx, pack.NewU64(header.Number.Uint64() - receipt.BlockNumber.Uint64()), nil
}
// SubmitTx to the underlying blockchain network.
func (client *Client) SubmitTx(ctx context.Context, tx account.Tx) error {
switch tx := tx.(type) {
case *Tx:
err := client.EthClient.SendTransaction(ctx, tx.EthTx)
if err != nil {
return fmt.Errorf(fmt.Sprintf("sending transaction '%v': %v", tx.Hash(), err))
}
return nil
default:
return fmt.Errorf("expected type %T, got type %T", new(Tx), tx)
}
}
// AccountNonce returns the current nonce of the account. This is the nonce to
// be used while building a new transaction.
func (client *Client) AccountNonce(ctx context.Context, addr address.Address) (pack.U256, error) {
targetAddr, err := NewAddressFromHex(string(pack.String(addr)))
if err != nil {
return pack.U256{}, fmt.Errorf("bad to address '%v': %v", addr, err)
}
nonce, err := client.EthClient.NonceAt(ctx, common.Address(targetAddr), nil)
if err != nil {
return pack.U256{}, fmt.Errorf("failed to get nonce for '%v': %v", addr, err)
}
return pack.NewU256FromU64(pack.NewU64(nonce)), nil
}
// AccountBalance returns the account balancee for a given address.
func (client *Client) AccountBalance(ctx context.Context, addr address.Address) (pack.U256, error) {
targetAddr, err := NewAddressFromHex(string(pack.String(addr)))
if err != nil {
return pack.U256{}, fmt.Errorf("bad to address '%v': %v", addr, err)
}
balance, err := client.EthClient.BalanceAt(ctx, common.Address(targetAddr), nil)
if err != nil {
return pack.U256{}, fmt.Errorf("failed to get balance for '%v': %v", addr, err)
}
return pack.NewU256FromInt(balance), nil
}
// CallContract implements the multichain Contract API.
func (client *Client) CallContract(ctx context.Context, program address.Address, calldata contract.CallData) (pack.Bytes, error) {
targetAddr, err := NewAddressFromHex(string(pack.String(program)))
if err != nil {
return nil, fmt.Errorf("bad to address '%v': %v", program, err)
}
addr := common.Address(targetAddr)
callMsg := ethereum.CallMsg{
To: &addr,
Data: calldata,
}
return client.EthClient.CallContract(ctx, callMsg, nil)
}
================================================
FILE: chain/evm/encode.go
================================================
package evm
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/renproject/pack"
)
// A Payload is an Ethereum encoded function call. It includes an ABI, the
// function being called from the ABI, and the data being passed to the
// function.
type Payload struct {
ABI pack.Bytes `json:"abi"`
Fn pack.Bytes `json:"fn"`
Data pack.Bytes `json:"data"`
}
// Encode values into an Ethereum ABI compatible byte slice.
func Encode(vals ...interface{}) []byte {
ethargs := make(abi.Arguments, 0, len(vals))
ethvals := make([]interface{}, 0, len(vals))
for _, val := range vals {
var ethval interface{}
var ty abi.Type
var err error
switch val := val.(type) {
case pack.Bytes:
ethval = val
ty, err = abi.NewType("bytes", "", nil)
case pack.Bytes32:
ethval = val
ty, err = abi.NewType("bytes32", "", nil)
case pack.U8:
ethval = big.NewInt(0).SetUint64(uint64(val.Uint8()))
ty, err = abi.NewType("uint256", "", nil)
case pack.U16:
ethval = big.NewInt(0).SetUint64(uint64(val.Uint16()))
ty, err = abi.NewType("uint256", "", nil)
case pack.U32:
ethval = big.NewInt(0).SetUint64(uint64(val.Uint32()))
ty, err = abi.NewType("uint256", "", nil)
case pack.U64:
ethval = big.NewInt(0).SetUint64(uint64(val.Uint64()))
ty, err = abi.NewType("uint256", "", nil)
case pack.U128:
ethval = val.Int()
ty, err = abi.NewType("uint256", "", nil)
case pack.U256:
ethval = val.Int()
ty, err = abi.NewType("uint256", "", nil)
case Address:
ethval = val
ty, err = abi.NewType("address", "", nil)
case []pack.U256:
v := make([]*big.Int, len(val))
for i := range val {
elem, ok := big.NewInt(0).SetString(val[i].String(), 10)
if !ok {
panic(fmt.Errorf("encoding list item: %v", err))
}
v[i] = elem
}
ethval = v
ty, err = abi.NewType("uint256[]", "", nil)
case []Address:
ethval = val
ty, err = abi.NewType("address[]", "", nil)
default:
panic(fmt.Errorf("non-exhaustive pattern: %T", val))
}
if err != nil {
panic(fmt.Errorf("error encoding: %v", err))
}
ethargs = append(ethargs, abi.Argument{
Type: ty,
})
ethvals = append(ethvals, ethval)
}
packed, err := ethargs.Pack(ethvals...)
if err != nil {
panic(fmt.Errorf("error packing: %v", err))
}
return packed
}
================================================
FILE: chain/evm/encode_test.go
================================================
package evm_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/ethereum"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := ethereum.Address(x)
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes[12:], x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding slices", func() {
Context("when the elements are 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [][32]byte) bool {
arg := make([]pack.U256, len(x))
for i := range arg {
arg[i] = pack.NewU256(x[i])
}
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x%064x", 32, len(x))
for i := range x {
expectedString = expectedString + fmt.Sprintf("%064x", x[i])
}
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the elements are Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [][20]byte) bool {
arg := make([]ethereum.Address, len(x))
for i := range arg {
arg[i] = ethereum.Address(x[i])
}
resBytes := ethereum.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x%064x", 32, len(x))
for i := range x {
expectedBytes := make([]byte, 32)
copy(expectedBytes[12:], x[i][:])
expectedString = expectedString + hex.EncodeToString(expectedBytes)
}
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { ethereum.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr ethereum.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := ethereum.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/evm/gas.go
================================================
package evm
import (
"context"
"fmt"
"github.com/renproject/pack"
)
// A GasEstimator returns the gas price and the provide gas limit that is needed in
// order to confirm transactions with an estimated maximum delay of one block.
type GasEstimator struct {
client *Client
}
// NewGasEstimator returns a simple gas estimator that fetches the ideal gas
// price for a ethereum transaction to be included in a block
// with minimal delay.
func NewGasEstimator(client *Client) *GasEstimator {
return &GasEstimator{
client: client,
}
}
// EstimateGas returns an estimate of the current gas price
// and returns the gas limit provided. These numbers change with congestion. These estimates
// are often a little bit off, and this should be considered when using them.
func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
gasPrice, err := gasEstimator.client.EthClient.SuggestGasPrice(ctx)
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("failed to get eth suggested gas price: %v", err)
}
return pack.NewU256FromInt(gasPrice), pack.NewU256FromInt(gasPrice), nil
}
================================================
FILE: chain/evm/tx.go
================================================
package evm
import (
"context"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/renproject/id"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
)
// TxBuilder represents a transaction builder that builds transactions to be
// broadcasted to the ethereum network. The TxBuilder is configured using a
// chain id.
type TxBuilder struct {
ChainID *big.Int
}
// NewTxBuilder creates a new transaction builder.
func NewTxBuilder(chainID *big.Int) TxBuilder {
return TxBuilder{chainID}
}
// BuildTx receives transaction fields and constructs a new transaction.
func (txBuilder TxBuilder) BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gasLimit, gasPrice, gasCap pack.U256, payload pack.Bytes) (account.Tx, error) {
toAddr, err := NewAddressFromHex(string(pack.String(to)))
if err != nil {
return nil, fmt.Errorf("bad to address '%v': %v", to, err)
}
addr := common.Address(toAddr)
return &Tx{
EthTx: types.NewTransaction(nonce.Int().Uint64(),
addr, value.Int(),
gasLimit.Int().Uint64(),
gasPrice.Int(),
payload,
),
Signer: types.LatestSignerForChainID(txBuilder.ChainID),
}, nil
}
// Tx represents a ethereum transaction, encapsulating a payload/data and its
// Signer.
type Tx struct {
EthTx *types.Transaction
Signer types.Signer
}
// Hash returns the hash that uniquely identifies the transaction.
// Generally, hashes are irreversible hash functions that consume the
// content of the transaction.
func (tx Tx) Hash() pack.Bytes {
return tx.EthTx.Hash().Bytes()
}
// From returns the address that is sending the transaction. Generally,
// this is also the address that must sign the transaction.
func (tx Tx) From() address.Address {
addr, err := types.Sender(tx.Signer, tx.EthTx)
if err != nil {
return address.Address("")
}
return address.Address(addr.Hex())
}
// To returns the address that is receiving the transaction. This can be the
// address of an external account, controlled by a private key, or it can be
// the address of a contract.
func (tx Tx) To() address.Address {
return address.Address(tx.EthTx.To().Hex())
}
// Value being sent from the sender to the receiver.
func (tx Tx) Value() pack.U256 {
return pack.NewU256FromInt(tx.EthTx.Value())
}
// Nonce returns the nonce used to order the transaction with respect to all
// other transactions signed and submitted by the sender.
func (tx Tx) Nonce() pack.U256 {
return pack.NewU256FromU64(pack.NewU64(tx.EthTx.Nonce()))
}
// Payload returns arbitrary data that is associated with the transaction.
// Generally, this payload is used to send notes between external accounts,
// or invoke business logic on a contract.
func (tx Tx) Payload() contract.CallData {
return contract.CallData(tx.EthTx.Data())
}
// Sighashes returns the digests that must be signed before the transaction
// can be submitted by the client.
func (tx Tx) Sighashes() ([]pack.Bytes32, error) {
return []pack.Bytes32{pack.Bytes32(tx.Signer.Hash(tx.EthTx))}, nil
}
// Sign the transaction by injecting signatures for the required sighashes.
// The serialized public key used to sign the sighashes must also be
// specified.
func (tx *Tx) Sign(signatures []pack.Bytes65, pubkey pack.Bytes) error {
signedtx, err := tx.EthTx.WithSignature(tx.Signer, signatures[0].Bytes())
if err != nil {
return err
}
tx.EthTx = signedtx
return nil
}
// Serialize the transaction into bytes. Generally, this is the format in
// which the transaction will be submitted by the client.
func (tx Tx) Serialize() (pack.Bytes, error) {
return tx.EthTx.MarshalBinary()
}
================================================
FILE: chain/fantom/address.go
================================================
package fantom
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/fantom/address_test.go
================================================
package fantom_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/fantom"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := fantom.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr fantom.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := fantom.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr fantom.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr fantom.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr fantom.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr fantom.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/fantom/client.go
================================================
package fantom
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// fantom node.
DefaultClientRPCURL = "http://127.0.0.1:18545/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/fantom/encode.go
================================================
package fantom
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/fantom/encode_test.go
================================================
package fantom_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/fantom"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := fantom.Address(x)
resBytes := fantom.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { fantom.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr fantom.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := fantom.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/fantom/gas.go
================================================
package fantom
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/fantom/tx.go
================================================
package fantom
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/filecoin/account.go
================================================
package filecoin
import (
"bytes"
"context"
"crypto/ecdsa"
"fmt"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
filaddress "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/chain/types"
"github.com/minio/blake2b-simd"
"github.com/renproject/id"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
)
// TxBuilder represents a transaction builder that builds transactions to be
// broadcasted to the filecoin network. The TxBuilder is configured using a
// gas price and gas limit.
type TxBuilder struct {
}
// NewTxBuilder creates a new transaction builder.
func NewTxBuilder() TxBuilder {
return TxBuilder{}
}
// BuildTx receives transaction fields and constructs a new transaction.
func (txBuilder TxBuilder) BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gasLimit, gasPrice, gasCap pack.U256, payload pack.Bytes) (account.Tx, error) {
pubKeyUncompressed := ethcrypto.FromECDSAPub((*ecdsa.PublicKey)(fromPubKey))
filfrom, err := filaddress.NewSecp256k1Address(pubKeyUncompressed)
if err != nil {
return nil, fmt.Errorf("bad from pubkey: %v", err)
}
filto, err := filaddress.NewFromString(string(to))
if err != nil {
return nil, fmt.Errorf("bad to address '%v': %v", to, err)
}
methodNum := abi.MethodNum(0)
return &Tx{
msg: types.Message{
Version: types.MessageVersion,
From: filfrom,
To: filto,
Value: big.Int{Int: value.Int()},
Nonce: nonce.Int().Uint64(),
GasFeeCap: big.Int{Int: gasCap.Int()},
GasLimit: gasLimit.Int().Int64(),
GasPremium: big.Int{Int: gasPrice.Int()},
Method: methodNum,
Params: payload,
},
signature: pack.Bytes65{},
}, nil
}
// Tx represents a filecoin transaction, encapsulating a message and its
// signature.
type Tx struct {
msg types.Message
signature pack.Bytes65
}
// Hash returns the hash that uniquely identifies the transaction.
// Generally, hashes are irreversible hash functions that consume the
// content of the transaction.
func (tx Tx) Hash() pack.Bytes {
if !tx.signature.Equal(&pack.Bytes65{}) {
// construct crypto.Signature
signature := crypto.Signature{
Type: crypto.SigTypeSecp256k1,
Data: tx.signature.Bytes(),
}
// construct types.SignedMessage
signedMessage := types.SignedMessage{
Message: tx.msg,
Signature: signature,
}
return pack.NewBytes(signedMessage.Cid().Bytes())
}
return pack.NewBytes(tx.msg.Cid().Bytes())
}
// From returns the address that is sending the transaction. Generally,
// this is also the address that must sign the transaction.
func (tx Tx) From() address.Address {
return address.Address(tx.msg.From.String())
}
// To returns the address that is receiving the transaction. This can be the
// address of an external account, controlled by a private key, or it can be
// the address of a contract.
func (tx Tx) To() address.Address {
return address.Address(tx.msg.To.String())
}
// Value being sent from the sender to the receiver.
func (tx Tx) Value() pack.U256 {
return pack.NewU256FromInt(tx.msg.Value.Int)
}
// Nonce returns the nonce used to order the transaction with respect to all
// other transactions signed and submitted by the sender.
func (tx Tx) Nonce() pack.U256 {
return pack.NewU256FromU64(pack.NewU64(tx.msg.Nonce))
}
// Payload returns arbitrary data that is associated with the transaction.
// Generally, this payload is used to send notes between external accounts,
// or invoke business logic on a contract.
func (tx Tx) Payload() contract.CallData {
return contract.CallData(tx.msg.Params)
}
// Sighashes returns the digests that must be signed before the transaction
// can be submitted by the client.
func (tx Tx) Sighashes() ([]pack.Bytes32, error) {
return []pack.Bytes32{pack.Bytes32(blake2b.Sum256(tx.Hash()))}, nil
}
// Sign the transaction by injecting signatures for the required sighashes.
// The serialized public key used to sign the sighashes must also be
// specified.
func (tx *Tx) Sign(signatures []pack.Bytes65, pubkey pack.Bytes) error {
if len(signatures) != 1 {
return fmt.Errorf("expected 1 signature, got %v signatures", len(signatures))
}
tx.signature = signatures[0]
return nil
}
// Serialize the transaction into bytes. Generally, this is the format in
// which the transaction will be submitted by the client.
func (tx Tx) Serialize() (pack.Bytes, error) {
buf := new(bytes.Buffer)
if err := tx.msg.MarshalCBOR(buf); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
================================================
FILE: chain/filecoin/account_test.go
================================================
package filecoin_test
================================================
FILE: chain/filecoin/address.go
================================================
package filecoin
import (
"fmt"
filaddress "github.com/filecoin-project/go-address"
"github.com/renproject/multichain/api/address"
)
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// AddressEncoder implements the address.Encoder interface.
type AddressEncoder struct{}
// AddressDecoder implements the address.Decoder interface.
type AddressDecoder struct{}
// NewAddressEncodeDecoder constructs a new AddressEncodeDecoder.
func NewAddressEncodeDecoder() AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: AddressEncoder{},
AddressDecoder: AddressDecoder{},
}
}
// EncodeAddress implements the address.Encoder interface. It receives a raw
// address and encodes it to a human-readable stringified address.
func (encoder AddressEncoder) EncodeAddress(raw address.RawAddress) (address.Address, error) {
addr, err := filaddress.NewFromBytes([]byte(raw))
if err != nil {
return address.Address(""), err
}
if addr == filaddress.Undef {
return address.Address(""), fmt.Errorf("encoding address: undefined address=%v", raw)
}
return address.Address(addr.String()), nil
}
// DecodeAddress implements the address.Decoder interface. It receives a human
// readable address and decodes it to an address represented by raw bytes.
func (addrDecoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error) {
rawAddr, err := filaddress.NewFromString(string(addr))
if err != nil {
return nil, err
}
if rawAddr == filaddress.Undef {
return nil, fmt.Errorf("decoding address: undefined address=%v", addr)
}
return address.RawAddress(rawAddr.Bytes()), nil
}
================================================
FILE: chain/filecoin/address_test.go
================================================
package filecoin_test
import (
"math/rand"
"testing/quick"
"time"
filaddress "github.com/filecoin-project/go-address"
"github.com/multiformats/go-varint"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/filecoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Address", func() {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
encoderDecoder := filecoin.NewAddressEncodeDecoder()
Context("when encoding and decoding", func() {
Context("for ID protocol", func() {
It("should behave correctly without errors", func() {
f := func() bool {
x := varint.ToUvarint(uint64(r.Int63()))
x = append([]byte{byte(filaddress.ID)}, x...)
rawAddr := address.RawAddress(pack.NewBytes(x[:]))
addr, err := encoderDecoder.AddressEncoder.EncodeAddress(rawAddr)
Expect(err).ToNot(HaveOccurred())
decodedAddr, err := encoderDecoder.AddressDecoder.DecodeAddress(addr)
Expect(err).ToNot(HaveOccurred())
Expect(decodedAddr).To(Equal(rawAddr))
return true
}
Expect(quick.Check(f, nil)).To(Succeed())
})
})
Context("for Sepc protocol", func() {
It("should behave correctly without errors", func() {
f := func(x [filaddress.PayloadHashLength]byte) bool {
y := append([]byte{byte(filaddress.SECP256K1)}, x[:]...)
rawAddr := address.RawAddress(pack.NewBytes(y[:]))
addr, err := encoderDecoder.AddressEncoder.EncodeAddress(rawAddr)
Expect(err).ToNot(HaveOccurred())
decodedAddr, err := encoderDecoder.AddressDecoder.DecodeAddress(addr)
Expect(err).ToNot(HaveOccurred())
Expect(decodedAddr).To(Equal(rawAddr))
return true
}
Expect(quick.Check(f, nil)).To(Succeed())
})
})
Context("for Actor protocol", func() {
It("should behave correctly without errors", func() {
f := func(x [filaddress.PayloadHashLength]byte) bool {
y := append([]byte{byte(filaddress.Actor)}, x[:]...)
rawAddr := address.RawAddress(pack.NewBytes(y[:]))
addr, err := encoderDecoder.AddressEncoder.EncodeAddress(rawAddr)
Expect(err).ToNot(HaveOccurred())
decodedAddr, err := encoderDecoder.AddressDecoder.DecodeAddress(addr)
Expect(err).ToNot(HaveOccurred())
Expect(decodedAddr).To(Equal(rawAddr))
return true
}
Expect(quick.Check(f, nil)).To(Succeed())
})
})
Context("for BLS protocol", func() {
It("should behave correctly without errors", func() {
f := func(x [filaddress.BlsPublicKeyBytes]byte) bool {
y := append([]byte{byte(filaddress.BLS)}, x[:]...)
rawAddr := address.RawAddress(pack.NewBytes(y[:]))
addr, err := encoderDecoder.AddressEncoder.EncodeAddress(rawAddr)
Expect(err).ToNot(HaveOccurred())
decodedAddr, err := encoderDecoder.AddressDecoder.DecodeAddress(addr)
Expect(err).ToNot(HaveOccurred())
Expect(decodedAddr).To(Equal(rawAddr))
return true
}
Expect(quick.Check(f, nil)).To(Succeed())
})
})
})
Context("when encoding empty address", func() {
It("should fail", func() {
_, err := encoderDecoder.EncodeAddress(address.RawAddress(pack.Bytes([]byte{})))
Expect(err).To(HaveOccurred())
})
})
Context("when decoding empty address", func() {
It("should fail", func() {
_, err := encoderDecoder.DecodeAddress(address.Address(""))
Expect(err).To(HaveOccurred())
})
})
})
================================================
FILE: chain/filecoin/client.go
================================================
package filecoin
import (
"context"
"fmt"
"net/http"
filaddress "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/crypto"
filclient "github.com/filecoin-project/lotus/api/client"
"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-cid"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
)
const (
// AuthorizationKey is the header key used for authorization
AuthorizationKey = "Authorization"
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// filecoin lotus node.
DefaultClientRPCURL = "http://127.0.0.1:1234/rpc/v0"
// DefaultClientAuthToken is the auth token used to instantiate the lotus
// client. A valid lotus auth token is required to write messages to the
// filecoin storage. To do read-only queries, auth token is not required.
DefaultClientAuthToken = ""
)
// ClientOptions are used to parameterise the behaviour of the Client.
type ClientOptions struct {
RPCURL string
AuthToken string
}
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the rpc-url and authentication token should be
// changed.
func DefaultClientOptions() ClientOptions {
return ClientOptions{
RPCURL: DefaultClientRPCURL,
AuthToken: DefaultClientAuthToken,
}
}
// WithRPCURL returns a modified version of the options with the given API
// rpc-url
func (opts ClientOptions) WithRPCURL(rpcURL pack.String) ClientOptions {
opts.RPCURL = string(rpcURL)
return opts
}
// WithAuthToken returns a modified version of the options with the given
// authentication token.
func (opts ClientOptions) WithAuthToken(authToken pack.String) ClientOptions {
opts.AuthToken = string(authToken)
return opts
}
// Client holds options to connect to a filecoin lotus node, and the underlying
// RPC client instance.
type Client struct {
opts ClientOptions
node v0api.FullNode
closer jsonrpc.ClientCloser
}
// NewClient creates and returns a new JSON-RPC client to the Filecoin node
func NewClient(opts ClientOptions) (*Client, error) {
requestHeaders := make(http.Header)
if opts.AuthToken != DefaultClientAuthToken {
requestHeaders.Add(AuthorizationKey, opts.AuthToken)
}
node, closer, err := filclient.NewFullNodeRPCV0(context.Background(), opts.RPCURL, requestHeaders)
if err != nil {
return nil, err
}
return &Client{opts, node, closer}, nil
}
// LatestBlock returns the block number at the current chain head.
func (client *Client) LatestBlock(ctx context.Context) (pack.U64, error) {
headTipset, err := client.node.ChainHead(ctx)
if err != nil {
return pack.NewU64(0), fmt.Errorf("get chain head: %v", err)
}
if headTipset.Height() < 0 {
return pack.NewU64(0), fmt.Errorf("unexpected chain head, expected > 0, got: %v", headTipset.Height())
}
return pack.NewU64(uint64(headTipset.Height())), nil
}
// Tx returns the transaction uniquely identified by the given transaction
// hash. It also returns the number of confirmations for the transaction.
func (client *Client) Tx(ctx context.Context, txID pack.Bytes) (account.Tx, pack.U64, error) {
// parse the transaction ID to a message ID
msgID, err := cid.Parse([]byte(txID))
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf("parsing txid: %v", err)
}
// lookup message receipt to get its height
messageLookup, err := client.node.StateSearchMsg(ctx, msgID)
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf("searching state for txid: %v", err)
}
if messageLookup == nil {
return nil, pack.NewU64(0), fmt.Errorf("searching state for txid %v: not found", msgID)
}
if messageLookup.Receipt.ExitCode.IsError() {
return nil, pack.NewU64(0), fmt.Errorf("executing transaction: %v", messageLookup.Receipt.ExitCode.String())
}
if !messageLookup.Message.Equals(msgID) {
return nil, pack.U64(0), fmt.Errorf("searching state for txid: expected %v, got %v", msgID, messageLookup.Message)
}
// get the most recent tipset and its height
chainHead, err := client.LatestBlock(ctx)
if err != nil {
return nil, pack.NewU64(0), err
}
confs := uint64(chainHead) - uint64(messageLookup.Height) + 1
if confs < 0 {
return nil, pack.NewU64(0), fmt.Errorf("get chain head: negative confirmations")
}
// get the message
msg, err := client.node.ChainGetMessage(ctx, msgID)
if err != nil {
return nil, pack.NewU64(0), fmt.Errorf("getting txid %v from chain: %v", msgID, err)
}
// support `Send` method for now
if msg.Method != builtin.MethodSend {
return nil, pack.NewU64(0), fmt.Errorf("unsupport tx method, expect `%v`, got `%v`", builtin.MethodSend, msg.Method)
}
return &Tx{msg: *msg}, pack.NewU64(confs), nil
}
// SubmitTx to the underlying blockchain network.
func (client *Client) SubmitTx(ctx context.Context, tx account.Tx) error {
switch tx := tx.(type) {
case *Tx:
// construct crypto.Signature
signature := crypto.Signature{
Type: crypto.SigTypeSecp256k1,
Data: tx.signature.Bytes(),
}
// construct types.SignedMessage
signedMessage := types.SignedMessage{
Message: tx.msg,
Signature: signature,
}
// submit transaction to mempool
msgID, err := client.node.MpoolPush(ctx, &signedMessage)
if err != nil {
return fmt.Errorf("pushing txid %v to mpool: %v", msgID, err)
}
return nil
default:
return fmt.Errorf("expected type %T, got type %T", new(Tx), tx)
}
}
// AccountNonce returns the current nonce of the account. This is the nonce to
// be used while building a new transaction.
func (client *Client) AccountNonce(ctx context.Context, addr address.Address) (pack.U256, error) {
filAddr, err := filaddress.NewFromString(string(addr))
if err != nil {
return pack.U256{}, fmt.Errorf("bad address '%v': %v", addr, err)
}
actor, err := client.node.StateGetActor(ctx, filAddr, types.NewTipSetKey(cid.Undef))
if err != nil {
return pack.U256{}, fmt.Errorf("searching state for addr %v: %v", addr, err)
}
return pack.NewU256FromU64(pack.NewU64(actor.Nonce)), nil
}
// AccountBalance returns the account balancee for a given address.
func (client *Client) AccountBalance(ctx context.Context, addr address.Address) (pack.U256, error) {
filAddr, err := filaddress.NewFromString(string(addr))
if err != nil {
return pack.U256{}, fmt.Errorf("bad address '%v': %v", addr, err)
}
actor, err := client.node.StateGetActor(ctx, filAddr, types.NewTipSetKey(cid.Undef))
if err != nil {
return pack.U256{}, fmt.Errorf("searching state for addr %v: %v", addr, err)
}
balance := actor.Balance.Int
// If the balance exceeds `MaxU256`, return an error.
if pack.MaxU256.Int().Cmp(balance) == -1 {
return pack.U256{}, fmt.Errorf("balance %v for %v exceeds MaxU256", balance.String(), addr)
}
return pack.NewU256FromInt(balance), nil
}
================================================
FILE: chain/filecoin/client_test.go
================================================
package filecoin_test
================================================
FILE: chain/filecoin/filecoin.go
================================================
package filecoin
================================================
FILE: chain/filecoin/filecoin_suite_test.go
================================================
package filecoin_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestFilecoin(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Filecoin Suite")
}
================================================
FILE: chain/filecoin/filecoin_test.go
================================================
package filecoin_test
import (
"context"
"encoding/hex"
"encoding/json"
"fmt"
"os"
"time"
filaddress "github.com/filecoin-project/go-address"
filtypes "github.com/filecoin-project/lotus/chain/types"
"github.com/ipfs/go-cid"
"github.com/renproject/id"
"github.com/renproject/multichain"
"github.com/renproject/multichain/chain/filecoin"
"github.com/renproject/pack"
"github.com/renproject/surge"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Filecoin", func() {
Context("when broadcasting a tx", func() {
It("should work", func() {
// create context for the test
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// instantiate the client
client, err := filecoin.NewClient(
filecoin.DefaultClientOptions().
WithAuthToken(fetchAuthToken()),
)
Expect(err).ToNot(HaveOccurred())
// read the private key that we will send transactions from
senderPrivKeyStr := os.Getenv("FILECOIN_PK")
if senderPrivKeyStr == "" {
panic("FILECOIN_PK is undefined")
}
var ki filtypes.KeyInfo
data, err := hex.DecodeString(senderPrivKeyStr)
Expect(err).NotTo(HaveOccurred())
err = json.Unmarshal(data, &ki)
Expect(err).NotTo(HaveOccurred())
senderPrivKey := id.PrivKey{}
err = surge.FromBinary(&senderPrivKey, ki.PrivateKey)
Expect(err).NotTo(HaveOccurred())
// read sender's address into the filecoin-compatible format
senderAddr := os.Getenv("FILECOIN_ADDRESS")
if senderAddr == "" {
panic("FILECOIN_ADDRESS is undefined")
}
senderFilAddr, err := filaddress.NewFromString(string(senderAddr))
Expect(err).NotTo(HaveOccurred())
// random recipient
recipientPK := id.NewPrivKey()
recipientPubKey := recipientPK.PubKey()
recipientPubKeyCompressed, err := surge.ToBinary(recipientPubKey)
Expect(err).NotTo(HaveOccurred())
recipientFilAddr, err := filaddress.NewSecp256k1Address(recipientPubKeyCompressed)
Expect(err).NotTo(HaveOccurred())
// get good gas estimates
gasLimit := uint64(2200000)
gasEstimator := filecoin.NewGasEstimator(client, int64(gasLimit))
gasPremium, gasFeeCap, err := gasEstimator.EstimateGas(ctx)
Expect(err).ToNot(HaveOccurred())
// construct the transaction builder
filTxBuilder := filecoin.NewTxBuilder()
// build the transaction
sender := multichain.Address(pack.String(senderFilAddr.String()))
amount := pack.NewU256FromU64(pack.NewU64(100000000))
nonce, err := client.AccountNonce(ctx, sender)
Expect(err).ToNot(HaveOccurred())
tx, err := filTxBuilder.BuildTx(
ctx,
senderPrivKey.PubKey(),
multichain.Address(pack.String(recipientFilAddr.String())),
amount, // amount
nonce, // nonce
pack.NewU256FromU64(pack.NewU64(gasLimit)), // gasLimit
gasPremium,
gasFeeCap,
pack.Bytes(nil), // payload
)
Expect(err).ToNot(HaveOccurred())
// Sign the filecoin-side lock transaction
txSighashes, err := tx.Sighashes()
Expect(err).ToNot(HaveOccurred())
Expect(len(txSighashes)).To(Equal(1))
Expect(len(txSighashes[0])).To(Equal(32))
sighash32 := txSighashes[0]
hash := id.Hash(sighash32)
sig, err := senderPrivKey.Sign(&hash)
Expect(err).NotTo(HaveOccurred())
sigBytes, err := surge.ToBinary(sig)
Expect(err).NotTo(HaveOccurred())
txSignature := pack.Bytes65{}
copy(txSignature[:], sigBytes)
Expect(tx.Sign([]pack.Bytes65{txSignature}, []byte{})).To(Succeed())
// submit the transaction
txHash := tx.Hash()
txID, err := cid.Parse([]byte(txHash))
Expect(err).NotTo(HaveOccurred())
fmt.Printf("msgID = %v\n", txID)
err = client.SubmitTx(ctx, tx)
Expect(err).ToNot(HaveOccurred())
// Wait slightly before we query the chain's node.
time.Sleep(time.Second)
// wait for the transaction to be included in a block
for {
// Loop until the transaction has at least a few confirmations.
tx, confs, err := client.Tx(ctx, txHash)
if err == nil {
Expect(confs.Uint64()).To(BeNumerically(">", 0))
Expect(tx.From()).To(Equal(sender))
Expect(tx.Value()).To(Equal(amount))
break
}
// wait and retry querying for the transaction
time.Sleep(5 * time.Second)
}
})
})
})
================================================
FILE: chain/filecoin/gas.go
================================================
package filecoin
import (
"context"
"fmt"
"math/big"
filaddress "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types"
"github.com/renproject/pack"
)
// A GasEstimator returns the gas fee cap and gas premium that is needed in
// order to confirm transactions with an estimated maximum delay of one block.
// In distributed networks that collectively build, sign, and submit
// transactions, it is important that all nodes in the network have reached
// consensus on these values.
type GasEstimator struct {
client *Client
gasLimit int64
}
// NewGasEstimator returns a simple gas estimator that fetches the ideal gas
// fee cap and gas premium for a filecoin transaction to be included in a block
// with minimal delay.
func NewGasEstimator(client *Client, gasLimit int64) *GasEstimator {
return &GasEstimator{
client: client,
gasLimit: gasLimit,
}
}
// EstimateGas returns an estimate of the current gas price (also known as gas
// premium) and gas cap. These numbers change with congestion. These estimates
// are often a little bit off, and this should be considered when using them.
func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
// Create a dummy "Send" message.
msgIn := types.Message{
Version: types.MessageVersion,
From: filaddress.TestAddress,
To: filaddress.TestAddress2,
Value: types.EmptyInt,
Nonce: 0,
GasLimit: gasEstimator.gasLimit,
GasFeeCap: types.EmptyInt,
GasPremium: types.EmptyInt,
Method: abi.MethodNum(0),
Params: []byte{},
}
// Estimate the gas fee cap and gas premium fields for this dummy message.
msgOut, err := gasEstimator.client.node.GasEstimateMessageGas(ctx, &msgIn, nil, types.EmptyTSK)
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("estimating gas price: %v", err)
}
gasFeeCapBytes, err := msgOut.GasFeeCap.Bytes()
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("getting abi/big bytes for %v: %v", msgOut.GasFeeCap, err)
}
gasPremiumBytes, err := msgOut.GasPremium.Bytes()
if err != nil {
return pack.NewU256([32]byte{}), pack.NewU256([32]byte{}), fmt.Errorf("getting abi/big bytes for %v: %v", msgOut.GasPremium, err)
}
gasFeeCap := big.NewInt(0).SetBytes(gasFeeCapBytes)
gasPremium := big.NewInt(0).SetBytes(gasPremiumBytes)
return pack.NewU256FromInt(gasPremium), pack.NewU256FromInt(gasFeeCap), nil
}
================================================
FILE: chain/filecoin/gas_test.go
================================================
package filecoin_test
import (
"bytes"
"context"
"fmt"
"os/exec"
"strings"
"github.com/renproject/multichain/chain/filecoin"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating gas parameters", func() {
It("should work", func() {
// create context for the test
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// instantiate the client
client, err := filecoin.NewClient(
filecoin.DefaultClientOptions().
WithAuthToken(fetchAuthToken()),
)
Expect(err).ToNot(HaveOccurred())
// instantiate the gas estimator
gasEstimator := filecoin.NewGasEstimator(client, 2000000)
// estimate gas price
_, _, err = gasEstimator.EstimateGas(ctx)
Expect(err).ToNot(HaveOccurred())
})
})
})
func fetchAuthToken() pack.String {
// fetch the auth token from filecoin's running docker container
cmd := exec.Command("docker", "exec", "infra_filecoin_1", "/bin/bash", "-c", "/app/lotus auth api-info --perm admin")
var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + stderr.String())
panic(fmt.Sprintf("could not run command: %v", err))
}
tokenWithSuffix := strings.TrimPrefix(out.String(), "FULLNODE_API_INFO=")
authToken := strings.Split(tokenWithSuffix, ":/")
return pack.NewString(fmt.Sprintf("Bearer %s", authToken[0]))
}
================================================
FILE: chain/kava/address.go
================================================
package kava
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/kava/address_test.go
================================================
package kava_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
"github.com/renproject/multichain/chain/kava"
"github.com/renproject/surge"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := kava.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := kava.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr kava.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/kava/client.go
================================================
package kava
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// bsc node.
DefaultClientRPCURL = "http://127.0.0.1:8575/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/kava/encode.go
================================================
package kava
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/kava/encode_test.go
================================================
package kava_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/kava"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := kava.Address(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { kava.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr kava.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := kava.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/kava/gas.go
================================================
package kava
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/kava/tx.go
================================================
package kava
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/moonbeam/address.go
================================================
package moonbeam
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/moonbeam/address_test.go
================================================
package moonbeam_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
"github.com/renproject/multichain/chain/moonbeam"
"github.com/renproject/surge"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := moonbeam.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr moonbeam.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := moonbeam.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr moonbeam.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr moonbeam.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr moonbeam.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr moonbeam.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/moonbeam/client.go
================================================
package moonbeam
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// bsc node.
DefaultClientRPCURL = "http://127.0.0.1:8575/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/moonbeam/encode.go
================================================
package moonbeam
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/moonbeam/encode_test.go
================================================
package moonbeam_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/moonbeam"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := moonbeam.Address(x)
resBytes := moonbeam.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { moonbeam.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr moonbeam.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := moonbeam.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/moonbeam/gas.go
================================================
package moonbeam
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/moonbeam/tx.go
================================================
package moonbeam
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/optimism/address.go
================================================
package optimism
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/optimism/address_test.go
================================================
package optimism_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
"github.com/renproject/multichain/chain/kava"
"github.com/renproject/surge"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := kava.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := kava.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr kava.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr kava.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/optimism/client.go
================================================
package optimism
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// bsc node.
DefaultClientRPCURL = "http://127.0.0.1:8575/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/optimism/encode.go
================================================
package optimism
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/optimism/encode_test.go
================================================
package optimism_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/kava"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := kava.Address(x)
resBytes := kava.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { kava.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr kava.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := kava.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/optimism/gas.go
================================================
package optimism
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/optimism/tx.go
================================================
package optimism
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/polygon/address.go
================================================
package polygon
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.
AddressEncodeDecoder = evm.AddressEncodeDecoder
// AddressEncoder re-exports evm.AddressEncoder.
AddressEncoder = evm.AddressEncoder
// AddressDecoder re-exports evm.AddressDecoder.
AddressDecoder = evm.AddressDecoder
// Address re-exports evm.Address.
Address = evm.Address
)
var (
// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder
// NewAddressDecoder re-exports evm.NewAddressDecoder.
NewAddressDecoder = evm.NewAddressDecoder
// NewAddressEncoder re-exports evm.NewAddressEncoder.
NewAddressEncoder = evm.NewAddressEncoder
// NewAddressFromHex re-exports evm.NewAddressFromHex.
NewAddressFromHex = evm.NewAddressFromHex
)
================================================
FILE: chain/polygon/address_test.go
================================================
package polygon_test
import (
"encoding/hex"
"encoding/json"
"testing/quick"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/renproject/multichain/chain/polygon"
"github.com/renproject/surge"
)
var _ = Describe("Address", func() {
Context("when unmarshaling and unmarshaling", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := polygon.Address(x)
Expect(addr.SizeHint()).To(Equal(20))
bytes, err := surge.ToBinary(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr polygon.Address
err = surge.FromBinary(&newAddr, bytes)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when unmarshaling and unmarshaling to/from JSON", func() {
It("should equal itself", func() {
f := func(x [20]byte) bool {
addr := polygon.Address(x)
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr polygon.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal(newAddr))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
Context("when the address is invalid hex", func() {
It("should return an error", func() {
f := func(x [40]byte) bool {
bytes, err := json.Marshal(string(x[:]))
Expect(err).ToNot(HaveOccurred())
var newAddr polygon.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when the address is invalid length", func() {
It("should return an error", func() {
f := func(x [10]byte) bool {
addr := hex.EncodeToString(x[:])
bytes, err := json.Marshal(addr)
Expect(err).ToNot(HaveOccurred())
var newAddr polygon.Address
err = json.Unmarshal(bytes, &newAddr)
Expect(err).To(HaveOccurred())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
Context("when unmarshalling random data", func() {
It("should not panic", func() {
f := func(x []byte) bool {
var addr polygon.Address
Expect(func() { addr.Unmarshal(x, surge.MaxBytes) }).ToNot(Panic())
Expect(func() { json.Unmarshal(x, &addr) }).ToNot(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
})
================================================
FILE: chain/polygon/client.go
================================================
package polygon
import (
"github.com/renproject/multichain/chain/evm"
)
const (
// DefaultClientRPCURL is the RPC URL used by default, to interact with the
// polygon node.
DefaultClientRPCURL = "http://127.0.0.1:28545/"
)
// Client re-exports evm.Client.
type Client = evm.Client
// NewClient re-exports evm.NewClient.
var NewClient = evm.NewClient
================================================
FILE: chain/polygon/encode.go
================================================
package polygon
import (
"github.com/renproject/multichain/chain/evm"
)
// Payload re-exports evm.Payload.
type Payload = evm.Payload
// Encode re-exports evm.Encode.
var Encode = evm.Encode
================================================
FILE: chain/polygon/encode_test.go
================================================
package polygon_test
import (
"encoding/hex"
"fmt"
"math"
"testing/quick"
"github.com/renproject/multichain/chain/polygon"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
)
var _ = Describe("Encoding", func() {
Context("when encoding bytes", func() {
It("should return the correct result", func() {
f := func(x []byte) bool {
arg := pack.NewBytes(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, int(math.Ceil(float64(len(x))/32)*32))
copy(expectedBytes, x)
// Note: since the first parameter has a dynamic length, the
// first 32 bytes instead contain a pointer to the data.
expectedString := fmt.Sprintf("%064x", 32) + fmt.Sprintf("%064x", len(x)) + hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32 bytes", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewBytes32(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := hex.EncodeToString(x[:])
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 8-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint8) bool {
arg := pack.NewU8(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 16-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint16) bool {
arg := pack.NewU16(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 32-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint32) bool {
arg := pack.NewU32(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 64-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x uint64) bool {
arg := pack.NewU64(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 128-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [16]byte) bool {
arg := pack.NewU128(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding 256-bit unsigned integers", func() {
It("should return the correct result", func() {
f := func(x [32]byte) bool {
arg := pack.NewU256(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedString := fmt.Sprintf("%064x", x)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding Ethereum addresses", func() {
It("should return the correct result", func() {
f := func(x [20]byte) bool {
arg := polygon.Address(x)
resBytes := polygon.Encode(arg)
resString := hex.EncodeToString(resBytes)
expectedBytes := make([]byte, 32)
copy(expectedBytes, x[:])
expectedString := hex.EncodeToString(expectedBytes)
Expect(resString).To(Equal(expectedString))
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
Context("when encoding an unsupported type", func() {
It("should panic", func() {
f := func(x bool) bool {
arg := pack.NewBool(x)
Expect(func() { polygon.Encode(arg) }).To(Panic())
return true
}
err := quick.Check(f, nil)
Expect(err).ToNot(HaveOccurred())
})
})
type testCase struct {
addr string
amount uint64
hash string
result string
}
testCases := []testCase{
{
addr: "797522Fb74d42bB9fbF6b76dEa24D01A538d5D66",
amount: 10000,
hash: "702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
result: "797522fb74d42bb9fbf6b76dea24d01a538d5d660000000000000000000000000000000000000000000000000000000000000000000000000000000000002710702826c3977ee72158db2ce1fb758075ee2799db65fb27b5d0952f860a8084ed",
},
{
addr: "58afb504ef2444a267b8c7ce57279417f1377ceb",
amount: 50000000000000000,
hash: "dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
result: "58afb504ef2444a267b8c7ce57279417f1377ceb00000000000000000000000000000000000000000000000000000000000000000000000000b1a2bc2ec50000dabff9ceb1b3dabb696d143326fdb98a8c7deb260e65d08a294b16659d573f93",
},
{
addr: "0000000000000000000000000000000000000000",
amount: 0,
hash: "0000000000000000000000000000000000000000000000000000000000000000",
result: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
},
}
DescribeTable("when encoding args",
func(test testCase) {
addrBytes, err := hex.DecodeString(test.addr)
Expect(err).ToNot(HaveOccurred())
var addr polygon.Address
copy(addr[:], addrBytes)
hashBytes32 := [32]byte{}
hashBytes, err := hex.DecodeString(test.hash)
Expect(err).ToNot(HaveOccurred())
copy(hashBytes32[:], hashBytes)
args := []interface{}{
addr,
pack.NewU64(test.amount),
pack.NewBytes32(hashBytes32),
}
result := polygon.Encode(args...)
Expect(hex.EncodeToString(result)).To(Equal(test.result))
},
Entry("should return the same result as solidity for small transactions", testCases[0]),
Entry("should return the same result as solidity for large transactions", testCases[1]),
Entry("should return the same result as solidity for empty transactions", testCases[2]),
)
})
================================================
FILE: chain/polygon/gas.go
================================================
package polygon
import (
"github.com/renproject/multichain/chain/evm"
)
// GasEstimator re-exports evm.GasEstimator.
type GasEstimator = evm.GasEstimator
// NewGasEstimator re-exports evm.NewGasEstimator.
var NewGasEstimator = evm.NewGasEstimator
================================================
FILE: chain/polygon/tx.go
================================================
package polygon
import (
"github.com/renproject/multichain/chain/evm"
)
type (
// TxBuilder re-exports evm.TxBuilder.
TxBuilder = evm.TxBuilder
// Tx re-exports evm.Tx.
Tx = evm.Tx
)
// NewTxBuilder re-exports evm.NewTxBuilder.
var NewTxBuilder = evm.NewTxBuilder
================================================
FILE: chain/solana/address.go
================================================
package solana
import (
"fmt"
"github.com/btcsuite/btcutil/base58"
"github.com/renproject/multichain/api/address"
)
// AddressDecoder implements the address.Decoder interface.
type AddressDecoder struct{}
// AddressEncoder implements the address.Encoder interface.
type AddressEncoder struct{}
// AddressEncodeDecoder implements the address.EncodeDecoder interface.
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// NewAddressEncodeDecoder constructs and returns a new AddressEncodeDecoder.
func NewAddressEncodeDecoder() AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: AddressEncoder{},
AddressDecoder: AddressDecoder{},
}
}
// EncodeAddress consumes a raw byte-representation of an address and encodes it
// to the human-readable Base58 format.
func (AddressEncoder) EncodeAddress(rawAddress address.RawAddress) (address.Address, error) {
if len(rawAddress) != 32 {
return address.Address(""), fmt.Errorf("expected address length 32, got address length %v", len(rawAddress))
}
return address.Address(base58.Encode(rawAddress)), nil
}
// DecodeAddress consumes a human-readable Base58 format and decodes it into a
// raw byte-representation.
func (AddressDecoder) DecodeAddress(encoded address.Address) (address.RawAddress, error) {
decoded := base58.Decode(string(encoded))
if len(decoded) != 32 {
return nil, fmt.Errorf("expected address length 32, got address length %v", len(decoded))
}
return address.RawAddress(decoded), nil
}
================================================
FILE: chain/solana/rpc.go
================================================
package solana
import (
"bytes"
"encoding/json"
"fmt"
"net"
"net/http"
"strings"
"time"
)
// Request defines a JSON-RPC 2.0 request object. See
// https://www.jsonrpc.org/specification for more information. A Request should
// not be explicitly created, but instead unmarshaled from JSON.
type Request struct {
Version string `json:"jsonrpc"`
ID interface{} `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
// Response defines a JSON-RPC 2.0 response object. See
// https://www.jsonrpc.org/specification for more information. A Response is
// usually marshaled into bytes and returned in response to a Request.
type Response struct {
Version string `json:"jsonrpc"`
ID interface{} `json:"id"`
Result *json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
// Error defines a JSON-RPC 2.0 error object. See
// https://www.jsonrpc.org/specification for more information.
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data *json.RawMessage `json:"data"`
}
// SendData sends data to method via jsonrpc
func SendData(method string, data []byte, url string) (Response, error) {
request := Request{
Version: "2.0",
ID: 1,
Method: method,
Params: data,
}
// Send request to lightnode
response, err := SendRequest(request, url)
if err != nil {
return Response{}, err
}
var resp Response
buf := new(bytes.Buffer)
buf.ReadFrom(response.Body)
if err := json.Unmarshal(buf.Bytes(), &resp); err != nil {
return Response{}, fmt.Errorf("cannot decode %v response body = %s, err = %v", method, buf.String(), err)
}
if resp.Error != nil {
return Response{}, fmt.Errorf("got err back from %v request, err = %v", method, resp.Error)
}
return resp, nil
}
// SendDataWithRetry is the same as SendData but will retry if sending the request failed
func SendDataWithRetry(method string, data []byte, url string) (Response, error) {
request := Request{
Version: "2.0",
ID: 1,
Method: method,
Params: data,
}
// Send request to lightnode with retry (max 10 times)
response, err := SendRequestWithRetry(request, url, 10, 10)
if err != nil {
return Response{}, fmt.Errorf("failed to send request, err = %v", err)
}
var resp Response
buf := new(bytes.Buffer)
buf.ReadFrom(response.Body)
if err := json.Unmarshal(buf.Bytes(), &resp); err != nil {
return Response{}, fmt.Errorf("cannot decode %v response body = %s, err = %v", method, buf.String(), err)
}
if resp.Error != nil {
return Response{}, fmt.Errorf("got err back from %v request, err = %v", method, resp.Error)
}
return resp, nil
}
// SendRequest sends the JSON-2.0 request to the target url and returns the response and any error.
func SendRequest(request Request, url string) (*http.Response, error) {
data, err := json.Marshal(request)
if err != nil {
return nil, err
}
resp, err := SendRawPost(data, url)
if err != nil {
fmt.Printf("Sending %s to %s resulted in an error: %v\n", string(data), url, err)
return nil, err
}
return resp, nil
}
// SendRawPost sends a raw bytes as a POST request to the URL specified
func SendRawPost(data []byte, url string) (*http.Response, error) {
if !strings.HasPrefix(url, "http") {
url = "http://" + url
}
client := newClient(10 * time.Second)
buff := bytes.NewBuffer(data)
req, err := http.NewRequest("POST", url, buff)
req.Header.Set("Content-Type", "application/json")
if err != nil {
return nil, err
}
return client.Do(req)
}
// SendRequestWithRetry calls SendRequest but with configurable retry logic
func SendRequestWithRetry(request Request, url string, timeoutInSecs int, retries int) (response *http.Response, err error) {
failures := 0
for failures < retries {
response, err = SendRequest(request, url)
if err != nil {
failures++
if failures >= retries {
return nil, err
}
fmt.Printf("%s errored: %v. Retrying after %d seconds\n", url, err, timeoutInSecs)
time.Sleep(time.Duration(timeoutInSecs) * time.Second)
continue
}
break
}
return
}
func newClient(timeout time.Duration) *http.Client {
return &http.Client{
Transport: &http.Transport{
DialContext: (&net.Dialer{
Timeout: 2 * time.Second,
KeepAlive: 10 * time.Second,
}).DialContext,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 4 * time.Second,
ResponseHeaderTimeout: 3 * time.Second,
},
Timeout: timeout,
}
}
================================================
FILE: chain/solana/solana.go
================================================
package solana
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
"github.com/btcsuite/btcutil/base58"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/pack"
"go.uber.org/zap"
)
// DefaultClientRPCURL is the default RPC URL for the Solana cluster.
const DefaultClientRPCURL = "http://localhost:8899"
// ClientOptions define the options to instantiate a new Solana client.
type ClientOptions struct {
Logger *zap.Logger
RPCURL string
}
// DefaultClientOptions return the client options used to instantiate a Solana
// client by default.
func DefaultClientOptions() ClientOptions {
logger, err := zap.NewDevelopment()
if err != nil {
panic(err)
}
return ClientOptions{
Logger: logger,
RPCURL: DefaultClientRPCURL,
}
}
// WithRPCURL returns a modified version of the options with the given API
// rpc-url
func (opts ClientOptions) WithRPCURL(rpcURL pack.String) ClientOptions {
opts.RPCURL = string(rpcURL)
return opts
}
// Client represents a Solana client that implements the multichain Contract API.
type Client struct {
opts ClientOptions
}
// NewClient returns a new solana.Client interface that implements the
// multichain Contract API.
func NewClient(opts ClientOptions) *Client {
return &Client{opts: opts}
}
// FindProgramAddress is a wrapper function that calls the Solana FFI to find
// the deterministic program-derived address using the program and seeds.
func FindProgramAddress(seeds []byte, program address.RawAddress) (address.Address, error) {
addrEncodeDecoder := NewAddressEncodeDecoder()
encoded, err := addrEncodeDecoder.EncodeAddress(program)
if err != nil {
return address.Address(""), err
}
return ProgramDerivedAddress(seeds, encoded), nil
}
// GetAccountData fetches and returns the account data.
func (client *Client) GetAccountData(account address.Address) (pack.Bytes, error) {
// Fetch account info with base64 encoding. The default base58 encoding does
// not support account data that is larger than 128 bytes, hence base64.
params := json.RawMessage(fmt.Sprintf(`["%v", {"encoding":"base64"}]`, string(account)))
res, err := SendDataWithRetry("getAccountInfo", params, client.opts.RPCURL)
if err != nil {
return nil, fmt.Errorf("calling rpc method \"getAccountInfo\": %v", err)
}
if res.Result == nil {
return nil, fmt.Errorf("decoding result: empty")
}
// Deserialise the account's info into the appropriate struct.
info := ResponseGetAccountInfo{}
if err := json.Unmarshal(*res.Result, &info); err != nil {
return nil, fmt.Errorf("decoding result: %v", err)
}
// Decode the Base58 encoded account data into raw byte-representation. Since
// this holds the burn log's data.
data, err := base64.RawStdEncoding.DecodeString(info.Value.Data[0])
if err != nil {
return nil, fmt.Errorf("decoding base64 value: %v", err)
}
return pack.Bytes(data), nil
}
// CallContract implements the multichain Contract API. In the case of Solana,
// it is used to fetch burn logs associated with a particular burn nonce.
func (client *Client) CallContract(
ctx context.Context,
program address.Address,
calldata contract.CallData,
) (pack.Bytes, error) {
addrEncodeDecoder := NewAddressEncodeDecoder()
decodedProgram, err := addrEncodeDecoder.DecodeAddress(program)
if err != nil {
return pack.Bytes(nil), fmt.Errorf("decode address: %v", err)
}
// Find the program-derived address that will have persisted the burn log.
burnLogAccount, err := FindProgramAddress([]byte(calldata), decodedProgram)
if err != nil {
return pack.Bytes(nil), fmt.Errorf("find program-derived address: %v", err)
}
// Make an RPC call to "getAccountInfo" to get the data associated with the
// account (we interpret the contract address as the account identifier).
params := json.RawMessage(fmt.Sprintf(`["%v", {"encoding":"base58"}]`, string(burnLogAccount)))
res, err := SendDataWithRetry("getAccountInfo", params, client.opts.RPCURL)
if err != nil {
return pack.Bytes(nil), fmt.Errorf("calling rpc method \"getAccountInfo\": %v", err)
}
if res.Result == nil {
return pack.Bytes(nil), fmt.Errorf("decoding result: empty")
}
// Deserialise the account's info into the appropriate struct.
info := ResponseGetAccountInfo{}
if err := json.Unmarshal(*res.Result, &info); err != nil {
return pack.Bytes(nil), fmt.Errorf("decoding result: %v", err)
}
// Decode the Base58 encoded account data into raw byte-representation. Since
// this holds the burn log's data.
data := base58.Decode(info.Value.Data[0])
if err != nil {
return pack.Bytes(nil), fmt.Errorf("decoding result from base58: %v", err)
}
return pack.NewBytes(data), nil
}
================================================
FILE: chain/solana/solana_ffi.go
================================================
package solana
import (
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
"github.com/renproject/solana-ffi/cgo"
)
// UniquePubkey creates an atomically incrementing pubkey used for tests and
// benchmarking purposes.
func UniquePubkey() address.Address {
pubkey := cgo.UniquePubkey()
return address.Address(pubkey)
}
// ProgramDerivedAddress derives an address for an account that only the given
// program has the authority to sign. The address is of the same form as a
// Solana pubkey, except they are ensured to not be on the es25519 curve and
// thus have no associated private key. This address is deterministic, based
// upon the program and the seeds slice.
func ProgramDerivedAddress(seeds pack.Bytes, program address.Address) address.Address {
programDerivedAddressEncoded := cgo.ProgramDerivedAddress(seeds, uint32(len(seeds)), string(program))
return address.Address(programDerivedAddressEncoded)
}
================================================
FILE: chain/solana/solana_ffi_test.go
================================================
package solana_test
import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/solana"
"github.com/renproject/pack"
"github.com/renproject/solana-ffi/cgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Solana FFI", func() {
Context("FFI", func() {
It("should create a unique pubkey", func() {
key1 := solana.UniquePubkey()
key2 := solana.UniquePubkey()
Expect(key1).NotTo(Equal(key2))
})
})
Context("Program Derived Address", func() {
It("should correctly compute 1", func() {
program := address.Address("6kAHanNCT1LKFoMn3fBdyvJuvHLcWhLpJbTpbHpqRiG4")
seeds := []byte("GatewayState")
programDerivedAddress := solana.ProgramDerivedAddress(pack.Bytes(seeds), program)
expectedDerivedAddress := address.Address("APthNc29MGRJRkKahDRNrSNA2o1e8p6aFAJNRV8ZdJaV")
Expect(programDerivedAddress[:]).To(Equal(expectedDerivedAddress))
})
It("should correctly compute 2", func() {
program := address.Address("6kAHanNCT1LKFoMn3fBdyvJuvHLcWhLpJbTpbHpqRiG4")
selector := "BTC/toSolana"
selectorHash := crypto.Keccak256([]byte(selector))
programDerivedAddress := solana.ProgramDerivedAddress(pack.Bytes(selectorHash), program)
expectedDerivedAddress := address.Address("6SPY5x3tmjLZ9SWcZFKhwpANrhYJagNNF4Sa4LAwtbCn")
Expect(programDerivedAddress[:]).To(Equal(expectedDerivedAddress))
})
})
Context("Associated Token Account", func() {
It("should correctly calculate", func() {
walletAddress := "fYq3qkHoVogcPnkxFWAwiJGJs29Xtg4FZ6xcAHWd51w"
selector := "BTC/toSolana"
assTokenAccount := cgo.AssociatedTokenAccount(walletAddress, selector)
expectedAssTokenAccount := "GxMKqib75YSD5RegZP8A7ZkSv8uBFmfNsNXzGptBdqdo"
Expect(assTokenAccount).To(Equal(expectedAssTokenAccount))
})
})
})
================================================
FILE: chain/solana/solana_suite_test.go
================================================
package solana_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestSolana(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Solana Suite")
}
================================================
FILE: chain/solana/solana_test.go
================================================
package solana_test
import (
"context"
"encoding/binary"
"os"
"time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/near/borsh-go"
"github.com/renproject/multichain"
"github.com/renproject/multichain/chain/solana"
"github.com/renproject/pack"
"github.com/renproject/solana-ffi/cgo"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
// Bytes32 is an alias for [32]byte
type Bytes32 = [32]byte
// GatewayRegistry defines the state of gateway registry, serialized and
// deserialized by the borsh schema.
type GatewayRegistry struct {
IsInitialised uint8
Owner Bytes32
Count uint64
Selectors []Bytes32
Gateways []Bytes32
}
var _ = Describe("Solana", func() {
// Setup logger.
loggerConfig := zap.NewDevelopmentConfig()
loggerConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
logger, err := loggerConfig.Build()
Expect(err).ToNot(HaveOccurred())
Context("When minting and burning", func() {
It("should succeed", func() {
// Base58 address of the Gateway program that is deployed to Solana.
program := multichain.Address("FDdKRjbBeFtyu5c66cZghJsTTjDTT1aD3zsgTWMTpaif")
// Construct user's keypair path (~/.config/solana/id.json).
userHomeDir, err := os.UserHomeDir()
Expect(err).NotTo(HaveOccurred())
keypairPath := userHomeDir + "/.config/solana/id.json"
// RenVM secret and the selector for this gateway.
renVmSecret := "0000000000000000000000000000000000000000000000000000000000000001"
selector := "BTC/toSolana"
// Mint some tokens.
time.Sleep(10 * time.Second)
mintAmount := uint64(1000000000) // 10 tokens.
nilSlice := make([]byte, 32)
mintSig := cgo.GatewayMint(keypairPath, solana.DefaultClientRPCURL, renVmSecret, selector, mintAmount, nilSlice, nilSlice)
logger.Debug("Mint", zap.String("tx signature", string(mintSig)))
// Burn some tokens.
time.Sleep(10 * time.Second)
recipient := []byte("mwjUmhAW68zCtgZpW5b1xD5g7MZew6xPV4")
Expect(err).NotTo(HaveOccurred())
burnCount := cgo.GatewayGetBurnCount(solana.DefaultClientRPCURL, selector)
burnAmount := uint64(500000000) // 5 tokens.
burnSig := cgo.GatewayBurn(keypairPath, solana.DefaultClientRPCURL, selector, burnCount, burnAmount, uint32(len(recipient)), recipient)
logger.Debug("Burn", zap.String("tx signature", string(burnSig)))
// Fetch burn log.
time.Sleep(20 * time.Second)
client := solana.NewClient(solana.DefaultClientOptions())
calldata := make([]byte, 8)
binary.LittleEndian.PutUint64(calldata, burnCount)
data, err := client.CallContract(context.Background(), program, multichain.ContractCallData(calldata))
Expect(err).NotTo(HaveOccurred())
Expect(len(data)).To(Equal(97))
fetchedAmount := [32]byte{}
copy(fetchedAmount[:], data[0:32])
recipientLen := uint8(data[32:33][0])
fetchedRecipient := pack.Bytes(data[33 : 33+int(recipientLen)])
Expect(pack.NewU256(fetchedAmount)).To(Equal(pack.NewU256FromUint64(burnAmount)))
Expect([]byte(fetchedRecipient)).To(Equal(recipient))
})
})
Context("When getting Gateways from Registry", func() {
It("should deserialize successfully", func() {
// Solana client using default client options.
client := solana.NewClient(solana.DefaultClientOptions())
// Base58 address of the Gateway registry program deployed to Solana.
registryProgram := multichain.Address("DHpzwsdvAzq61PN9ZwQWg2hzwX8gYNfKAdsNKKtdKDux")
seeds := []byte("GatewayRegistryState")
registryState := solana.ProgramDerivedAddress(pack.Bytes(seeds), registryProgram)
// Fetch account data at gateway registry's state
accountData, err := client.GetAccountData(registryState)
Expect(err).NotTo(HaveOccurred())
// Deserialize the account data into registry state's structure.
registry := GatewayRegistry{}
err = borsh.Deserialize(®istry, []byte(accountData))
Expect(err).NotTo(HaveOccurred())
// The registry (in the CI test environment) is pre-populated with gateway
// addresses for BTC/toSolana selector.
zero := pack.NewU256FromU8(pack.U8(0)).Bytes32()
btcSelectorHash := [32]byte{}
copy(btcSelectorHash[:], crypto.Keccak256([]byte("BTC/toSolana")))
lunaSelectorHash := [32]byte{}
copy(lunaSelectorHash[:], crypto.Keccak256([]byte("LUNA/toSolana")))
daiSelectorHash := [32]byte{}
copy(daiSelectorHash[:], crypto.Keccak256([]byte("DAI/toSolana")))
addrEncodeDecoder := solana.NewAddressEncodeDecoder()
expectedBtcGateway, _ := addrEncodeDecoder.DecodeAddress("FDdKRjbBeFtyu5c66cZghJsTTjDTT1aD3zsgTWMTpaif")
expectedLunaGateway, _ := addrEncodeDecoder.DecodeAddress("3zfUUYDVp68fk9Z8FoKxEcEFqSMhE5UZ3Mw8mGhm5WRt")
expectedDaiGateway, _ := addrEncodeDecoder.DecodeAddress("rZJ8SoJBNWq8Qi6QTNTdVv78DPW6mn2fJUw7CPUvSgA")
Expect(registry.Count).To(Equal(uint64(3)))
Expect(registry.Selectors[0]).To(Equal(btcSelectorHash))
Expect(registry.Selectors[1]).To(Equal(lunaSelectorHash))
Expect(registry.Selectors[2]).To(Equal(daiSelectorHash))
Expect(registry.Selectors[3]).To(Equal(zero))
Expect(len(registry.Selectors)).To(Equal(32))
Expect(registry.Gateways[0][:]).To(Equal([]byte(expectedBtcGateway)))
Expect(registry.Gateways[1][:]).To(Equal([]byte(expectedLunaGateway)))
Expect(registry.Gateways[2][:]).To(Equal([]byte(expectedDaiGateway)))
Expect(registry.Gateways[3]).To(Equal(zero))
Expect(len(registry.Gateways)).To(Equal(32))
})
})
})
================================================
FILE: chain/solana/solanarpc.go
================================================
package solana
// AccountContext is the JSON-interface of the account's context representing
// what slot the account's value has been returned for.
type AccountContext struct {
Slot int `json:"slot"`
}
// AccountValue is the JSON-interface of the account's information.
type AccountValue struct {
Data [2]string `json:"data"`
Executable bool `json:"executable"`
Lamports int `json:"lamports"`
Owner string `json:"owner"`
RentEpoch int `json:"rentEpoch"`
}
// ResponseGetAccountInfo is the JSON-interface of the response for the
// getAccountInfo query.
type ResponseGetAccountInfo struct {
Context AccountContext `json:"context"`
Value AccountValue `json:"value"`
}
================================================
FILE: chain/substrate/address.go
================================================
package substrate
import (
"fmt"
"github.com/btcsuite/btcutil/base58"
"github.com/renproject/pack"
)
// An Address represents a public address on a Substrate blockchain. It can be
// the address of an external account, or the address of a smart contract.
type Address pack.Bytes
// The AddressDecoder defines an interface for decoding string representations
// of Substrate address into the concrete Address type.
type AddressDecoder interface {
DecodeAddress(pack.String) (pack.Bytes, error)
}
type addressDecoder struct{}
// NewAddressDecoder returns the default AddressDecoder for Substract chains. It
// uses the Bitcoin base58 alphabet to decode the string, and interprets the
// result as a 2-byte address type, 32-byte array, and 1-byte checksum.
func NewAddressDecoder() AddressDecoder {
return addressDecoder{}
}
// DecodeAddress the string using the Bitcoin base58 alphabet. If the string
// does not a 2-byte address type, 32-byte array, and 1-byte checksum, then an
// error is returned.
func (addressDecoder) DecodeAddress(encoded pack.String) (pack.Bytes, error) {
data := base58.Decode(encoded.String())
if len(data) != 35 {
return nil, fmt.Errorf("expected 35 bytes, got %v bytes", len(data))
}
return pack.Bytes(data), nil
}
================================================
FILE: chain/substrate/address_test.go
================================================
package substrate_test
================================================
FILE: chain/terra/address.go
================================================
package terra
import "github.com/renproject/multichain/chain/cosmos"
type (
// Address re-exports cosmos-compatible address
Address = cosmos.Address
// AddressDecoder re-exports cosmos.AddressDecoder
AddressDecoder = cosmos.AddressDecoder
// AddressEncoder re-exports cosmos.AddressEncoder
AddressEncoder = cosmos.AddressEncoder
// AddressEncodeDecoder re-exports cosmos.AddressEncodeDecoder
AddressEncodeDecoder = cosmos.AddressEncodeDecoder
)
var (
// NewAddressDecoder re-exports cosmos.NewAddressDecoder
NewAddressDecoder = cosmos.NewAddressDecoder
// NewAddressEncoder re-exports cosmos.NewAddressEncoder
NewAddressEncoder = cosmos.NewAddressEncoder
// NewAddressEncodeDecoder re-exports cosmos.NewAddressEnodeDecoder
NewAddressEncodeDecoder = cosmos.NewAddressEncodeDecoder
)
================================================
FILE: chain/terra/address_test.go
================================================
package terra_test
import (
"fmt"
"github.com/renproject/multichain"
"github.com/renproject/multichain/chain/terra"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Terra", func() {
Context("when decoding address", func() {
decoder := terra.NewAddressDecoder()
Context("when decoding a valid address", func() {
It("should work", func() {
addrStr := "terra1ztez03dp94y2x55fkhmrvj37ck204geq33msma"
_, err := decoder.DecodeAddress(multichain.Address(pack.NewString(addrStr)))
Expect(err).ToNot(HaveOccurred())
})
})
Context("when decoding an address with invalid prefix", func() {
It("should fail", func() {
addrStr := "cosmosztez03dp94y2x55fkhmrvj37ck204geq33msma"
_, err := decoder.DecodeAddress(multichain.Address(pack.NewString(addrStr)))
Expect(err).To(HaveOccurred())
})
})
Context("when decoding an invalid address", func() {
It("should fail", func() {
addrStr := "terra1ztez03dp94y2x55fkhmrvj37ck204geq33msm"
_, err := decoder.DecodeAddress(multichain.Address(pack.NewString(addrStr)))
Expect(err).To(HaveOccurred())
})
})
Context("when decoding an empty address", func() {
It("should fail", func() {
addrStr := ""
_, err := decoder.DecodeAddress(multichain.Address(pack.NewString(addrStr)))
Expect(err).Should(MatchError(fmt.Errorf("unexpected address length: want=20, got=0")))
})
})
})
})
================================================
FILE: chain/terra/terra.go
================================================
package terra
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strconv"
"github.com/cosmos/cosmos-sdk/types"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/chain/cosmos"
"github.com/renproject/pack"
"github.com/terra-money/core/app"
)
const DefaultTerraDecimalsDivisor = 1e5
type (
// Client re-exports cosmos.Client
Client = cosmos.Client
// ClientOptions re-exports cosmos.ClientOptions
ClientOptions = cosmos.ClientOptions
// TxBuilderOptions re-exports cosmos.TxBuilderOptions
TxBuilderOptions = cosmos.TxBuilderOptions
)
var (
// DefaultClientOptions re-exports cosmos.DefaultClientOptions
DefaultClientOptions = cosmos.DefaultClientOptions
// DefaultTxBuilderOptions re-exports cosmos.DefaultTxBuilderOptions
DefaultTxBuilderOptions = cosmos.DefaultTxBuilderOptions
// NewGasEstimator re-exports cosmos.NewGasEstimator
NewGasEstimator = cosmos.NewGasEstimator
)
// Set the Bech32 address prefix for the globally-defined config variable inside
// Cosmos SDK. This is required as there are a number of functions inside the
// SDK that make use of this global config directly, instead of allowing us to
// provide a custom config.
func init() {
// TODO: This will prevent us from being able to support multiple
// Cosmos-compatible chains in the Multichain. This is expected to be
// resolved before v1.0 of the Cosmos SDK (issue being tracked here:
// https://github.com/cosmos/cosmos-sdk/issues/7448).
types.GetConfig().SetBech32PrefixForAccount("terra", "terrapub")
types.GetConfig().Seal()
}
// NewClient returns returns a new Client with Terra codec.
func NewClient(opts ClientOptions) *Client {
cfg := app.MakeEncodingConfig()
return cosmos.NewClient(opts, cfg.Marshaler, cfg.TxConfig, cfg.InterfaceRegistry, cfg.Amino, "terra")
}
// NewTxBuilder returns an implementation of the transaction builder interface
// from the Cosmos Compat API, and exposes the functionality to build simple
// Terra transactions.
func NewTxBuilder(opts TxBuilderOptions, client *Client) account.TxBuilder {
return cosmos.NewTxBuilder(opts, client)
}
type GasEstimator struct {
url string
key string
decimals int
fallbackGas pack.U256
}
func NewHttpGasEstimator(url, key string, decimals int, fallbackGas pack.U256) GasEstimator {
return GasEstimator{
url: url,
key: key,
decimals: decimals,
fallbackGas: fallbackGas,
}
}
func (gasEstimator GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
response, err := http.Get(gasEstimator.url)
if err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, err
}
defer response.Body.Close()
var results map[string]string
if err := json.NewDecoder(response.Body).Decode(&results); err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, err
}
gasPriceStr, ok := results[gasEstimator.key]
if !ok {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, fmt.Errorf("no %v in response", gasEstimator.key)
}
gasPriceFloat, err := strconv.ParseFloat(gasPriceStr, 64)
if err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, fmt.Errorf("invalid gas price, %v", err)
}
gasPrice := uint64(gasPriceFloat * float64(gasEstimator.decimals))
return pack.NewU256FromUint64(gasPrice), pack.NewU256FromUint64(gasPrice), nil
}
================================================
FILE: chain/terra/terra_suite_test.go
================================================
package terra_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestTerra(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Terra Suite")
}
================================================
FILE: chain/terra/terra_test.go
================================================
package terra_test
import (
"context"
"encoding/hex"
"os"
"time"
"github.com/renproject/id"
"github.com/renproject/multichain"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/terra"
"github.com/renproject/pack"
"github.com/renproject/surge"
"github.com/tendermint/tendermint/crypto/secp256k1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Terra", func() {
Context("when submitting transactions", func() {
Context("when sending LUNA", func() {
It("should work", func() {
// create context for the test
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting TERRA_PK to the
// value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("TERRA_PK")
if pkEnv == "" {
panic("TERRA_PK is undefined")
}
pkBz, err := hex.DecodeString(pkEnv)
Expect(err).ToNot(HaveOccurred())
var pk secp256k1.PrivKey
copy(pk[:], pkBz)
var privKey id.PrivKey
err = surge.FromBinary(&privKey, pkBz)
Expect(err).NotTo(HaveOccurred())
addr := terra.Address(pk.PubKey().Address())
// random recipient
pkRecipient := secp256k1.GenPrivKey()
addrEncoder := terra.NewAddressEncoder()
recipient, err := addrEncoder.EncodeAddress(address.RawAddress(pack.Bytes(pkRecipient.PubKey().Address())))
Expect(err).NotTo(HaveOccurred())
// attach the signature to the transaction
pubKey := pk.PubKey().(secp256k1.PubKey)
// instantiate a new client
client := terra.NewClient(
terra.DefaultClientOptions().
WithCoinDenom("uluna"),
)
nonce, err := client.AccountNonce(ctx, multichain.Address(addr.String()))
Expect(err).NotTo(HaveOccurred())
// create a new cosmos-compatible transaction builder
txBuilder := terra.NewTxBuilder(
terra.DefaultTxBuilderOptions().
WithChainID("testnet"),
client,
)
// build the transaction
payload := pack.NewBytes([]byte("multichain"))
amount := pack.NewU256FromU64(pack.U64(2000000))
tx, err := txBuilder.BuildTx(
ctx,
privKey.PubKey(), // fromPubKey
recipient, // to
amount, // amount
nonce, // nonce
pack.NewU256FromU64(pack.U64(200000)), // gas limit
pack.NewU256FromU64(pack.U64(1)), // gas price
pack.NewU256FromU64(pack.U64(1)), // gas cap
payload, // memo
)
Expect(err).NotTo(HaveOccurred())
// get the transaction bytes and sign it
sighashes, err := tx.Sighashes()
Expect(err).NotTo(HaveOccurred())
Expect(len(sighashes)).To(Equal(1))
hash := id.Hash(sighashes[0])
sig, err := privKey.Sign(&hash)
Expect(err).NotTo(HaveOccurred())
sigBytes, err := surge.ToBinary(sig)
Expect(err).NotTo(HaveOccurred())
sig65 := pack.Bytes65{}
copy(sig65[:], sigBytes)
err = tx.Sign(
[]pack.Bytes65{sig65},
pack.NewBytes(pubKey[:]),
)
Expect(err).NotTo(HaveOccurred())
// submit the transaction to the chain
txHash := tx.Hash()
err = client.SubmitTx(ctx, tx)
Expect(err).NotTo(HaveOccurred())
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a Bitcoin transaction!
foundTx, confs, err := client.Tx(ctx, txHash)
if err == nil {
Expect(confs.Uint64()).To(Equal(uint64(1)))
Expect(foundTx.Payload()).To(Equal(multichain.ContractCallData([]byte(payload.String()))))
Expect(foundTx.Nonce()).To(Equal(nonce))
Expect(foundTx.From()).To(Equal(multichain.Address(addr.String())))
Expect(foundTx.To()).To(Equal(recipient))
Expect(foundTx.Value()).To(Equal(amount))
break
}
// wait and retry querying for the transaction
time.Sleep(2 * time.Second)
}
})
})
})
})
================================================
FILE: chain/zcash/address.go
================================================
package zcash
import (
"bytes"
"crypto/sha256"
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/base58"
"github.com/renproject/multichain/api/address"
"github.com/renproject/pack"
"golang.org/x/crypto/ripemd160"
)
// AddressEncodeDecoder implements the address.EncodeDecoder interface
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
// AddressEncoder encapsulates the chain specific configurations and implements
// the address.Encoder interface
type AddressEncoder struct {
params *Params
}
// AddressDecoder encapsulates the chain specific configurations and implements
// the address.Decoder interface
type AddressDecoder struct {
params *Params
}
// NewAddressEncoder constructs a new AddressEncoder with the chain specific
// configurations
func NewAddressEncoder(params *Params) AddressEncoder {
return AddressEncoder{params: params}
}
// NewAddressDecoder constructs a new AddressDecoder with the chain specific
// configurations
func NewAddressDecoder(params *Params) AddressDecoder {
return AddressDecoder{params: params}
}
// NewAddressEncodeDecoder constructs a new AddressEncodeDecoder with the
// chain specific configurations
func NewAddressEncodeDecoder(params *Params) AddressEncodeDecoder {
return AddressEncodeDecoder{
AddressEncoder: NewAddressEncoder(params),
AddressDecoder: NewAddressDecoder(params),
}
}
// EncodeAddress implements the address.Encoder interface
func (encoder AddressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error) {
var addrType uint8
var err error
var hash [20]byte
var prefix []byte
switch len(rawAddr) {
case ripemd160.Size + 5:
prefix = rawAddr[:1]
addrType, err = addressType(prefix, encoder.params)
copy(hash[:], rawAddr[1:21])
case ripemd160.Size + 6:
prefix = rawAddr[:2]
addrType, err = addressType(prefix, encoder.params)
copy(hash[:], rawAddr[2:22])
default:
return address.Address(""), fmt.Errorf("validating address length: expected %v or %v, got %v", ripemd160.Size+5, ripemd160.Size+6, len(rawAddr))
}
if err != nil {
return address.Address(""), fmt.Errorf("parsing address type: %v", err)
}
switch addrType {
case 0, 1: // P2PKH or P2SH
return address.Address(pack.String(encodeAddress(hash[:], prefix))), nil
default:
return address.Address(""), fmt.Errorf("unexpected address type: %v", addrType)
}
}
// DecodeAddress implements the address.Decoder interface
func (decoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error) {
var decoded = base58.Decode(string(addr))
var addrType uint8
var err error
var hash [20]byte
switch len(decoded) {
case ripemd160.Size + 5:
addrType, err = addressType(decoded[:1], decoder.params)
copy(hash[:], decoded[1:21])
case ripemd160.Size + 6:
addrType, err = addressType(decoded[:2], decoder.params)
copy(hash[:], decoded[2:22])
default:
return nil, fmt.Errorf("validating address length: expected %v or %v, got %v", ripemd160.Size+5, ripemd160.Size+6, len(decoded))
}
if err != nil {
return nil, fmt.Errorf("parsing address type: %v", err)
}
var cksum [4]byte
copy(cksum[:], decoded[len(decoded)-4:])
if checksum(decoded[:len(decoded)-4]) != cksum {
return nil, fmt.Errorf("validating checksum: %v", base58.ErrChecksum)
}
switch addrType {
case 0, 1: // P2PKH or P2SH
return address.RawAddress(pack.Bytes(decoded)), nil
default:
return nil, fmt.Errorf("unexpected address type: %v", addrType)
}
}
func addressType(prefix []byte, params *Params) (uint8, error) {
if bytes.Equal(prefix, params.P2PKHPrefix) {
return 0, nil
}
if bytes.Equal(prefix, params.P2SHPrefix) {
return 1, nil
}
return 0, btcutil.ErrUnknownAddressType
}
// An Address represents a Zcash address.
type Address interface {
btcutil.Address
BitcoinAddress() btcutil.Address
}
// AddressPubKeyHash represents an address for P2PKH transactions for Zcash that
// is compatible with the Bitcoin Compat API.
type AddressPubKeyHash struct {
*btcutil.AddressPubKeyHash
params *Params
}
// NewAddressPubKeyHash returns a new AddressPubKeyHash that is compatible with
// the Bitcoin Compat API.
func NewAddressPubKeyHash(pkh []byte, params *Params) (AddressPubKeyHash, error) {
addr, err := btcutil.NewAddressPubKeyHash(pkh, params.Params)
return AddressPubKeyHash{AddressPubKeyHash: addr, params: params}, err
}
// String returns the string encoding of the transaction output destination.
//
// Please note that String differs subtly from EncodeAddress: String will return
// the value as a string without any conversion, while EncodeAddress may convert
// destination types (for example, converting pubkeys to P2PKH addresses) before
// encoding as a payment address string.
func (addr AddressPubKeyHash) String() string {
return addr.EncodeAddress()
}
// EncodeAddress returns the string encoding of the payment address associated
// with the Address value. See the comment on String for how this method differs
// from String.
func (addr AddressPubKeyHash) EncodeAddress() string {
hash := *addr.AddressPubKeyHash.Hash160()
return encodeAddress(hash[:], addr.params.P2PKHPrefix)
}
// ScriptAddress returns the raw bytes of the address to be used when inserting
// the address into a txout's script.
func (addr AddressPubKeyHash) ScriptAddress() []byte {
return addr.AddressPubKeyHash.ScriptAddress()
}
// IsForNet returns whether or not the address is associated with the passed
// bitcoin network.
func (addr AddressPubKeyHash) IsForNet(params *chaincfg.Params) bool {
return addr.AddressPubKeyHash.IsForNet(params)
}
// BitcoinAddress returns the address as if it was a Bitcoin address.
func (addr AddressPubKeyHash) BitcoinAddress() btcutil.Address {
return addr.AddressPubKeyHash
}
// AddressScriptHash represents an address for P2SH transactions for Zcash that
// is compatible with the Bitcoin Compat API.
type AddressScriptHash struct {
*btcutil.AddressScriptHash
params *Params
}
// NewAddressScriptHash returns a new AddressScriptHash that is compatible with
// the Bitcoin Compat API.
func NewAddressScriptHash(script []byte, params *Params) (AddressScriptHash, error) {
addr, err := btcutil.NewAddressScriptHash(script, params.Params)
return AddressScriptHash{AddressScriptHash: addr, params: params}, err
}
// NewAddressScriptHashFromHash returns a new AddressScriptHash that is compatible with
// the Bitcoin Compat API.
func NewAddressScriptHashFromHash(scriptHash []byte, params *Params) (AddressScriptHash, error) {
addr, err := btcutil.NewAddressScriptHashFromHash(scriptHash, params.Params)
return AddressScriptHash{AddressScriptHash: addr, params: params}, err
}
// String returns the string encoding of the transaction output destination.
//
// Please note that String differs subtly from EncodeAddress: String will return
// the value as a string without any conversion, while EncodeAddress may convert
// destination types (for example, converting pubkeys to P2PKH addresses) before
// encoding as a payment address string.
func (addr AddressScriptHash) String() string {
return addr.EncodeAddress()
}
// BitcoinAddress returns the address as if it was a Bitcoin address.
func (addr AddressScriptHash) BitcoinAddress() btcutil.Address {
return addr.AddressScriptHash
}
// EncodeAddress returns the string encoding of the payment address associated
// with the Address value. See the comment on String for how this method differs
// from String.
func (addr AddressScriptHash) EncodeAddress() string {
hash := *addr.AddressScriptHash.Hash160()
return encodeAddress(hash[:], addr.params.P2SHPrefix)
}
// ScriptAddress returns the raw bytes of the address to be used when inserting
// the address into a txout's script.
func (addr AddressScriptHash) ScriptAddress() []byte {
return addr.AddressScriptHash.ScriptAddress()
}
// IsForNet returns whether or not the address is associated with the passed
// bitcoin network.
func (addr AddressScriptHash) IsForNet(params *chaincfg.Params) bool {
return addr.AddressScriptHash.IsForNet(params)
}
// addressFromRawBytes decodes a string-representation of an address to an address
// type that implements the zcash.Address interface
func addressFromRawBytes(addrBytes []byte, params *Params) (Address, error) {
var addrType uint8
var err error
var hash [20]byte
switch len(addrBytes) {
case ripemd160.Size + 5:
addrType, err = addressType(addrBytes[:1], params)
copy(hash[:], addrBytes[1:21])
case ripemd160.Size + 6:
addrType, err = addressType(addrBytes[:2], params)
copy(hash[:], addrBytes[2:22])
default:
return nil, fmt.Errorf("validating address length: expected %v or %v, got %v", ripemd160.Size+5, ripemd160.Size+6, len(addrBytes))
}
if err != nil {
return nil, fmt.Errorf("parsing address type: %v", err)
}
switch addrType {
case 0: // P2PKH
return NewAddressPubKeyHash(hash[:], params)
case 1: // P2SH
return NewAddressScriptHashFromHash(hash[:], params)
default:
return nil, fmt.Errorf("unexpected address type: %v", addrType)
}
}
func encodeAddress(hash, prefix []byte) string {
var (
body = append(prefix, hash...)
chk = checksum(body)
cksum [4]byte
)
copy(cksum[:], chk[:4])
return base58.Encode(append(body, cksum[:]...))
}
func checksum(input []byte) (cksum [4]byte) {
var (
h = sha256.Sum256(input)
h2 = sha256.Sum256(h[:])
)
copy(cksum[:], h2[:4])
return
}
================================================
FILE: chain/zcash/address_test.go
================================================
package zcash_test
import (
"bytes"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/chain/zcash"
)
var _ = Describe("Zcash Address", func() {
Context("address", func() {
addrEncodeDecoder := zcash.NewAddressEncodeDecoder(&zcash.RegressionNetParams)
It("addr pub key hash", func() {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), zcash.RegressionNetParams.Params, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
addr := address.Address(addrPubKeyHash.EncodeAddress())
decodedRawAddr, err := addrEncodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := addrEncodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
It("addr script hash", func() {
script := make([]byte, rand.Intn(100))
rand.Read(script)
addrScriptHash, err := zcash.NewAddressScriptHash(script, &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
addr := address.Address(addrScriptHash.EncodeAddress())
decodedRawAddr, err := addrEncodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := addrEncodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
})
Context("AddressEncodeDecoder", func() {
It("should give an error when decoding address on different network", func() {
params := []zcash.Params{
zcash.MainNetParams,
zcash.TestNet3Params,
zcash.RegressionNetParams,
}
for i, param := range params {
// Generate a P2PKH address with the params
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), param.Params, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), ¶m)
Expect(err).NotTo(HaveOccurred())
p2pkhAddr := address.Address(addrPubKeyHash.EncodeAddress())
// Generate a P2SH address with the params
script := make([]byte, rand.Intn(100))
rand.Read(script)
addrScriptHash, err := zcash.NewAddressScriptHash(script, ¶m)
Expect(err).NotTo(HaveOccurred())
p2shAddr := address.Address(addrScriptHash.EncodeAddress())
// Try decode the address using decoders with different network params
for j := range params {
addrEncodeDecoder := zcash.NewAddressEncodeDecoder(¶ms[j])
_, err := addrEncodeDecoder.DecodeAddress(p2pkhAddr)
// Check the prefix in the params instead of comparing the network directly
// because testnet and regression network has the same prefix.
if bytes.Equal(params[i].P2PKHPrefix, params[j].P2PKHPrefix) {
Expect(err).NotTo(HaveOccurred())
} else {
Expect(err).To(HaveOccurred())
}
_, err = addrEncodeDecoder.DecodeAddress(p2shAddr)
if bytes.Equal(params[i].P2PKHPrefix, params[j].P2PKHPrefix) {
Expect(err).NotTo(HaveOccurred())
} else {
Expect(err).To(HaveOccurred())
}
}
}
})
})
})
================================================
FILE: chain/zcash/gas.go
================================================
package zcash
import (
"context"
"fmt"
"math"
"github.com/renproject/pack"
)
const (
multiplier = 1e8
kilobyteToByte = 1024
)
// A GasEstimator returns the SATs-per-byte that is needed in order to confirm
// transactions with an estimated maximum delay of one block. In distributed
// networks that collectively build, sign, and submit transactions, it is
// important that all nodes in the network have reached consensus on the
// SATs-per-byte.
type GasEstimator struct {
client Client
numBlocks int64
fallbackGas pack.U256
}
// NewGasEstimator returns a simple gas estimator that always returns the given
// number of SATs-per-byte.
func NewGasEstimator(client Client, numBlocks int64, fallbackGas pack.U256) GasEstimator {
return GasEstimator{
client: client,
numBlocks: numBlocks,
fallbackGas: fallbackGas,
}
}
// EstimateGas returns the number of SATs-per-byte (for both price and cap) that
// is needed in order to confirm transactions with an estimated maximum delay of
// `numBlocks` block. It is the responsibility of the caller to know the number
// of bytes in their transaction. This method calls the `estimatesmartfee` RPC
// call to the node, which based on a conservative (considering longer history)
// strategy returns the estimated BTC per kilobyte of data in the transaction.
// An error will be returned if the bitcoin node hasn't observed enough blocks
// to make an estimate for the provided target `numBlocks`.
func (gasEstimator GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error) {
feeRate, err := gasEstimator.client.EstimateFeeLegacy(ctx, gasEstimator.numBlocks)
if err != nil {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, err
}
if feeRate <= 0.0 {
return gasEstimator.fallbackGas, gasEstimator.fallbackGas, fmt.Errorf("invalid fee rate: %v", feeRate)
}
satsPerByte := uint64(math.Ceil(feeRate * multiplier / kilobyteToByte))
return pack.NewU256FromUint64(satsPerByte), pack.NewU256FromUint64(satsPerByte), nil
}
================================================
FILE: chain/zcash/gas_test.go
================================================
package zcash_test
import (
"context"
"github.com/renproject/multichain/chain/zcash"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Gas", func() {
Context("when estimating zcash network fee", func() {
It("should work", func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client := zcash.NewClient(zcash.DefaultClientOptions())
// estimate fee to include tx within 1 block.
fallback1 := uint64(123)
gasEstimator1 := zcash.NewGasEstimator(client, 1, pack.NewU256FromUint64(fallback1))
gasPrice1, _, err := gasEstimator1.EstimateGas(ctx)
if err != nil {
Expect(gasPrice1).To(Equal(pack.NewU256FromUint64(fallback1)))
}
// estimate fee to include tx within 10 blocks.
fallback2 := uint64(234)
gasEstimator2 := zcash.NewGasEstimator(client, 10, pack.NewU256FromUint64(fallback2))
gasPrice2, _, err := gasEstimator2.EstimateGas(ctx)
if err != nil {
Expect(gasPrice2).To(Equal(pack.NewU256FromUint64(fallback2)))
}
// estimate fee to include tx within 100 blocks.
fallback3 := uint64(345)
gasEstimator3 := zcash.NewGasEstimator(client, 100, pack.NewU256FromUint64(fallback3))
gasPrice3, _, err := gasEstimator3.EstimateGas(ctx)
if err != nil {
Expect(gasPrice3).To(Equal(pack.NewU256FromUint64(fallback3)))
}
// expect fees in this order at the very least.
if err == nil {
Expect(gasPrice1.GreaterThanEqual(gasPrice2)).To(BeTrue())
Expect(gasPrice2.GreaterThanEqual(gasPrice3)).To(BeTrue())
}
})
})
})
================================================
FILE: chain/zcash/utxo.go
================================================
package zcash
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"math"
"math/big"
blake2 "github.com/dchest/blake2b"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/pack"
)
// Version of Zcash transactions supported by the multichain.
const Version int32 = 4
// ClientOptions are used to parameterise the behaviour of the Client.
type ClientOptions = bitcoin.ClientOptions
// DefaultClientOptions returns ClientOptions with the default settings. These
// settings are valid for use with the default local deployment of the
// multichain. In production, the host, user, and password should be changed.
func DefaultClientOptions() ClientOptions {
return bitcoin.DefaultClientOptions().WithHost("http://127.0.0.1:18232")
}
// Client re-exports bitcoin.Client.
type Client = bitcoin.Client
// NewClient re-exports bitcoin.Client
var NewClient = bitcoin.NewClient
// The TxBuilder is an implementation of a UTXO-compatible transaction builder
// for Bitcoin.
type TxBuilder struct {
params *Params
expiryHeight uint32
}
// NewTxBuilder returns an implementation the transaction builder interface from
// the Bitcoin Compat API, and exposes the functionality to build simple Zcash
// transactions.
func NewTxBuilder(params *Params, expiryHeight uint32) utxo.TxBuilder {
return TxBuilder{params: params, expiryHeight: expiryHeight}
}
// BuildTx returns a simple Zcash transaction that consumes the funds from the
// given outputs, and sends the to the given recipients. The difference in the
// sum value of the inputs and the sum value of the recipients is paid as a fee
// to the Zcash network.
//
// It is assumed that the required signature scripts require the SIGHASH_ALL
// signatures and the serialized public key:
//
// builder := txscript.NewScriptBuilder()
// builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll|SighashForkID)))
// builder.AddData(serializedPubKey)
//
// Outputs produced for recipients will use P2PKH, or P2SH scripts as the pubkey
// script, based on the format of the recipient address.
func (txBuilder TxBuilder) BuildTx(inputs []utxo.Input, recipients []utxo.Recipient) (utxo.Tx, error) {
msgTx := wire.NewMsgTx(Version)
// Address encoder-decoder
addrEncodeDecoder := NewAddressEncodeDecoder(txBuilder.params)
// Inputs
for _, input := range inputs {
hash := chainhash.Hash{}
copy(hash[:], input.Hash)
index := input.Output.Outpoint.Index.Uint32()
msgTx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&hash, index), nil, nil))
}
// Outputs
for _, recipient := range recipients {
addrBytes, err := addrEncodeDecoder.DecodeAddress(recipient.To)
if err != nil {
return &Tx{}, err
}
addr, err := addressFromRawBytes(addrBytes, txBuilder.params)
if err != nil {
return &Tx{}, err
}
script, err := txscript.PayToAddrScript(addr.BitcoinAddress())
if err != nil {
return &Tx{}, err
}
value := recipient.Value.Int().Int64()
if value < 0 {
return nil, fmt.Errorf("expected value >= 0, got value = %v", value)
}
msgTx.AddTxOut(wire.NewTxOut(value, script))
}
return &Tx{inputs: inputs, recipients: recipients, msgTx: msgTx, params: txBuilder.params, expiryHeight: txBuilder.expiryHeight, signed: false}, nil
}
// Tx represents a simple Zcash transaction that implements the Bitcoin Compat
// API.
type Tx struct {
inputs []utxo.Input
recipients []utxo.Recipient
msgTx *wire.MsgTx
params *Params
expiryHeight uint32
signed bool
}
// Hash returns the transaction hash of the given underlying transaction.
func (tx *Tx) Hash() (pack.Bytes, error) {
serial, err := tx.Serialize()
if err != nil {
return pack.Bytes{}, err
}
txhash := chainhash.DoubleHashH(serial)
return pack.NewBytes(txhash[:]), nil
}
// Inputs returns the UTXO inputs in the underlying transaction.
func (tx *Tx) Inputs() ([]utxo.Input, error) {
return tx.inputs, nil
}
// Outputs returns the UTXO outputs in the underlying transaction.
func (tx *Tx) Outputs() ([]utxo.Output, error) {
hash, err := tx.Hash()
if err != nil {
return nil, fmt.Errorf("bad hash: %v", err)
}
outputs := make([]utxo.Output, len(tx.msgTx.TxOut))
for i := range outputs {
outputs[i].Outpoint = utxo.Outpoint{
Hash: hash,
Index: pack.NewU32(uint32(i)),
}
outputs[i].PubKeyScript = pack.Bytes(tx.msgTx.TxOut[i].PkScript)
if tx.msgTx.TxOut[i].Value < 0 {
return nil, fmt.Errorf("bad output %v: value is less than zero", i)
}
outputs[i].Value = pack.NewU256FromU64(pack.NewU64(uint64(tx.msgTx.TxOut[i].Value)))
}
return outputs, nil
}
// Sighashes returns the digests that must be signed before the transaction
// can be submitted by the client.
func (tx *Tx) Sighashes() ([]pack.Bytes32, error) {
sighashes := make([]pack.Bytes32, len(tx.inputs))
for i, txin := range tx.inputs {
pubKeyScript := txin.Output.PubKeyScript
sigScript := txin.SigScript
value := txin.Output.Value.Int().Int64()
if value < 0 {
return []pack.Bytes32{}, fmt.Errorf("expected value >= 0, got value = %v", value)
}
var hash []byte
var err error
if sigScript == nil {
hash, err = calculateSighash(tx.params, pubKeyScript, txscript.SigHashAll, tx.msgTx, i, value, tx.expiryHeight)
} else {
hash, err = calculateSighash(tx.params, sigScript, txscript.SigHashAll, tx.msgTx, i, value, tx.expiryHeight)
}
if err != nil {
return []pack.Bytes32{}, err
}
sighash := [32]byte{}
copy(sighash[:], hash)
sighashes[i] = pack.NewBytes32(sighash)
}
return sighashes, nil
}
// Sign consumes a list of signatures, and adds them to the list of UTXOs in
// the underlying transactions.
func (tx *Tx) Sign(signatures []pack.Bytes65, pubKey pack.Bytes) error {
if tx.signed {
return fmt.Errorf("already signed")
}
if len(signatures) != len(tx.msgTx.TxIn) {
return fmt.Errorf("expected %v signatures, got %v signatures", len(tx.msgTx.TxIn), len(signatures))
}
for i, rsv := range signatures {
r := new(big.Int).SetBytes(rsv[:32])
s := new(big.Int).SetBytes(rsv[32:64])
signature := btcec.Signature{
R: r,
S: s,
}
builder := txscript.NewScriptBuilder()
builder.AddData(append(signature.Serialize(), byte(txscript.SigHashAll)))
builder.AddData(pubKey)
if tx.inputs[i].SigScript != nil {
builder.AddData(tx.inputs[i].SigScript)
}
signatureScript, err := builder.Script()
if err != nil {
return err
}
tx.msgTx.TxIn[i].SignatureScript = signatureScript
}
tx.signed = true
return nil
}
// Serialize serializes the UTXO transaction to bytes.
func (tx *Tx) Serialize() (pack.Bytes, error) {
w := new(bytes.Buffer)
pver := uint32(0)
enc := wire.BaseEncoding
if err := binary.Write(w, binary.LittleEndian, uint32(tx.msgTx.Version)|(1<<31)); err != nil {
return pack.Bytes{}, err
}
var versionGroupID = versionOverwinterGroupID
if tx.msgTx.Version == versionSapling {
versionGroupID = versionSaplingGroupID
}
if err := binary.Write(w, binary.LittleEndian, versionGroupID); err != nil {
return pack.Bytes{}, err
}
// If the encoding nVersion is set to WitnessEncoding, and the Flags
// field for the MsgTx aren't 0x00, then this indicates the transaction
// is to be encoded using the new witness inclusionary structure
// defined in BIP0144.
doWitness := enc == wire.WitnessEncoding && tx.msgTx.HasWitness()
if doWitness {
// After the txn's Version field, we include two additional
// bytes specific to the witness encoding. The first byte is an
// always 0x00 marker byte, which allows decoders to
// distinguish a serialized transaction with witnesses from a
// regular (legacy) one. The second byte is the Flag field,
// which at the moment is always 0x01, but may be extended in
// the future to accommodate auxiliary non-committed fields.
if _, err := w.Write(witnessMarkerBytes); err != nil {
return pack.Bytes{}, err
}
}
count := uint64(len(tx.msgTx.TxIn))
if err := writeVarInt(w, pver, count); err != nil {
return pack.Bytes{}, err
}
for _, ti := range tx.msgTx.TxIn {
if err := writeTxIn(w, pver, tx.msgTx.Version, ti); err != nil {
return pack.Bytes{}, err
}
}
count = uint64(len(tx.msgTx.TxOut))
if err := writeVarInt(w, pver, count); err != nil {
return pack.Bytes{}, err
}
for _, to := range tx.msgTx.TxOut {
if err := writeTxOut(w, pver, tx.msgTx.Version, to); err != nil {
return pack.Bytes{}, err
}
}
// If this transaction is a witness transaction, and the witness
// encoded is desired, then encode the witness for each of the inputs
// within the transaction.
if doWitness {
for _, ti := range tx.msgTx.TxIn {
if err := writeTxWitness(w, pver, tx.msgTx.Version, ti.Witness); err != nil {
return pack.Bytes{}, err
}
}
}
if err := binary.Write(w, binary.LittleEndian, tx.msgTx.LockTime); err != nil {
return pack.Bytes{}, err
}
if err := binary.Write(w, binary.LittleEndian, tx.expiryHeight); err != nil {
return pack.Bytes{}, err
}
if tx.msgTx.Version == versionSapling {
// valueBalance
if err := binary.Write(w, binary.LittleEndian, uint64(0)); err != nil {
return pack.Bytes{}, err
}
// nShieldedSpend
if err := writeVarInt(w, pver, 0); err != nil {
return pack.Bytes{}, err
}
// nShieldedOutput
if err := writeVarInt(w, pver, 0); err != nil {
return pack.Bytes{}, err
}
}
if err := writeVarInt(w, pver, 0); err != nil {
return pack.Bytes{}, err
}
return pack.NewBytes(w.Bytes()), nil
}
func calculateSighash(
network *Params,
subScript []byte,
hashType txscript.SigHashType,
tx *wire.MsgTx,
idx int,
amt int64,
expiryHeight uint32,
) ([]byte, error) {
sigHashes, err := txSighashes(tx)
if err != nil {
return nil, err
}
// As a sanity check, ensure the passed input index for the transaction
// is valid.
if idx > len(tx.TxIn)-1 {
return nil, fmt.Errorf("blake2bSignatureHash error: idx %d but %d txins", idx, len(tx.TxIn))
}
// We'll utilize this buffer throughout to incrementally calculate
// the signature hash for this transaction.
var sigHash bytes.Buffer
// << GetHeader
// First write out, then encode the transaction's nVersion number. Zcash current nVersion = 3
var bVersion [4]byte
binary.LittleEndian.PutUint32(bVersion[:], uint32(tx.Version)|(1<<31))
sigHash.Write(bVersion[:])
var versionGroupID = versionOverwinterGroupID
if tx.Version == versionSapling {
versionGroupID = versionSaplingGroupID
}
// << nVersionGroupId
// Version group ID
var nVersion [4]byte
binary.LittleEndian.PutUint32(nVersion[:], versionGroupID)
sigHash.Write(nVersion[:])
// Next write out the possibly pre-calculated hashes for the sequence
// numbers of all inputs, and the hashes of the previous outs for all
// outputs.
var zeroHash chainhash.Hash
// << hashPrevouts
// If anyone can pay isn't active, then we can use the cached
// hashPrevOuts, otherwise we just write zeroes for the prev outs.
if hashType&txscript.SigHashAnyOneCanPay == 0 {
sigHash.Write(sigHashes.HashPrevOuts[:])
} else {
sigHash.Write(zeroHash[:])
}
// << hashSequence
// If the sighash isn't anyone can pay, single, or none, the use the
// cached hash sequences, otherwise write all zeroes for the
// hashSequence.
if hashType&txscript.SigHashAnyOneCanPay == 0 &&
hashType&sighashMask != txscript.SigHashSingle &&
hashType&sighashMask != txscript.SigHashNone {
sigHash.Write(sigHashes.HashSequence[:])
} else {
sigHash.Write(zeroHash[:])
}
// << hashOutputs
// If the current signature mode isn't single, or none, then we can
// re-use the pre-generated hashoutputs sighash fragment. Otherwise,
// we'll serialize and add only the target output index to the signature
// pre-image.
if hashType&sighashMask != txscript.SigHashSingle && hashType&sighashMask != txscript.SigHashNone {
sigHash.Write(sigHashes.HashOutputs[:])
} else if hashType&sighashMask == txscript.SigHashSingle && idx < len(tx.TxOut) {
var (
b bytes.Buffer
h chainhash.Hash
)
if err := wire.WriteTxOut(&b, 0, 0, tx.TxOut[idx]); err != nil {
return nil, err
}
var err error
if h, err = blake2b(b.Bytes(), []byte(outputsHashPersonalization)); err != nil {
return nil, err
}
sigHash.Write(h.CloneBytes())
} else {
sigHash.Write(zeroHash[:])
}
// << hashJoinSplits
sigHash.Write(zeroHash[:])
// << hashShieldedSpends
if tx.Version == versionSapling {
sigHash.Write(zeroHash[:])
}
// << hashShieldedOutputs
if tx.Version == versionSapling {
sigHash.Write(zeroHash[:])
}
// << nLockTime
var lockTime [4]byte
binary.LittleEndian.PutUint32(lockTime[:], tx.LockTime)
sigHash.Write(lockTime[:])
// << nExpiryHeight
var expiryTime [4]byte
binary.LittleEndian.PutUint32(expiryTime[:], expiryHeight)
sigHash.Write(expiryTime[:])
// << valueBalance
if tx.Version == versionSapling {
var valueBalance [8]byte
binary.LittleEndian.PutUint64(valueBalance[:], 0)
sigHash.Write(valueBalance[:])
}
// << nHashType
var bHashType [4]byte
binary.LittleEndian.PutUint32(bHashType[:], uint32(hashType))
sigHash.Write(bHashType[:])
if idx != math.MaxUint32 {
// << prevout
// Next, write the outpoint being spent.
sigHash.Write(tx.TxIn[idx].PreviousOutPoint.Hash[:])
var bIndex [4]byte
binary.LittleEndian.PutUint32(bIndex[:], tx.TxIn[idx].PreviousOutPoint.Index)
sigHash.Write(bIndex[:])
// << scriptCode
// For p2wsh outputs, and future outputs, the script code is the
// original script, with all code separators removed, serialized
// with a var int length prefix.
// wire.WriteVarBytes(&sigHash, 0, subScript)
if err := wire.WriteVarBytes(&sigHash, 0, subScript); err != nil {
return nil, err
}
// << amount
// Next, add the input amount, and sequence number of the input being
// signed.
if err := binary.Write(&sigHash, binary.LittleEndian, amt); err != nil {
return nil, err
}
// << nSequence
var bSequence [4]byte
binary.LittleEndian.PutUint32(bSequence[:], tx.TxIn[idx].Sequence)
sigHash.Write(bSequence[:])
}
var h chainhash.Hash
if h, err = blake2b(sigHash.Bytes(), sighashKey(expiryHeight, network)); err != nil {
return nil, err
}
return h.CloneBytes(), nil
}
func blake2b(data, key []byte) (h chainhash.Hash, err error) {
hash, err := blake2.New(&blake2.Config{Person: key, Size: 32})
if err != nil {
return h, err
}
if _, err = hash.Write(data); err != nil {
return h, err
}
err = (&h).SetBytes(hash.Sum(nil))
return h, err
}
func sighashKey(activationHeight uint32, network *Params) []byte {
var i int
upgradeParams := network.Upgrades
for i = len(upgradeParams) - 1; i >= 0; i-- {
if activationHeight >= upgradeParams[i].ActivationHeight {
break
}
}
return append([]byte(blake2BSighash), upgradeParams[i].BranchID...)
}
// txSighashes computes, and returns the cached sighashes of the given
// transaction.
func txSighashes(tx *wire.MsgTx) (h *txscript.TxSigHashes, err error) {
h = &txscript.TxSigHashes{}
if h.HashPrevOuts, err = calculateHashPrevOuts(tx); err != nil {
return
}
if h.HashSequence, err = calculateHashSequence(tx); err != nil {
return
}
if h.HashOutputs, err = calculateHashOutputs(tx); err != nil {
return
}
return
}
// calculateHashPrevOuts calculates a single hash of all the previous
// outputs (txid:index) referenced within the passed transaction. This
// calculated hash can be re-used when validating all inputs spending segwit
// outputs, with a signature hash type of SigHashAll. This allows validation to
// re-use previous hashing computation, reducing the complexity of validating
// SigHashAll inputs from O(N^2) to O(N).
func calculateHashPrevOuts(tx *wire.MsgTx) (chainhash.Hash, error) {
var b bytes.Buffer
for _, in := range tx.TxIn {
// First write out the 32-byte transaction ID one of whose outputs are
// being referenced by this input.
b.Write(in.PreviousOutPoint.Hash[:])
// Next, we'll encode the index of the referenced output as a little
// endian integer.
var buf [4]byte
binary.LittleEndian.PutUint32(buf[:], in.PreviousOutPoint.Index)
b.Write(buf[:])
}
return blake2b(b.Bytes(), []byte(prevoutsHashPersonalization))
}
// calculateHashSequence computes an aggregated hash of each of the
// sequence numbers within the inputs of the passed transaction. This single
// hash can be re-used when validating all inputs spending segwit outputs, which
// include signatures using the SigHashAll sighash type. This allows validation
// to re-use previous hashing computation, reducing the complexity of validating
// SigHashAll inputs from O(N^2) to O(N).
func calculateHashSequence(tx *wire.MsgTx) (chainhash.Hash, error) {
var b bytes.Buffer
for _, in := range tx.TxIn {
var buf [4]byte
binary.LittleEndian.PutUint32(buf[:], in.Sequence)
b.Write(buf[:])
}
return blake2b(b.Bytes(), []byte(sequenceHashPersonalization))
}
// calculateHashOutputs computes a hash digest of all outputs created by
// the transaction encoded using the wire format. This single hash can be
// re-used when validating all inputs spending witness programs, which include
// signatures using the SigHashAll sighash type. This allows computation to be
// cached, reducing the total hashing complexity from O(N^2) to O(N).
func calculateHashOutputs(tx *wire.MsgTx) (_ chainhash.Hash, err error) {
var b bytes.Buffer
for _, out := range tx.TxOut {
if err = wire.WriteTxOut(&b, 0, 0, out); err != nil {
return chainhash.Hash{}, err
}
}
return blake2b(b.Bytes(), []byte(outputsHashPersonalization))
}
// writeTxOut encodes to into the bitcoin protocol encoding for a transaction
// output (TxOut) to w.
//
// NOTE: This function is exported in order to allow txscript to compute the
// new sighashes for witness transactions (BIP0143).
func writeTxOut(w io.Writer, pver uint32, version int32, to *wire.TxOut) error {
if err := binary.Write(w, binary.LittleEndian, uint64(to.Value)); err != nil {
return err
}
return writeVarBytes(w, pver, to.PkScript)
}
// writeTxIn encodes ti to the bitcoin protocol encoding for a transaction
// input (TxIn) to w.
func writeTxIn(w io.Writer, pver uint32, version int32, ti *wire.TxIn) error {
err := writeOutPoint(w, pver, version, &ti.PreviousOutPoint)
if err != nil {
return err
}
err = writeVarBytes(w, pver, ti.SignatureScript)
if err != nil {
return err
}
return binary.Write(w, binary.LittleEndian, ti.Sequence)
}
// writeOutPoint encodes op to the bitcoin protocol encoding for an OutPoint
// to w.
func writeOutPoint(w io.Writer, pver uint32, version int32, op *wire.OutPoint) error {
_, err := w.Write(op.Hash[:])
if err != nil {
return err
}
return binary.Write(w, binary.LittleEndian, op.Index)
}
// writeTxWitness encodes the bitcoin protocol encoding for a transaction
// input's witness into to w.
func writeTxWitness(w io.Writer, pver uint32, version int32, wit [][]byte) error {
err := writeVarInt(w, pver, uint64(len(wit)))
if err != nil {
return err
}
for _, item := range wit {
err = writeVarBytes(w, pver, item)
if err != nil {
return err
}
}
return nil
}
// writeVarInt serializes val to w using a variable number of bytes depending
// on its value.
func writeVarInt(w io.Writer, pver uint32, val uint64) error {
if val < 0xfd {
return binary.Write(w, binary.LittleEndian, uint8(val))
}
if val <= math.MaxUint16 {
err := binary.Write(w, binary.LittleEndian, 0xfd)
if err != nil {
return err
}
return binary.Write(w, binary.LittleEndian, uint16(val))
}
if val <= math.MaxUint32 {
err := binary.Write(w, binary.LittleEndian, 0xfe)
if err != nil {
return err
}
return binary.Write(w, binary.LittleEndian, uint32(val))
}
if err := binary.Write(w, binary.LittleEndian, 0xff); err != nil {
return err
}
return binary.Write(w, binary.LittleEndian, val)
}
// writeVarBytes serializes a variable length byte array to w as a varInt
// containing the number of bytes, followed by the bytes themselves.
func writeVarBytes(w io.Writer, pver uint32, bytes []byte) error {
slen := uint64(len(bytes))
err := writeVarInt(w, pver, slen)
if err != nil {
return err
}
_, err = w.Write(bytes)
return err
}
================================================
FILE: chain/zcash/utxo_test.go
================================================
package zcash_test
================================================
FILE: chain/zcash/zcash.go
================================================
package zcash
import (
"github.com/btcsuite/btcd/chaincfg"
)
const (
sighashMask = 0x1f
blake2BSighash = "ZcashSigHash"
prevoutsHashPersonalization = "ZcashPrevoutHash"
sequenceHashPersonalization = "ZcashSequencHash"
outputsHashPersonalization = "ZcashOutputsHash"
versionOverwinter int32 = 3
versionOverwinterGroupID uint32 = 0x3C48270
versionSapling = 4
versionSaplingGroupID = 0x892f2085
)
// Params signifies the chain specific parameters of the Zcash network.
type Params struct {
// TODO: We do not actually need to embed the entire chaincfg params object.
*chaincfg.Params
P2SHPrefix []byte
P2PKHPrefix []byte
Upgrades []ParamsUpgrade
}
// ParamsUpgrade ...
type ParamsUpgrade struct {
ActivationHeight uint32
BranchID []byte
}
var (
witnessMarkerBytes = []byte{0x00, 0x01}
// MainNetParams defines the mainnet configuration.
MainNetParams = Params{
Params: &chaincfg.MainNetParams,
P2PKHPrefix: []byte{0x1C, 0xB8},
P2SHPrefix: []byte{0x1C, 0xBD},
Upgrades: []ParamsUpgrade{
{0, []byte{0x00, 0x00, 0x00, 0x00}},
{347500, []byte{0x19, 0x1B, 0xA8, 0x5B}},
{419200, []byte{0xBB, 0x09, 0xB8, 0x76}},
{653600, []byte{0x60, 0x0E, 0xB4, 0x2B}},
{903000, []byte{0x0B, 0x23, 0xB9, 0xF5}},
{1046400, []byte{0xA6, 0x75, 0xFF, 0xE9}},
{1687104, []byte{0xB4, 0xD0, 0xD6, 0xC2}},
},
}
// TestNet3Params defines the testnet configuration.
TestNet3Params = Params{
Params: &chaincfg.TestNet3Params,
P2PKHPrefix: []byte{0x1D, 0x25},
P2SHPrefix: []byte{0x1C, 0xBA},
Upgrades: []ParamsUpgrade{
{0, []byte{0x00, 0x00, 0x00, 0x00}},
{207500, []byte{0x19, 0x1B, 0xA8, 0x5B}},
{280000, []byte{0xBB, 0x09, 0xB8, 0x76}},
{584000, []byte{0x60, 0x0E, 0xB4, 0x2B}},
{903800, []byte{0x0B, 0x23, 0xB9, 0xF5}},
{1028500, []byte{0xA6, 0x75, 0xFF, 0xE9}},
{1842420, []byte{0xB4, 0xD0, 0xD6, 0xC2}},
},
}
// RegressionNetParams defines a devet/regnet configuration.
RegressionNetParams = Params{
Params: &chaincfg.RegressionNetParams,
P2PKHPrefix: []byte{0x1D, 0x25},
P2SHPrefix: []byte{0x1C, 0xBA},
Upgrades: []ParamsUpgrade{
{0, []byte{0x00, 0x00, 0x00, 0x00}},
{10, []byte{0x19, 0x1B, 0xA8, 0x5B}},
{20, []byte{0xBB, 0x09, 0xB8, 0x76}},
{30, []byte{0x60, 0x0E, 0xB4, 0x2B}},
{40, []byte{0x0B, 0x23, 0xB9, 0xF5}},
{50, []byte{0xA6, 0x75, 0xFF, 0xE9}},
{60, []byte{0xB4, 0xD0, 0xD6, 0xC2}},
},
}
)
================================================
FILE: chain/zcash/zcash_suite_test.go
================================================
package zcash_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestZcash(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Zcash Suite")
}
================================================
FILE: chain/zcash/zcash_test.go
================================================
package zcash_test
import (
"context"
"log"
"os"
"reflect"
"time"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/multichain/chain/zcash"
"github.com/renproject/pack"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Zcash", func() {
Context("when submitting transactions", func() {
Context("when sending ZEC to multiple addresses", func() {
It("should work", func() {
// Load private key, and assume that the associated address has
// funds to spend. You can do this by setting ZCASH_PK to
// the value specified in the `./multichaindeploy/.env` file.
pkEnv := os.Getenv("ZCASH_PK")
if pkEnv == "" {
panic("ZCASH_PK is undefined")
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).ToNot(HaveOccurred())
// PKH
pkhAddr, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()), &zcash.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
pkhAddrUncompressed, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &zcash.RegressionNetParams)
Expect(err).ToNot(HaveOccurred())
log.Printf("PKH %v", pkhAddr.EncodeAddress())
log.Printf("PKH (uncompressed) %v", pkhAddrUncompressed.EncodeAddress())
// Setup the client and load the unspent transaction outputs.
client := zcash.NewClient(zcash.DefaultClientOptions())
outputs, err := client.UnspentOutputs(context.Background(), 0, 999999999, address.Address(pkhAddr.EncodeAddress()))
Expect(err).ToNot(HaveOccurred())
Expect(len(outputs)).To(BeNumerically(">", 0))
output := outputs[0]
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err := client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Build the transaction by consuming the outputs and spending
// them to a set of recipients.
inputs := []utxo.Input{
{Output: output},
}
recipients := []utxo.Recipient{
{
To: address.Address(pkhAddr.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
{
To: address.Address(pkhAddrUncompressed.EncodeAddress()),
Value: pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 2)),
},
}
tx, err := zcash.NewTxBuilder(&zcash.RegressionNetParams, 1000000).BuildTx(inputs, recipients)
Expect(err).ToNot(HaveOccurred())
// Get the digests that need signing from the transaction, and
// sign them. In production, this would be done using the RZL
// MPC algorithm, but for the purposes of this test, using an
// explicit privkey is ok.
sighashes, err := tx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(tx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the transaction to the Bitcoin Cash node. Again, this
// should be running a la `./multichaindeploy`.
txHash, err := tx.Hash()
Expect(err).ToNot(HaveOccurred())
err = client.SubmitTx(context.Background(), tx)
Expect(err).ToNot(HaveOccurred())
log.Printf("TXID %v", txHash)
// Zcash nodes are a little slow, so we wait for 1000 ms before
// beginning to check confirmations.
time.Sleep(1 * time.Second)
for {
// Loop until the transaction has at least a few
// confirmations. This implies that the transaction is
// definitely valid, and the test has passed. We were
// successfully able to use the multichain to construct and
// submit a Bitcoin Cash transaction!
confs, err := client.Confirmations(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
log.Printf(" %v/3 confirmations", confs)
if confs >= 3 {
break
}
time.Sleep(10 * time.Second)
}
// Check that we can load the output and that it is equal.
// Otherwise, something strange is happening with the RPC
// client.
output2, _, err = client.Output(context.Background(), output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Check we can get the transaction inputs
senders, err := client.TxSenders(context.Background(), txHash)
Expect(err).ToNot(HaveOccurred())
Expect(len(senders)).Should(Equal(1))
Expect(senders[0]).Should(Equal(pkhAddr.EncodeAddress()))
})
})
})
})
================================================
FILE: go.mod
================================================
module github.com/renproject/multichain
go 1.16
require (
github.com/btcsuite/btcd v0.22.1
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-sdk v0.44.0
github.com/dchest/blake2b v1.0.0
github.com/ethereum/go-ethereum v1.10.23
github.com/filecoin-project/go-address v0.0.5
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48
github.com/filecoin-project/lotus v1.10.0
github.com/filecoin-project/specs-actors v0.9.13
github.com/ipfs/go-cid v0.0.7
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/multiformats/go-varint v0.0.6
github.com/near/borsh-go v0.3.0
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
github.com/renproject/id v0.4.2
github.com/renproject/pack v0.2.5
github.com/renproject/solana-ffi v0.1.2
github.com/renproject/surge v1.2.6
github.com/tendermint/tendermint v0.34.12
github.com/terra-money/core v0.5.5
github.com/tyler-smith/go-bip39 v1.1.0
go.uber.org/zap v1.17.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
)
replace github.com/filecoin-project/filecoin-ffi => ./chain/filecoin/filecoin-ffi
replace github.com/renproject/solana-ffi => ./chain/solana/solana-ffi
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
================================================
FILE: go.sum
================================================
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw=
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
contrib.go.opencensus.io/exporter/jaeger v0.1.0/go.mod h1:VYianECmuFPwU37O699Vc1GOcy+y8kOsfaxHRImmjbA=
contrib.go.opencensus.io/exporter/prometheus v0.1.0 h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI=
filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/99designs/keyring v1.1.6 h1:kVDC2uCgVwecxCk+9zoCt2uEL6dt+dfVzMvGgnVcIuM=
github.com/99designs/keyring v1.1.6/go.mod h1:16e0ds7LGQQcT59QqkTg72Hh5ShM51Byv5PEmW6uoRU=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo=
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmWasm/wasmvm v0.16.0 h1:87jyCTcCpuSx7a8s5ed9N/E/XV13XZflxa0/OplwSmA=
github.com/CosmWasm/wasmvm v0.16.0/go.mod h1:Id107qllDJyJjVQQsKMOy2YYF98sqPJ2t+jX1QES40A=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0 h1:KkI6O9uMaQU3VEKaj01ulavtF7o1fWT7+pk/4voiMLQ=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee/go.mod h1:W0GbEAA4uFNYOGG2cJpmFJ04E6SD1NLELPYZB57/7AY=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y=
github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2oc2f4tzPWic=
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/Stebalien/go-bitfield v0.0.0-20180330043415-076a62f9ce6e/go.mod h1:3oM7gXIttpYDAJXpVNnSCiUMYBLIZ6cb1t+Ip982MRo=
github.com/Stebalien/go-bitfield v0.0.1 h1:X3kbSSPUaJK60wV2hjOPZwmpljr6VGCqdq4cBLhbQBo=
github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s=
github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o=
github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI=
github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/alecthomas/jsonschema v0.0.0-20200530073317-71f438968921/go.mod h1:/n6+1/DWPltRLWL/VKyUxg6tzsl5kHUCcraimt4vr60=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18=
github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.32.11/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo=
github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y=
github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8=
github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4=
github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0=
github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM=
github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw=
github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg=
github.com/benbjohnson/clock v1.0.1/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg=
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/briandowns/spinner v1.11.1/go.mod h1:QOuQk7x+EaDASo80FEXwlwiA+j/PPIcX3FScO+3/ZPQ=
github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ=
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0=
github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.0.0-20190605094302-a0d1e3e36d50/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94=
github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA=
github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c=
github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U=
github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/cockroachdb/pebble v0.0.0-20200916222308-4e219a90ba5b/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ=
github.com/cockroachdb/pebble v0.0.0-20201001221639-879f3bfeef07/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ=
github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
github.com/coinbase/rosetta-sdk-go v0.6.10 h1:rgHD/nHjxLh0lMEdfGDqpTtlvtSBwULqrrZ2qPdNaCM=
github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo=
github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8=
github.com/confio/ics23/go v0.6.6/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ=
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q=
github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-semver v0.2.1-0.20180108230905-e214231b295a/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/corpix/uarand v0.1.1/go.mod h1:SFKZvkcRoLqVRFZ4u25xPmp6m9ktANfbpXZ7SJ0/FNU=
github.com/cosmos/cosmos-sdk v0.44.0 h1:eOSjACNtTnThEJ62IsS+pMm3OIU6hgMVqrp4TZClLZo=
github.com/cosmos/cosmos-sdk v0.44.0/go.mod h1:orG0jzFJ2KsDfzLd/X0JSOMzF4Oxc/BQz2GkcYF4gRE=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE=
github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I=
github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4=
github.com/cosmos/iavl v0.16.0 h1:ICIOB8xysirTX27GmVAaoeSpeozzgSu9d49w36xkVJA=
github.com/cosmos/iavl v0.16.0/go.mod h1:2A8O/Jz9YwtjqXMO0CjnnbTYEEaovE8jWcwrakH3PoE=
github.com/cosmos/ibc-go v1.1.0 h1:qtiBbiFR1hbxQ0h66FbjTZnzUjZNpndHghl9gZcoZjY=
github.com/cosmos/ibc-go v1.1.0/go.mod h1:1y0rXG5xsOIrmVGb0pv1poYbiTW+1cz4GX0VGDwJAgA=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg=
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0=
github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU=
github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U=
github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4=
github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f h1:BOaYiTvg8p9vBUXpklC22XSK/mifLF7lG9jtmYYi3Tc=
github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f/go.mod h1:rQYf4tfk5sSwFsnDg3qYaBxSjsD9S8+59vW0dKUgme4=
github.com/dchest/blake2b v1.0.0 h1:KK9LimVmE0MjRl9095XJmKqZ+iLxWATvlcpVFRtaw6s=
github.com/dchest/blake2b v1.0.0/go.mod h1:U034kXgbJpCle2wSk5ybGIVhOSHCVLMDqOzcPEA0F7s=
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M=
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e h1:lj77EKYUpYXTd8CD/+QMIf8b6OIOTsfEBSXiAzuEHTU=
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e/go.mod h1:3ZQK6DMPSz/QZ73jlWxBtUhNA8xZx7LzUFSq/OfP8vk=
github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ=
github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgraph-io/badger v1.6.1 h1:w9pSFNSdq/JPM1N12Fz/F/bzo993Is1W+Q7HjPzi7yg=
github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU=
github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE=
github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k=
github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE=
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI=
github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ=
github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA=
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
github.com/drand/bls12-381 v0.3.2/go.mod h1:dtcLgPtYT38L3NO6mPDYH0nbpc5tjPassDqiniuAt4Y=
github.com/drand/drand v1.2.1/go.mod h1:j0P7RGmVaY7E/OuO2yQOcQj7OgeZCuhgu2gdv0JAm+g=
github.com/drand/kyber v1.0.1-0.20200110225416-8de27ed8c0e2/go.mod h1:UpXoA0Upd1N9l4TvRPHr1qAUBBERj6JQ/mnKI3BPEmw=
github.com/drand/kyber v1.0.2/go.mod h1:x6KOpK7avKj0GJ4emhXFP5n7M7W7ChAPmnQh/OL6vRw=
github.com/drand/kyber v1.1.4/go.mod h1:9+IgTq7kadePhZg7eRwSD7+bA+bmvqRK+8DtmoV5a3U=
github.com/drand/kyber-bls12381 v0.2.0/go.mod h1:zQip/bHdeEB6HFZSU3v+d3cQE0GaBVQw9aR2E7AdoeI=
github.com/drand/kyber-bls12381 v0.2.1/go.mod h1:JwWn4nHO9Mp4F5qCie5sVIPQZ0X6cw8XAeMRvc/GXBE=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b h1:HBah4D48ypg3J7Np4N+HY/ZR76fx3HEUGxDU6Uk39oQ=
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM=
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elastic/go-sysinfo v1.3.0 h1:eb2XFGTMlSwG/yyU9Y8jVAYLIzU2sFzWXwo2gmetyrE=
github.com/elastic/go-sysinfo v1.3.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY=
github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU=
github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/ema/qdisc v0.0.0-20190904071900-b82c76788043/go.mod h1:ix4kG2zvdUd8kEKSW0ZTr1XLks0epFpI4j745DXxlNE=
github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 h1:2vLKys4RBU4pn2T/hjXMbvwTr1Cvy5THHrQkbeY9HRk=
github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25/go.mod h1:hTr8+TLQmkUkgcuh3mcr5fjrT9c64ZzsBCdCEC6UppY=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etclabscore/go-jsonschema-walk v0.0.6/go.mod h1:VdfDY72AFAiUhy0ZXEaWSpveGjMT5JcDIm903NGqFwQ=
github.com/etclabscore/go-openrpc-reflect v0.0.36/go.mod h1:0404Ky3igAasAOpyj1eESjstTyneBAIk5PgJFbK4s5E=
github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY=
github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM=
github.com/ethereum/go-ethereum v1.10.23 h1:Xk8XAT4/UuqcjMLIMF+7imjkg32kfVFKoeyQDaO2yWM=
github.com/ethereum/go-ethereum v1.10.23/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 h1:BBso6MBKW8ncyZLv37o+KNyy0HrrHgfnOaGQC2qvN+A=
github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5/go.mod h1:JpoxHjuQauoxiFMl1ie8Xc/7TfLuMZ5eOCONd1sUBHg=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y=
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
github.com/filecoin-project/go-address v0.0.5 h1:SSaFT/5aLfPXycUlFyemoHYhRgdyXClXCyDdNJKPlDM=
github.com/filecoin-project/go-address v0.0.5/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs=
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349 h1:pIuR0dnMD0i+as8wNnjjHyQrnhP5O5bmba/lmgQeRgU=
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20201006184820-924ee87a1349/go.mod h1:vgmwKBkx+ca5OIeEvstiQgzAZnb7R6QaqE1oEDSqa6g=
github.com/filecoin-project/go-amt-ipld/v3 v3.0.0/go.mod h1:Qa95YNAbtoVCTSVtX38aAC1ptBnJfPma1R/zZsKmx4o=
github.com/filecoin-project/go-amt-ipld/v3 v3.1.0 h1:ZNJ9tEG5bE72vBWYiuh5bkxJVM3ViHNOmQ7qew9n6RE=
github.com/filecoin-project/go-amt-ipld/v3 v3.1.0/go.mod h1:UjM2QhDFrrjD5s1CdnkJkat4ga+LqZBZgTMniypABRo=
github.com/filecoin-project/go-bitfield v0.2.0/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-bitfield v0.2.3/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-bitfield v0.2.4 h1:uZ7MeE+XfM5lqrHJZ93OnhQKc/rveW8p9au0C68JPgk=
github.com/filecoin-project/go-bitfield v0.2.4/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 h1:av5fw6wmm58FYMgJeoB/lK9XXrgdugYiTqkdxjTy9k8=
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2/go.mod h1:pqTiPHobNkOVM5thSRsHYjyQfq7O5QSCMhvuu9JoDlg=
github.com/filecoin-project/go-commp-utils v0.0.0-20201119054358-b88f7a96a434/go.mod h1:6s95K91mCyHY51RPWECZieD3SGWTqIFLf1mPOes9l5U=
github.com/filecoin-project/go-commp-utils v0.1.0 h1:PaDxoXYh1TXnnz5kA/xSObpAQwcJSUs4Szb72nuaNdk=
github.com/filecoin-project/go-commp-utils v0.1.0/go.mod h1:6s95K91mCyHY51RPWECZieD3SGWTqIFLf1mPOes9l5U=
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus=
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ=
github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo=
github.com/filecoin-project/go-data-transfer v1.4.3 h1:ECEw69NOfmEZ7XN1NSBvj3KTbbH2mIczQs+Z2w4bD7c=
github.com/filecoin-project/go-data-transfer v1.4.3/go.mod h1:n8kbDQXWrY1c4UgfMa9KERxNCWbOTDwdNhf2MpN9dpo=
github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ=
github.com/filecoin-project/go-ds-versioning v0.1.0/go.mod h1:mp16rb4i2QPmxBnmanUx8i/XANp+PFCCJWiAb+VW4/s=
github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg=
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c=
github.com/filecoin-project/go-fil-markets v1.2.5 h1:bQgtXbwxKyPxSEQoUI5EaTHJ0qfzyd5NosspuADCm6Y=
github.com/filecoin-project/go-fil-markets v1.2.5/go.mod h1:7JIqNBmFvOyBzk/EiPYnweVdQnWhshixb5B9b1653Ag=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+eEvrDCGJoPLxFpDynFjYfBjI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec h1:rGI5I7fdU4viManxmDdbk5deZO7afe6L1Wc04dAmlOM=
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-multistore v0.0.3 h1:vaRBY4YiA2UZFPK57RNuewypB8u0DzzQwqsL0XarpnI=
github.com/filecoin-project/go-multistore v0.0.3/go.mod h1:kaNqCC4IhU4B1uyr7YWFHd23TL4KM32aChS0jNkyUvQ=
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20 h1:+/4aUeUoKr6AKfPE3mBhXA5spIV6UcKdTYDPNU2Tdmg=
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak=
github.com/filecoin-project/go-paramfetch v0.0.2-0.20210614165157-25a6c7769498 h1:G10ezOvpH1CLXQ19EA9VWNwyL0mg536ujSayjV0yg0k=
github.com/filecoin-project/go-paramfetch v0.0.2-0.20210614165157-25a6c7769498/go.mod h1:1FH85P8U+DUEmWk1Jkw3Bw7FrwTVUNHk/95PSPG+dts=
github.com/filecoin-project/go-state-types v0.0.0-20200903145444-247639ffa6ad/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I=
github.com/filecoin-project/go-state-types v0.0.0-20200904021452-1883f36ca2f4/go.mod h1:IQ0MBPnonv35CJHtWSN3YY1Hz2gkPru1Q9qoaYLxx9I=
github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48 h1:Jc4OprDp3bRDxbsrXNHPwJabZJM3iDy+ri8/1e0ZnX4=
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe h1:dF8u+LEWeIcTcfUcCf3WFVlc81Fr2JKg8zPzIbBDKDw=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/filecoin-project/go-statestore v0.1.1 h1:ufMFq00VqnT2CAuDpcGnwLnCX1I/c3OROw/kXVNSTZk=
github.com/filecoin-project/go-statestore v0.1.1/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8=
github.com/filecoin-project/lotus v1.10.0 h1:pZX+yVteyBQqLzfQq/5x6aEKrlR+po8OVf8syg8lgWw=
github.com/filecoin-project/lotus v1.10.0/go.mod h1:GjqPFYGMIy4x+2FLA6m8Oa2+21sqewHRPZv9TcAgHaU=
github.com/filecoin-project/specs-actors v0.9.4/go.mod h1:BStZQzx5x7TmCkLv0Bpa07U6cPKol6fd3w9KjMPZ6Z4=
github.com/filecoin-project/specs-actors v0.9.12/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
github.com/filecoin-project/specs-actors v0.9.13 h1:rUEOQouefi9fuVY/2HOroROJlZbOzWYXXeIh41KF2M4=
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
github.com/filecoin-project/specs-actors/v2 v2.0.1/go.mod h1:v2NZVYinNIKA9acEMBm5wWXxqv5+frFEbekBFemYghY=
github.com/filecoin-project/specs-actors/v2 v2.3.2/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y=
github.com/filecoin-project/specs-actors/v2 v2.3.5-0.20210114162132-5b58b773f4fb h1:orr/sMzrDZUPAveRE+paBdu1kScIUO5zm+HYeh+VlhA=
github.com/filecoin-project/specs-actors/v2 v2.3.5-0.20210114162132-5b58b773f4fb/go.mod h1:LljnY2Mn2homxZsmokJZCpRuhOPxfXhvcek5gWkmqAc=
github.com/filecoin-project/specs-actors/v3 v3.1.0 h1:s4qiPw8pgypqBGAy853u/zdZJ7K9cTZdM1rTiSonHrg=
github.com/filecoin-project/specs-actors/v3 v3.1.0/go.mod h1:mpynccOLlIRy0QnR008BwYBwT9fen+sPR13MA1VmMww=
github.com/filecoin-project/specs-actors/v4 v4.0.0 h1:vMALksY5G3J5rj3q9rbcyB+f4Tk1xrLqSgdB3jOok4s=
github.com/filecoin-project/specs-actors/v4 v4.0.0/go.mod h1:TkHXf/l7Wyw4ZejyXIPS2rK8bBO0rdwhTZyQQgaglng=
github.com/filecoin-project/specs-actors/v5 v5.0.0-20210512015452-4fe3889fff57/go.mod h1:283yBMMUSDB2abcjP/hhrwTkhb9h3sfM6KGrep/ZlBI=
github.com/filecoin-project/specs-actors/v5 v5.0.1 h1:PrYm5AKdMlJ/55eRW5laWcnaX66gyyDYBWvH38kNAMo=
github.com/filecoin-project/specs-actors/v5 v5.0.1/go.mod h1:74euMDIXorusOBs/QL/LNkYsXZdDpLJwojWw6T03pdE=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g=
github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E=
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY=
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1/go.mod h1:0eHX/BVySxPc6SE2mZRoppGq7qcEagxdmQnA3dzork8=
github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo=
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/spec v0.19.7/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
github.com/go-openapi/spec v0.19.11/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.8/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0=
github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic=
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
github.com/gogo/status v1.0.3/go.mod h1:SavQ51ycCLnc7dGyJxp8YAmudx8xqiVrRf+6IXRsugc=
github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM=
github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog=
github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM=
github.com/google/gopacket v1.1.18 h1:lum7VRA9kdlvBi7/v2p7/zcbkduHaCH/SVVyurs7OpY=
github.com/google/gopacket v1.1.18/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us=
github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk=
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw=
github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
github.com/gxed/go-shellwords v1.0.3/go.mod h1:N7paucT91ByIjmVJHhvoarjoQnmsi3Jd3vH7VqgtMxQ=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/gxed/pubsub v0.0.0-20180201040156-26ebdf44f824/go.mod h1:OiEWyHgK+CWrmOlVquHaIK1vhpUJydC9m0Je6mhaiNE=
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE=
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1 h1:F9k+7wv5OIk1zcq23QpdiL0hfDuXPjuOmMNaC6fgQ0Q=
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1/go.mod h1:jvfsLIxk0fY/2BKSQ1xf2406AKA5dwMmKKv0ADcOfN8=
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e h1:3YKHER4nmd7b5qy5t0GWDTwSn4OyRgfAXSmo6VnryBY=
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e/go.mod h1:I8h3MITA53gN9OnWGCgaMa0JWVRdXthWw4M3CPM54OY=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM=
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg=
github.com/hodgesds/perf-utils v0.0.8/go.mod h1:F6TfvsbtrF88i++hou29dTXlI2sfsJv+gRZDtmTJkAs=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM=
github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag=
github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ=
github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y=
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
github.com/iancoleman/orderedmap v0.1.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo=
github.com/improbable-eng/grpc-web v0.14.0 h1:GdoK+cXABdB+1keuqsV1drSFO2XLYIxqt/4Rj8SWGBk=
github.com/improbable-eng/grpc-web v0.14.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY=
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI=
github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk=
github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE=
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8=
github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE=
github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0=
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po=
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/go-bitswap v0.0.3/go.mod h1:jadAZYsP/tcRMl47ZhFxhaNuDQoXawT8iHMg+iFoQbg=
github.com/ipfs/go-bitswap v0.0.9/go.mod h1:kAPf5qgn2W2DrgAcscZ3HrM9qh4pH+X8Fkk3UPrwvis=
github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSAE1wsxj0=
github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs=
github.com/ipfs/go-bitswap v0.1.8/go.mod h1:TOWoxllhccevbWFUR2N7B1MTSVVge1s6XSMiCSA4MzM=
github.com/ipfs/go-bitswap v0.3.2 h1:TdKx7lpidYe2dMAKfdeNS26y6Pc/AZX/i8doI1GV210=
github.com/ipfs/go-bitswap v0.3.2/go.mod h1:AyWWfN3moBzQX0banEtfKOfbXb3ZeoOeXnZGNPV9S6w=
github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc=
github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk=
github.com/ipfs/go-blockservice v0.0.3/go.mod h1:/NNihwTi6V2Yr6g8wBI+BSwPuURpBRMtYNGrlxZ8KuI=
github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbRhbvNSdgc/7So=
github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M=
github.com/ipfs/go-blockservice v0.1.3/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU=
github.com/ipfs/go-blockservice v0.1.4-0.20200624145336-a978cec6e834/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU=
github.com/ipfs/go-blockservice v0.1.4 h1:Vq+MlsH8000KbbUciRyYMEw/NNP8UAGmcqKi4uWmFGA=
github.com/ipfs/go-blockservice v0.1.4/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10/go.mod h1:/BYOuUoxkE+0f6tGzlzMvycuN+5l35VOR4Bpg2sCmds=
github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M=
github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY=
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
github.com/ipfs/go-cidutil v0.0.2/go.mod h1:ewllrvrxG6AMYStla3GD7Cqn+XYSLqjK0vc+086tB6s=
github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
github.com/ipfs/go-datastore v0.0.5/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE=
github.com/ipfs/go-datastore v0.1.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw=
github.com/ipfs/go-datastore v0.3.0/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw=
github.com/ipfs/go-datastore v0.3.1/go.mod h1:w38XXW9kVFNp57Zj5knbKWM2T+KOZCGDRVNdgPHtbHw=
github.com/ipfs/go-datastore v0.4.0/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA=
github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA=
github.com/ipfs/go-datastore v0.4.2/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA=
github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA=
github.com/ipfs/go-datastore v0.4.5 h1:cwOUcGMLdLPWgu3SlrCckCMznaGADbPqE0r8h768/Dg=
github.com/ipfs/go-datastore v0.4.5/go.mod h1:eXTcaaiN6uOlVCLS9GjJUJtlvJfM3xk23w3fyfrmmJs=
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8=
github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s=
github.com/ipfs/go-ds-badger v0.0.7/go.mod h1:qt0/fWzZDoPW6jpQeqUjR5kBfhDNB65jd9YlmAvpQBk=
github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9DrGVwx/NOwE=
github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk=
github.com/ipfs/go-ds-badger2 v0.1.0/go.mod h1:pbR1p817OZbdId9EvLOhKBgUVTM3BMCSTan78lDDVaw=
github.com/ipfs/go-ds-badger2 v0.1.1-0.20200708190120-187fc06f714e/go.mod h1:lJnws7amT9Ehqzta0gwMrRsURU04caT0iRPr1W8AsOU=
github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc=
github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8=
github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s=
github.com/ipfs/go-ds-leveldb v0.4.2/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s=
github.com/ipfs/go-ds-measure v0.1.0/go.mod h1:1nDiFrhLlwArTME1Ees2XaBOl49OoCgd2A3f8EchMSY=
github.com/ipfs/go-ds-pebble v0.0.2-0.20200921225637-ce220f8ac459/go.mod h1:oh4liWHulKcDKVhCska5NLelE3MatWl+1FwSz3tY91g=
github.com/ipfs/go-filestore v1.0.0 h1:QR7ekKH+q2AGiWDc7W2Q0qHuYSRZGUJqUn0GsegEPb0=
github.com/ipfs/go-filestore v1.0.0/go.mod h1:/XOCuNtIe2f1YPbiXdYvD0BKLA0JR1MgPiFOdcuu9SM=
github.com/ipfs/go-fs-lock v0.0.6 h1:sn3TWwNVQqSeNjlWy6zQ1uUGAZrV3hPOyEA6y1/N2a0=
github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28L7zESmM=
github.com/ipfs/go-graphsync v0.1.0/go.mod h1:jMXfqIEDFukLPZHqDPp8tJMbHO9Rmeb9CEGevngQbmE=
github.com/ipfs/go-graphsync v0.4.2/go.mod h1:/VmbZTUdUMTbNkgzAiCEucIIAU3BkLE2cZrDCVUhyi0=
github.com/ipfs/go-graphsync v0.4.3/go.mod h1:mPOwDYv128gf8gxPFgXnz4fNrSYPsWyqisJ7ych+XDY=
github.com/ipfs/go-graphsync v0.6.0 h1:x6UvDUGA7wjaKNqx5Vbo7FGT8aJ5ryYA0dMQ5jN3dF0=
github.com/ipfs/go-graphsync v0.6.0/go.mod h1:e2ZxnClqBBYAtd901g9vXMJzS47labjAtOzsWtOzKNk=
github.com/ipfs/go-hamt-ipld v0.1.1/go.mod h1:1EZCr2v0jlCnhpa+aZ0JZYp8Tt2w16+JJOAVz17YcDk=
github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08=
github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2IsfTduLl+422H6Rqw=
github.com/ipfs/go-ipfs-blockstore v0.1.4/go.mod h1:Jxm3XMVjh6R17WvxFEiyKBLUGr86HgIYJW/D/MwqeYQ=
github.com/ipfs/go-ipfs-blockstore v1.0.0/go.mod h1:knLVdhVU9L7CC4T+T4nvGdeUIPAXlnd9zmXfp+9MIjU=
github.com/ipfs/go-ipfs-blockstore v1.0.1/go.mod h1:MGNZlHNEnR4KGgPHM3/k8lBySIOK2Ve+0KjZubKlaOE=
github.com/ipfs/go-ipfs-blockstore v1.0.3 h1:RDhK6fdg5YsonkpMuMpdvk/pRtOQlrIRIybuQfkvB2M=
github.com/ipfs/go-ipfs-blockstore v1.0.3/go.mod h1:MGNZlHNEnR4KGgPHM3/k8lBySIOK2Ve+0KjZubKlaOE=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk=
github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-cmds v0.1.0 h1:0CEde9EcxByej8+L6d1PST57J4ambRPyCTjLG5Ymou8=
github.com/ipfs/go-ipfs-cmds v0.1.0/go.mod h1:TiK4e7/V31tuEb8YWDF8lN3qrnDH+BS7ZqWIeYJlAs8=
github.com/ipfs/go-ipfs-config v0.0.11 h1:5/4nas2CQXiKr2/MLxU24GDGTBvtstQIQezuk7ltOQQ=
github.com/ipfs/go-ipfs-config v0.0.11/go.mod h1:wveA8UT5ywN26oKStByzmz1CO6cXwLKKM6Jn/Hfw08I=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo=
github.com/ipfs/go-ipfs-ds-help v0.1.1/go.mod h1:SbBafGJuGsPI/QL3j9Fc5YPLeAu+SzOkI0gFwAg+mOs=
github.com/ipfs/go-ipfs-ds-help v1.0.0 h1:bEQ8hMGs80h0sR8O4tfDgV6B01aaF9qeTrujrTLYV3g=
github.com/ipfs/go-ipfs-ds-help v1.0.0/go.mod h1:ujAbkeIgkKAWtxxNkoZHWLCyk5JpPoKnGyCcsoF6ueE=
github.com/ipfs/go-ipfs-exchange-interface v0.0.1 h1:LJXIo9W7CAmugqI+uofioIpRb6rY30GUu7G6LUfpMvM=
github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFquVtVHkO9b9Ob3FG91qJnWCM=
github.com/ipfs/go-ipfs-exchange-offline v0.0.1 h1:P56jYKZF7lDDOLx5SotVh5KFxoY6C81I1NSHW1FxGew=
github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0=
github.com/ipfs/go-ipfs-files v0.0.2/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.8 h1:8o0oFJkJ8UkO/ABl8T6ac6tKF3+NIpj67aAB6ZpusRg=
github.com/ipfs/go-ipfs-files v0.0.8/go.mod h1:wiN/jSG8FKyk7N0WyctKSvq3ljIa2NNTiZB55kpTdOs=
github.com/ipfs/go-ipfs-flags v0.0.1/go.mod h1:RnXBb9WV53GSfTrSDVK61NLTFKvWc60n+K9EgCDh+rA=
github.com/ipfs/go-ipfs-http-client v0.0.5 h1:niW5M0qqa0O/VRCAzr3f5Y7i3MjTpf0lhpkisjRtHR8=
github.com/ipfs/go-ipfs-http-client v0.0.5/go.mod h1:8EKP9RGUrUex4Ff86WhnKU7seEBOtjdgXlY9XHYvYMw=
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY=
github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY=
github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY=
github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs=
github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ=
github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY=
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ=
github.com/ipfs/go-ipld-cbor v0.0.1/go.mod h1:RXHr8s4k0NE0TKhnrxqZC9M888QfsBN9rhS5NjfKzY8=
github.com/ipfs/go-ipld-cbor v0.0.2/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc=
github.com/ipfs/go-ipld-cbor v0.0.3/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc=
github.com/ipfs/go-ipld-cbor v0.0.4/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
github.com/ipfs/go-ipld-cbor v0.0.5 h1:ovz4CHKogtG2KB/h1zUp5U0c/IzZrL435rCh5+K/5G8=
github.com/ipfs/go-ipld-cbor v0.0.5/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL37mwA=
github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs=
github.com/ipfs/go-ipns v0.0.2/go.mod h1:WChil4e0/m9cIINWLxZe1Jtf77oz5L05rO2ei/uKJ5U=
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA=
github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I=
github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk=
github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A=
github.com/ipfs/go-log v1.0.4 h1:6nLQdX4W8P9yZZFH7mO+X/PzjN8Laozm/lMJ6esdgzY=
github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs=
github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0=
github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0=
github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0=
github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw=
github.com/ipfs/go-log/v2 v2.0.8/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw=
github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk=
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
github.com/ipfs/go-merkledag v0.0.3/go.mod h1:Oc5kIXLHokkE1hWGMBHw+oxehkAaTOqtEb7Zbh6BhLA=
github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto=
github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
github.com/ipfs/go-merkledag v0.3.1/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
github.com/ipfs/go-merkledag v0.3.2 h1:MRqj40QkrWkvPswXs4EfSslhZ4RVPRbxwX11js0t1xY=
github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-metrics-prometheus v0.0.2/go.mod h1:ELLU99AQQNi+zX6GCGm2lAgnzdSH3u5UVlCdqSXnEks=
github.com/ipfs/go-path v0.0.3/go.mod h1:zIRQUez3LuQIU25zFjC2hpBTHimWx7VK5bjZgRLbbdo=
github.com/ipfs/go-path v0.0.7 h1:H06hKMquQ0aYtHiHryOMLpQC1qC3QwXwkahcEVD51Ho=
github.com/ipfs/go-path v0.0.7/go.mod h1:6KTKmeRnBXgqrTvzFrPV3CamxcgvXX/4z79tfAd2Sno=
github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ=
github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=
github.com/ipfs/go-peertaskqueue v0.2.0 h1:2cSr7exUGKYyDeUyQ7P/nHPs9P7Ht/B+ROrpN1EJOjc=
github.com/ipfs/go-peertaskqueue v0.2.0/go.mod h1:5/eNrBEbtSKWCG+kQK8K8fGNixoYUnr+P7jivavs9lY=
github.com/ipfs/go-todocounter v0.0.1/go.mod h1:l5aErvQc8qKE2r7NDMjmq5UNAvuZy0rC8BHOplkWvZ4=
github.com/ipfs/go-unixfs v0.0.4/go.mod h1:eIo/p9ADu/MFOuyxzwU+Th8D6xoxU//r590vUpWyfz8=
github.com/ipfs/go-unixfs v0.2.1/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k=
github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k=
github.com/ipfs/go-unixfs v0.2.4 h1:6NwppOXefWIyysZ4LR/qUBPvXd5//8J3jiMdvpbw6Lo=
github.com/ipfs/go-unixfs v0.2.4/go.mod h1:SUdisfUjNoSDzzhGVxvCL9QO/nKdwXdr+gbMUdqcbYw=
github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E=
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
github.com/ipfs/interface-go-ipfs-core v0.2.3 h1:E6uQ+1fJjkxJWlL9lAE72a5FWeyeeNL3GitLy8+jq3Y=
github.com/ipfs/interface-go-ipfs-core v0.2.3/go.mod h1:Tihp8zxGpUeE3Tokr94L6zWZZdkRQvG5TL6i9MuNE+s=
github.com/ipfs/iptb v1.4.0 h1:YFYTrCkLMRwk/35IMyC6+yjoQSHTEcNcefBStLJzgvo=
github.com/ipfs/iptb v1.4.0/go.mod h1:1rzHpCYtNp87/+hTxG5TfCVn/yMY3dKnLn8tBiMfdmg=
github.com/ipfs/iptb-plugins v0.2.1 h1:au4HWn9/pRPbkxA08pDx2oRAs4cnbgQWgV0teYXuuGA=
github.com/ipfs/iptb-plugins v0.2.1/go.mod h1:QXMbtIWZ+jRsW8a4h13qAKU7jcM7qaittO8wOsTP0Rs=
github.com/ipld/go-car v0.1.0/go.mod h1:RCWzaUh2i4mOEkB3W45Vc+9jnS/M6Qay5ooytiBHl3g=
github.com/ipld/go-car v0.1.1-0.20200923150018-8cdef32e2da4/go.mod h1:xrMEcuSq+D1vEwl+YAXsg/JfA98XGpXDwnkIL4Aimqw=
github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d h1:iphSzTuPqyDgH7WUVZsdqUnQNzYgIblsVr1zhVNA33U=
github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d/go.mod h1:2Gys8L8MJ6zkh1gktTSXreY63t4UbyvNp5JaudTyxHQ=
github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w=
github.com/ipld/go-ipld-prime v0.0.2-0.20200428162820-8b59dc292b8e/go.mod h1:uVIwe/u0H4VdKv3kaN1ck7uCb6yD9cFLS9/ELyXbsw8=
github.com/ipld/go-ipld-prime v0.5.1-0.20200828233916-988837377a7f/go.mod h1:0xEgdD6MKbZ1vF0GC+YcR/C4SQCAlRuOjIJ2i0HxqzM=
github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018 h1:RbRHv8epkmvBYA5cGfz68GUSbOgx5j/7ObLIl4Rsif0=
github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018/go.mod h1:0xEgdD6MKbZ1vF0GC+YcR/C4SQCAlRuOjIJ2i0HxqzM=
github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5/go.mod h1:gcvzoEDBjwycpXt3LBE061wT9f46szXGHAmj9uoP6fU=
github.com/ipld/go-ipld-prime-proto v0.0.0-20200428191222-c1ffdadc01e1/go.mod h1:OAV6xBmuTLsPZ+epzKkPB1e25FHk/vCtyatkdHcArLs=
github.com/ipld/go-ipld-prime-proto v0.0.0-20200922192210-9a2bfd4440a6/go.mod h1:3pHYooM9Ea65jewRwrb2u5uHZCNkNTe9ABsVB+SrkH0=
github.com/ipld/go-ipld-prime-proto v0.1.0 h1:j7gjqrfwbT4+gXpHwEx5iMssma3mnctC7YaCimsFP70=
github.com/ipld/go-ipld-prime-proto v0.1.0/go.mod h1:11zp8f3sHVgIqtb/c9Kr5ZGqpnCLF1IVTNOez9TopzE=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4=
github.com/jackpal/gateway v1.0.4/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs=
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c h1:uUx61FiAa1GI6ZmVd2wf2vULeQZIKG66eybjNXKYCz4=
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c/go.mod h1:sdx1xVM9UuLw1tXnhJWN3piypTUO3vCIHYmG15KE/dU=
github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs=
github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY=
github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4=
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.1.1-0.20190114141812-62fb9bc030d1/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
github.com/jsimonetti/rtnetlink v0.0.0-20190830100107-3784a6c7c552/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0=
github.com/kabukky/httpscerts v0.0.0-20150320125433-617593d7dcb3/go.mod h1:BYpt4ufZiIGv2nXn4gMxnfKV306n3mWXgNu/d2TqdTU=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM=
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc=
github.com/kilic/bls12-381 v0.0.0-20200607163746-32e1441c8a9f/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s=
github.com/kilic/bls12-381 v0.0.0-20200731194930-64c428e1bff5/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s=
github.com/kilic/bls12-381 v0.0.0-20200820230200-6b2c19996391/go.mod h1:XXfR6YFCRSrkEXbNlIyDsgXVNJWVUV30m/ebkVy9n6s=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA=
github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg=
github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d h1:68u9r4wEvL3gYg2jvAOgROwZ3H+Y3hIDk4tbbmIjcYQ=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ=
github.com/libp2p/go-addr-util v0.0.2 h1:7cWK5cdA5x72jX0g8iLrQWm5TRJZ6CzGdPEhWj7plWU=
github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E=
github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ=
github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs=
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic=
github.com/libp2p/go-conn-security v0.0.1/go.mod h1:bGmu51N0KU9IEjX7kl2PQjgZa40JQWnayTvNMgD/vyk=
github.com/libp2p/go-conn-security-multistream v0.0.1/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE=
github.com/libp2p/go-conn-security-multistream v0.0.2/go.mod h1:nc9vud7inQ+d6SO0I/6dSWrdMnHnzZNHeyUQqrAJulE=
github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc=
github.com/libp2p/go-conn-security-multistream v0.2.0 h1:uNiDjS58vrvJTg9jO6bySd1rMKejieG7v45ekqHbZ1M=
github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5Jb/P5ohUnFLNzEAR4DLSzpn2QLU=
github.com/libp2p/go-eventbus v0.0.2/go.mod h1:Hr/yGlwxA/stuLnpMiu82lpNKpvRy3EaJxPu40XYOwk=
github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4=
github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc=
github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8=
github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8=
github.com/libp2p/go-flow-metrics v0.0.2/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM=
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
github.com/libp2p/go-libp2p v0.0.2/go.mod h1:Qu8bWqFXiocPloabFGUcVG4kk94fLvfC8mWTDdFC9wE=
github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A=
github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM=
github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8=
github.com/libp2p/go-libp2p v0.3.1/go.mod h1:e6bwxbdYH1HqWTz8faTChKGR0BjPc8p+6SyP8GTTR7Y=
github.com/libp2p/go-libp2p v0.4.0/go.mod h1:9EsEIf9p2UDuwtPd0DwJsAl0qXVxgAnuDGRvHbfATfI=
github.com/libp2p/go-libp2p v0.6.0/go.mod h1:mfKWI7Soz3ABX+XEBR61lGbg+ewyMtJHVt043oWeqwg=
github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZkfEI5sT54=
github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k=
github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw=
github.com/libp2p/go-libp2p v0.8.1/go.mod h1:QRNH9pwdbEBpx5DTJYg+qxcVaDMAz3Ee/qDKwXujH5o=
github.com/libp2p/go-libp2p v0.8.3/go.mod h1:EsH1A+8yoWK+L4iKcbPYu6MPluZ+CHWI9El8cTaefiM=
github.com/libp2p/go-libp2p v0.9.2/go.mod h1:cunHNLDVus66Ct9iXXcjKRLdmHdFdHVe1TAnbubJQqQ=
github.com/libp2p/go-libp2p v0.10.0/go.mod h1:yBJNpb+mGJdgrwbKAKrhPU0u3ogyNFTfjJ6bdM+Q/G8=
github.com/libp2p/go-libp2p v0.12.0 h1:+xai9RQnQ9l5elFOKvp5wRyjyWisSwEx+6nU2+onpUA=
github.com/libp2p/go-libp2p v0.12.0/go.mod h1:FpHZrfC1q7nA8jitvdjKBDF31hguaC676g/nT9PgQM0=
github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo=
github.com/libp2p/go-libp2p-autonat v0.0.2/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4=
github.com/libp2p/go-libp2p-autonat v0.0.6/go.mod h1:uZneLdOkZHro35xIhpbtTzLlgYturpu4J5+0cZK3MqE=
github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8=
github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE=
github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI=
github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI=
github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A=
github.com/libp2p/go-libp2p-autonat v0.2.3/go.mod h1:2U6bNWCNsAG9LEbwccBDQbjzQ8Krdjge1jLTE9rdoMM=
github.com/libp2p/go-libp2p-autonat v0.4.0 h1:3y8XQbpr+ssX8QfZUHekjHCYK64sj6/4hnf/awD4+Ug=
github.com/libp2p/go-libp2p-autonat v0.4.0/go.mod h1:YxaJlpr81FhdOv3W3BTconZPfhaYivRdf53g+S2wobk=
github.com/libp2p/go-libp2p-autonat-svc v0.1.0/go.mod h1:fqi8Obl/z3R4PFVLm8xFtZ6PBL9MlV/xumymRFkKq5A=
github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc=
github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro=
github.com/libp2p/go-libp2p-blankhost v0.1.3/go.mod h1:KML1//wiKR8vuuJO0y3LUd1uLv+tlkGTAr3jC0S5cLg=
github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU=
github.com/libp2p/go-libp2p-blankhost v0.1.6/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ=
github.com/libp2p/go-libp2p-blankhost v0.2.0 h1:3EsGAi0CBGcZ33GwRuXEYJLLPoVWyXJ1bcJzAJjINkk=
github.com/libp2p/go-libp2p-blankhost v0.2.0/go.mod h1:eduNKXGTioTuQAUcZ5epXi9vMl+t4d8ugUBRQ4SqaNQ=
github.com/libp2p/go-libp2p-circuit v0.0.1/go.mod h1:Dqm0s/BiV63j8EEAs8hr1H5HudqvCAeXxDyic59lCwE=
github.com/libp2p/go-libp2p-circuit v0.0.9/go.mod h1:uU+IBvEQzCu953/ps7bYzC/D/R0Ho2A9LfKVVCatlqU=
github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8=
github.com/libp2p/go-libp2p-circuit v0.1.1/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8=
github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM=
github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU=
github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo=
github.com/libp2p/go-libp2p-circuit v0.2.2/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4=
github.com/libp2p/go-libp2p-circuit v0.2.3/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4=
github.com/libp2p/go-libp2p-circuit v0.4.0/go.mod h1:t/ktoFIUzM6uLQ+o1G6NuBl2ANhBKN9Bc8jRIk31MoA=
github.com/libp2p/go-libp2p-connmgr v0.1.1/go.mod h1:wZxh8veAmU5qdrfJ0ZBLcU8oJe9L82ciVP/fl1VHjXk=
github.com/libp2p/go-libp2p-connmgr v0.2.3/go.mod h1:Gqjg29zI8CwXX21zRxy6gOg8VYu3zVerJRt2KyktzH4=
github.com/libp2p/go-libp2p-connmgr v0.2.4 h1:TMS0vc0TCBomtQJyWr7fYxcVYYhx+q/2gF++G5Jkl/w=
github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0=
github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco=
github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco=
github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE=
github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I=
github.com/libp2p/go-libp2p-core v0.0.6/go.mod h1:0d9xmaYAVY5qmbp/fcgxHT3ZJsLjYeYPMJAUKpaCHrE=
github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI=
github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0=
github.com/libp2p/go-libp2p-core v0.2.3/go.mod h1:GqhyQqyIAPsxFYXHMjfXgMv03lxsvM0mFzuYA9Ib42A=
github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g=
github.com/libp2p/go-libp2p-core v0.2.5/go.mod h1:6+5zJmKhsf7yHn1RbmYDu08qDUpIUxGdqHuEZckmZOA=
github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw=
github.com/libp2p/go-libp2p-core v0.3.1/go.mod h1:thvWy0hvaSBhnVBaW37BvzgVV68OUhgJJLAa6almrII=
github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0=
github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0=
github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y=
github.com/libp2p/go-libp2p-core v0.5.2/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y=
github.com/libp2p/go-libp2p-core v0.5.3/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y=
github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y=
github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM=
github.com/libp2p/go-libp2p-core v0.5.6/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo=
github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo=
github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo=
github.com/libp2p/go-libp2p-core v0.6.1/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8=
github.com/libp2p/go-libp2p-core v0.7.0 h1:4a0TMjrWNTZlNvcqxZmrMRDi/NQWrhwO2pkTuLSQ/IQ=
github.com/libp2p/go-libp2p-core v0.7.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8=
github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE=
github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I=
github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ=
github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI=
github.com/libp2p/go-libp2p-daemon v0.2.2/go.mod h1:kyrpsLB2JeNYR2rvXSVWyY0iZuRIMhqzWR3im9BV6NQ=
github.com/libp2p/go-libp2p-discovery v0.0.1/go.mod h1:ZkkF9xIFRLA1xCc7bstYFkd80gBGK8Fc1JqGoU2i+zI=
github.com/libp2p/go-libp2p-discovery v0.0.5/go.mod h1:YtF20GUxjgoKZ4zmXj8j3Nb2TUSBHFlOCetzYdbZL5I=
github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g=
github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg=
github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw=
github.com/libp2p/go-libp2p-discovery v0.4.0/go.mod h1:bZ0aJSrFc/eX2llP0ryhb1kpgkPyTo23SJ5b7UQCMh4=
github.com/libp2p/go-libp2p-discovery v0.5.0 h1:Qfl+e5+lfDgwdrXdu4YNCWyEo3fWuP+WgN9mN0iWviQ=
github.com/libp2p/go-libp2p-discovery v0.5.0/go.mod h1:+srtPIU9gDaBNu//UHvcdliKBIcr4SfDcm0/PfPJLug=
github.com/libp2p/go-libp2p-host v0.0.1/go.mod h1:qWd+H1yuU0m5CwzAkvbSjqKairayEHdR5MMl7Cwa7Go=
github.com/libp2p/go-libp2p-host v0.0.3/go.mod h1:Y/qPyA6C8j2coYyos1dfRm0I8+nvd4TGrDGt4tA7JR8=
github.com/libp2p/go-libp2p-interface-connmgr v0.0.1/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k=
github.com/libp2p/go-libp2p-interface-connmgr v0.0.4/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k=
github.com/libp2p/go-libp2p-interface-connmgr v0.0.5/go.mod h1:GarlRLH0LdeWcLnYM/SaBykKFl9U5JFnbBGruAk/D5k=
github.com/libp2p/go-libp2p-interface-pnet v0.0.1/go.mod h1:el9jHpQAXK5dnTpKA4yfCNBZXvrzdOU75zz+C6ryp3k=
github.com/libp2p/go-libp2p-kad-dht v0.2.1/go.mod h1:k7ONOlup7HKzQ68dE6lSnp07cdxdkmnRa+6B4Fh9/w0=
github.com/libp2p/go-libp2p-kad-dht v0.11.0/go.mod h1:5ojtR2acDPqh/jXf5orWy8YGb8bHQDS+qeDcoscL/PI=
github.com/libp2p/go-libp2p-kbucket v0.2.1/go.mod h1:/Rtu8tqbJ4WQ2KTCOMJhggMukOLNLNPY1EtEWWLxUvc=
github.com/libp2p/go-libp2p-kbucket v0.4.7/go.mod h1:XyVo99AfQH0foSf176k4jY1xUJ2+jUJIZCSDm7r2YKk=
github.com/libp2p/go-libp2p-loggables v0.0.1/go.mod h1:lDipDlBNYbpyqyPX/KcoO+eq0sJYEVR2JgOexcivchg=
github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8=
github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90=
github.com/libp2p/go-libp2p-metrics v0.0.1/go.mod h1:jQJ95SXXA/K1VZi13h52WZMa9ja78zjyy5rspMsC/08=
github.com/libp2p/go-libp2p-mplex v0.1.1/go.mod h1:KUQWpGkCzfV7UIpi8SKsAVxyBgz1c9R5EvxgnwLsb/I=
github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo=
github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE=
github.com/libp2p/go-libp2p-mplex v0.2.2/go.mod h1:74S9eum0tVQdAfFiKxAyKzNdSuLqw5oadDq7+L/FELo=
github.com/libp2p/go-libp2p-mplex v0.2.3/go.mod h1:CK3p2+9qH9x+7ER/gWWDYJ3QW5ZxWDkm+dVvjfuG3ek=
github.com/libp2p/go-libp2p-mplex v0.3.0/go.mod h1:l9QWxRbbb5/hQMECEb908GbS9Sm2UAR2KFZKUJEynEs=
github.com/libp2p/go-libp2p-nat v0.0.2/go.mod h1:QrjXQSD5Dj4IJOdEcjHRkWTSomyxRo6HnUkf/TfQpLQ=
github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY=
github.com/libp2p/go-libp2p-nat v0.0.5/go.mod h1:1qubaE5bTZMJE+E/uu2URroMbzdubFz1ChgiN79yKPE=
github.com/libp2p/go-libp2p-nat v0.0.6 h1:wMWis3kYynCbHoyKLPBEMu4YRLltbm8Mk08HGSfvTkU=
github.com/libp2p/go-libp2p-nat v0.0.6/go.mod h1:iV59LVhB3IkFvS6S6sauVTSOrNEANnINbI/fkaLimiw=
github.com/libp2p/go-libp2p-net v0.0.1/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c=
github.com/libp2p/go-libp2p-net v0.0.2/go.mod h1:Yt3zgmlsHOgUWSXmt5V/Jpz9upuJBE8EgNU9DrCcR8c=
github.com/libp2p/go-libp2p-netutil v0.0.1/go.mod h1:GdusFvujWZI9Vt0X5BKqwWWmZFxecf9Gt03cKxm2f/Q=
github.com/libp2p/go-libp2p-netutil v0.1.0 h1:zscYDNVEcGxyUpMd0JReUZTrpMfia8PmLKcKF72EAMQ=
github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU=
github.com/libp2p/go-libp2p-noise v0.1.1/go.mod h1:QDFLdKX7nluB7DEnlVPbz7xlLHdwHFA9HiohJRr3vwM=
github.com/libp2p/go-libp2p-noise v0.1.2/go.mod h1:9B10b7ueo7TIxZHHcjcDCo5Hd6kfKT2m77by82SFRfE=
github.com/libp2p/go-libp2p-peer v0.0.1/go.mod h1:nXQvOBbwVqoP+T5Y5nCjeH4sP9IX/J0AMzcDUVruVoo=
github.com/libp2p/go-libp2p-peer v0.1.1/go.mod h1:jkF12jGB4Gk/IOo+yomm+7oLWxF278F7UnrYUQ1Q8es=
github.com/libp2p/go-libp2p-peer v0.2.0 h1:EQ8kMjaCUwt/Y5uLgjT8iY2qg0mGUT0N1zUjer50DsY=
github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY=
github.com/libp2p/go-libp2p-peerstore v0.0.1/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20=
github.com/libp2p/go-libp2p-peerstore v0.0.6/go.mod h1:RabLyPVJLuNQ+GFyoEkfi8H4Ti6k/HtZJ7YKgtSq+20=
github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY=
github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI=
github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs=
github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ=
github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA=
github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA=
github.com/libp2p/go-libp2p-peerstore v0.2.3/go.mod h1:K8ljLdFn590GMttg/luh4caB/3g0vKuY01psze0upRw=
github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s=
github.com/libp2p/go-libp2p-peerstore v0.2.6 h1:2ACefBX23iMdJU9Ke+dcXt3w86MIryes9v7In4+Qq3U=
github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s=
github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k=
github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA=
github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s=
github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk=
github.com/libp2p/go-libp2p-pubsub v0.1.1/go.mod h1:ZwlKzRSe1eGvSIdU5bD7+8RZN/Uzw0t1Bp9R1znpR/Q=
github.com/libp2p/go-libp2p-pubsub v0.3.2-0.20200527132641-c0712c6e92cf/go.mod h1:TxPOBuo1FPdsTjFnv+FGZbNbWYsp74Culx+4ViQpato=
github.com/libp2p/go-libp2p-pubsub v0.4.2-0.20210212194758-6c1addf493eb h1:HExLcdXn8fgtXPciUw97O5NNhBn31dt6d9fVUD4cngo=
github.com/libp2p/go-libp2p-pubsub v0.4.2-0.20210212194758-6c1addf493eb/go.mod h1:izkeMLvz6Ht8yAISXjx60XUQZMq9ZMe5h2ih4dLIBIQ=
github.com/libp2p/go-libp2p-quic-transport v0.1.1/go.mod h1:wqG/jzhF3Pu2NrhJEvE+IE0NTHNXslOPn9JQzyCAxzU=
github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M=
github.com/libp2p/go-libp2p-quic-transport v0.9.0/go.mod h1:xyY+IgxL0qsW7Kiutab0+NlxM0/p9yRtrGTYsuMWf70=
github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q=
github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q=
github.com/libp2p/go-libp2p-record v0.1.1/go.mod h1:VRgKajOyMVgP/F0L5g3kH7SVskp17vFi2xheb5uMJtg=
github.com/libp2p/go-libp2p-record v0.1.2/go.mod h1:pal0eNcT5nqZaTV7UGhqeGqxFgGdsU/9W//C8dqjQDk=
github.com/libp2p/go-libp2p-record v0.1.3 h1:R27hoScIhQf/A8XJZ8lYpnqh9LatJ5YbHs28kCIfql0=
github.com/libp2p/go-libp2p-record v0.1.3/go.mod h1:yNUff/adKIfPnYQXgp6FQmNu3gLJ6EMg7+/vv2+9pY4=
github.com/libp2p/go-libp2p-routing v0.0.1/go.mod h1:N51q3yTr4Zdr7V8Jt2JIktVU+3xBBylx1MZeVA6t1Ys=
github.com/libp2p/go-libp2p-routing v0.1.0/go.mod h1:zfLhI1RI8RLEzmEaaPwzonRvXeeSHddONWkcTcB54nE=
github.com/libp2p/go-libp2p-routing-helpers v0.2.3/go.mod h1:795bh+9YeoFl99rMASoiVgHdi5bjack0N1+AFAdbvBw=
github.com/libp2p/go-libp2p-secio v0.0.1/go.mod h1:IdG6iQybdcYmbTzxp4J5dwtUEDTOvZrT0opIDVNPrJs=
github.com/libp2p/go-libp2p-secio v0.0.3/go.mod h1:hS7HQ00MgLhRO/Wyu1bTX6ctJKhVpm+j2/S2A5UqYb0=
github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8=
github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g=
github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8=
github.com/libp2p/go-libp2p-secio v0.2.2/go.mod h1:wP3bS+m5AUnFA+OFO7Er03uO1mncHG0uVwGrwvjYlNY=
github.com/libp2p/go-libp2p-swarm v0.0.1/go.mod h1:mh+KZxkbd3lQnveQ3j2q60BM1Cw2mX36XXQqwfPOShs=
github.com/libp2p/go-libp2p-swarm v0.0.6/go.mod h1:s5GZvzg9xXe8sbeESuFpjt8CJPTCa8mhEusweJqyFy8=
github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4=
github.com/libp2p/go-libp2p-swarm v0.2.1/go.mod h1:x07b4zkMFo2EvgPV2bMTlNmdQc8i+74Jjio7xGvsTgU=
github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU=
github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM=
github.com/libp2p/go-libp2p-swarm v0.2.4/go.mod h1:/xIpHFPPh3wmSthtxdGbkHZ0OET1h/GGZes8Wku/M5Y=
github.com/libp2p/go-libp2p-swarm v0.2.7/go.mod h1:ZSJ0Q+oq/B1JgfPHJAT2HTall+xYRNYp1xs4S2FBWKA=
github.com/libp2p/go-libp2p-swarm v0.2.8/go.mod h1:JQKMGSth4SMqonruY0a8yjlPVIkb0mdNSwckW7OYziM=
github.com/libp2p/go-libp2p-swarm v0.3.0/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk=
github.com/libp2p/go-libp2p-swarm v0.3.1 h1:UTobu+oQHGdXTOGpZ4RefuVqYoJXcT0EBtSR74m2LkI=
github.com/libp2p/go-libp2p-swarm v0.3.1/go.mod h1:hdv95GWCTmzkgeJpP+GK/9D9puJegb7H57B5hWQR5Kk=
github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0=
github.com/libp2p/go-libp2p-testing v0.1.1/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0=
github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8/go.mod h1:Qy8sAncLKpwXtS2dSnDOP8ktexIAHKu+J+pnZOFZLTc=
github.com/libp2p/go-libp2p-testing v0.3.0 h1:ZiBYstPamsi7y6NJZebRudUzsYmVkt998hltyLqf8+g=
github.com/libp2p/go-libp2p-testing v0.3.0/go.mod h1:efZkql4UZ7OVsEfaxNHZPzIehtsBXMrXnCfJIgDti5g=
github.com/libp2p/go-libp2p-tls v0.1.3/go.mod h1:wZfuewxOndz5RTnCAxFliGjvYSDA40sKitV4c50uI1M=
github.com/libp2p/go-libp2p-transport v0.0.1/go.mod h1:UzbUs9X+PHOSw7S3ZmeOxfnwaQY5vGDzZmKPod3N3tk=
github.com/libp2p/go-libp2p-transport v0.0.4/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A=
github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwqKXWUMWU7Rfcsubee/A=
github.com/libp2p/go-libp2p-transport-upgrader v0.0.1/go.mod h1:NJpUAgQab/8K6K0m+JmZCe5RUXG10UMEx4kWe9Ipj5c=
github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc=
github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA=
github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns=
github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 h1:q3ULhsknEQ34eVDhv4YwKS8iet69ffs9+Fir6a7weN4=
github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o=
github.com/libp2p/go-libp2p-yamux v0.1.2/go.mod h1:xUoV/RmYkg6BW/qGxA9XJyg+HzXFYkeXbnhjmnYzKp8=
github.com/libp2p/go-libp2p-yamux v0.1.3/go.mod h1:VGSQVrqkh6y4nm0189qqxMtvyBft44MOYYPpYKXiVt4=
github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8=
github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI=
github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw=
github.com/libp2p/go-libp2p-yamux v0.2.5/go.mod h1:Zpgj6arbyQrmZ3wxSZxfBmbdnWtbZ48OpsfmQVTErwA=
github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhLEn0XhIoZ5viCwU=
github.com/libp2p/go-libp2p-yamux v0.2.8/go.mod h1:/t6tDqeuZf0INZMTgd0WxIRbtK2EzI2h7HbFm9eAKI4=
github.com/libp2p/go-libp2p-yamux v0.4.0/go.mod h1:+DWDjtFMzoAwYLVkNZftoucn7PelNoy5nm3tZ3/Zw30=
github.com/libp2p/go-libp2p-yamux v0.4.1 h1:TJxRVPY9SjH7TNrNC80l1OJMBiWhs1qpKmeB+1Ug3xU=
github.com/libp2p/go-libp2p-yamux v0.4.1/go.mod h1:FA/NjRYRVNjqOzpGuGqcruH7jAU2mYIjtKBicVOL3dc=
github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q=
github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q=
github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M=
github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU=
github.com/libp2p/go-mplex v0.0.1/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0=
github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0=
github.com/libp2p/go-mplex v0.0.4/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0=
github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU=
github.com/libp2p/go-mplex v0.1.1/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk=
github.com/libp2p/go-mplex v0.1.2/go.mod h1:Xgz2RDCi3co0LeZfgjm4OgUF15+sVR8SRcu3SFXI1lk=
github.com/libp2p/go-mplex v0.2.0/go.mod h1:0Oy/A9PQlwBytDRp4wSkFnzHYDKcpLot35JQ6msjvYQ=
github.com/libp2p/go-msgio v0.0.1/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ=
github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ=
github.com/libp2p/go-msgio v0.0.3/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ=
github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ=
github.com/libp2p/go-msgio v0.0.6 h1:lQ7Uc0kS1wb1EfRxO2Eir/RJoHkHn7t6o+EiwsYIKJA=
github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA=
github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI=
github.com/libp2p/go-nat v0.0.4/go.mod h1:Nmw50VAvKuk38jUBcmNh6p9lUJLoODbJRvYAa/+KSDo=
github.com/libp2p/go-nat v0.0.5 h1:qxnwkco8RLKqVh1NmjQ+tJ8p8khNLFxuElYG/TwqW4Q=
github.com/libp2p/go-nat v0.0.5/go.mod h1:B7NxsVNPZmRLvMOwiEO1scOSyjA56zxYAGv1yQgRkEU=
github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
github.com/libp2p/go-netroute v0.1.3 h1:1ngWRx61us/EpaKkdqkMjKk/ufr/JlIFYQAxV2XX8Ig=
github.com/libp2p/go-netroute v0.1.3/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk=
github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0=
github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc=
github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc=
github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc=
github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGNsw=
github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc=
github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA=
github.com/libp2p/go-reuseport v0.0.2 h1:XSG94b1FJfGA01BUrT82imejHQyTxO4jEWqheyCXYvU=
github.com/libp2p/go-reuseport v0.0.2/go.mod h1:SPD+5RwGC7rcnzngoYC86GjPzjSywuQyMVAheVBD9nQ=
github.com/libp2p/go-reuseport-transport v0.0.1/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs=
github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs=
github.com/libp2p/go-reuseport-transport v0.0.3/go.mod h1:Spv+MPft1exxARzP2Sruj2Wb5JSyHNncjf1Oi2dEbzM=
github.com/libp2p/go-reuseport-transport v0.0.4 h1:OZGz0RB620QDGpv300n1zaOcKGGAoGVf8h9txtt/1uM=
github.com/libp2p/go-reuseport-transport v0.0.4/go.mod h1:trPa7r/7TJK/d+0hdBLOCGvpQQVOU74OXbNCIMkufGw=
github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k=
github.com/libp2p/go-sockaddr v0.1.0 h1:Y4s3/jNoryVRKEBrkJ576F17CPOaMIzUeCsg7dlTDj0=
github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k=
github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14=
github.com/libp2p/go-stream-muxer v0.1.0/go.mod h1:8JAVsjeRBCWwPoZeH0W1imLOcriqXJyFvB0mR4A04sQ=
github.com/libp2p/go-stream-muxer-multistream v0.1.1/go.mod h1:zmGdfkQ1AzOECIAcccoL8L//laqawOsO03zX8Sa+eGw=
github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc=
github.com/libp2p/go-stream-muxer-multistream v0.3.0 h1:TqnSHPJEIqDEO7h1wZZ0p3DXdvDSiLHQidKKUGZtiOY=
github.com/libp2p/go-stream-muxer-multistream v0.3.0/go.mod h1:yDh8abSIzmZtqtOt64gFJUXEryejzNb0lisTt+fAMJA=
github.com/libp2p/go-tcp-transport v0.0.1/go.mod h1:mnjg0o0O5TmXUaUIanYPUqkW4+u6mK0en8rlpA6BBTs=
github.com/libp2p/go-tcp-transport v0.0.4/go.mod h1:+E8HvC8ezEVOxIo3V5vCK9l1y/19K427vCzQ+xHKH/o=
github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc=
github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY=
github.com/libp2p/go-tcp-transport v0.2.0/go.mod h1:vX2U0CnWimU4h0SGSEsg++AzvBcroCGYw28kh94oLe0=
github.com/libp2p/go-tcp-transport v0.2.1 h1:ExZiVQV+h+qL16fzCWtd1HSzPsqWottJ8KXwWaVi8Ns=
github.com/libp2p/go-tcp-transport v0.2.1/go.mod h1:zskiJ70MEfWz2MKxvFB/Pv+tPIB1PpPUrHIWQ8aFw7M=
github.com/libp2p/go-testutil v0.0.1/go.mod h1:iAcJc/DKJQanJ5ws2V+u5ywdL2n12X1WbbEG+Jjy69I=
github.com/libp2p/go-testutil v0.1.0/go.mod h1:81b2n5HypcVyrCg/MJx4Wgfp/VHojytjVe/gLzZ2Ehc=
github.com/libp2p/go-ws-transport v0.0.1/go.mod h1:p3bKjDWHEgtuKKj+2OdPYs5dAPIjtpQGHF2tJfGz7Ww=
github.com/libp2p/go-ws-transport v0.0.5/go.mod h1:Qbl4BxPfXXhhd/o0wcrgoaItHqA9tnZjoFZnxykuaXU=
github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo=
github.com/libp2p/go-ws-transport v0.1.2/go.mod h1:dsh2Ld8F+XNmzpkaAijmg5Is+e9l6/1tK/6VFOdN69Y=
github.com/libp2p/go-ws-transport v0.2.0/go.mod h1:9BHJz/4Q5A9ludYWKoGCFC5gUElzlHoKzu0yY9p/klM=
github.com/libp2p/go-ws-transport v0.3.0/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk=
github.com/libp2p/go-ws-transport v0.3.1/go.mod h1:bpgTJmRZAvVHrgHybCVyqoBmyLQ1fiZuEaBYusP5zsk=
github.com/libp2p/go-yamux v1.2.1/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.3.0/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.3.6/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow=
github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
github.com/libp2p/go-yamux v1.4.0/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
github.com/libp2p/go-yamux v1.4.1 h1:P1Fe9vF4th5JOxxgQvfbOHkrGqIZniTLf+ddhZp8YTI=
github.com/libp2p/go-yamux v1.4.1/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lucas-clemente/quic-go v0.11.2/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw=
github.com/lucas-clemente/quic-go v0.16.0/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE=
github.com/lucas-clemente/quic-go v0.18.1/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg=
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg=
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI=
github.com/marten-seemann/qpack v0.2.0/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc=
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk=
github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs=
github.com/marten-seemann/qtls-go1-15 v0.1.0/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I=
github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
github.com/mattn/go-xmlrpc v0.0.3/go.mod h1:mqc2dz7tP5x5BKlCahN/n+hs7OSZKJkS9JsHNBRlrxA=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mdlayher/genetlink v1.0.0/go.mod h1:0rJ0h4itni50A86M2kHcgS85ttZazNt7a8H2a2cw0Gc=
github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
github.com/mdlayher/netlink v0.0.0-20190828143259-340058475d09/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
github.com/mdlayher/netlink v1.0.0/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
github.com/mdlayher/wifi v0.0.0-20190303161829-b1436901ddee/go.mod h1:Evt/EIne46u9PtQbeTx2NTcqURpr5K4SvKtGmBuDPN8=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.28/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0=
github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs=
github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns=
github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI=
github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA=
github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4=
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44=
github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo=
github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4=
github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE=
github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y=
github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI=
github.com/multiformats/go-multiaddr v0.3.1 h1:1bxa+W7j9wZKTZREySx1vPMs2TqrYWjVZ7zE6/XLG1I=
github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc=
github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.0.3/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q=
github.com/multiformats/go-multiaddr-dns v0.1.0/go.mod h1:01k2RAqtoXIuPa3DCavAE9/6jc6nM0H3EgZyfUhN2oY=
github.com/multiformats/go-multiaddr-dns v0.2.0 h1:YWJoIDwLePniH7OU5hBnDZV6SWuvJqJ0YtN6pLeH9zA=
github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0=
github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q=
github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E=
github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo=
github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU=
github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ=
github.com/multiformats/go-multiaddr-net v0.1.1/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ=
github.com/multiformats/go-multiaddr-net v0.1.2/go.mod h1:QsWt3XK/3hwvNxZJp92iMQKME1qHfpYmyIjFVsSOY6Y=
github.com/multiformats/go-multiaddr-net v0.1.3/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA=
github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA=
github.com/multiformats/go-multiaddr-net v0.1.5/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA=
github.com/multiformats/go-multiaddr-net v0.2.0 h1:MSXRGN0mFymt6B1yo/6BPnIRpLPEnKgQNvVfCX5VDJk=
github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA=
github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs=
github.com/multiformats/go-multibase v0.0.2/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs=
github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk=
github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc=
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po=
github.com/multiformats/go-multihash v0.0.7/go.mod h1:XuKXPp8VHcTygube3OWZC+aZrA+H1IhmjoCDtJc7PXM=
github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
github.com/multiformats/go-multihash v0.0.14 h1:QoBceQYQQtNUuf6s7wHxnE2c8bhbMqhfGzNI032se/I=
github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38=
github.com/multiformats/go-multistream v0.2.0 h1:6AuNmQVKUkRnddw2YiDjt5Elit40SFxMJkVnhmETXtU=
github.com/multiformats/go-multistream v0.2.0/go.mod h1:5GZPQZbkWOLOn3J2y4Y99vVW7vOfsAflxARk3x14o6k=
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/near/borsh-go v0.3.0 h1:+DvG7eApOD3KrHIh7TwZvYzhXUF/OzMTC6aRTUEtW+8=
github.com/near/borsh-go v0.3.0/go.mod h1:NeMochZp7jN/pYFuxLkrZtmLqbADmnp/y1+/dL+AsyQ=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c/go.mod h1:7qN3Y0BvzRUf4LofcoJplQL10lsFDb4PYlePTVwrP28=
github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.12.3/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/open-rpc/meta-schema v0.0.0-20201029221707-1b72ef2ea333/go.mod h1:Ag6rSXkHIckQmjFBCweJEEt1mrTPBv8b9W4aU/NQWfI=
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc=
github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w=
github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ=
github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE=
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ=
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M=
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM=
github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/common v0.29.0 h1:3jqPBvKT4OHAbje2Ql7KeaaSicDBCxMYwEJU1zRJceE=
github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/node_exporter v1.0.0-rc.0.0.20200428091818-01054558c289/go.mod h1:FGbBv5OPKjch+jNUJmEQpMZytIdyW0NdBtWFcfSKusc=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.1.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/raulk/clock v1.1.0 h1:dpb29+UKMbLqiU/jqIJptgLR1nn23HLgMY0sTCDza5Y=
github.com/raulk/clock v1.1.0/go.mod h1:3MpVxdZ/ODBQDxbN+kzshf5OSZwPjtMDx6BBXBmOeY0=
github.com/raulk/go-watchdog v1.0.1/go.mod h1:lzSbAl5sh4rtI8tYHU01BWIDzgzqaQLj6RcA1i4mlqI=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg=
github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM=
github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/renproject/id v0.4.2 h1:XseNDPPCJtsZjIWR7Qgf+zxy0Gt5xsLrfwpQxJt5wFQ=
github.com/renproject/id v0.4.2/go.mod h1:bCzV4zZkyWetf0GvhJxMT9HQNnGUwzQpImtXOUXqq0k=
github.com/renproject/pack v0.2.5 h1:BNfam8PCb5qJuIX36IqOkcRgaZLOZsM1lZZSakbOxb4=
github.com/renproject/pack v0.2.5/go.mod h1:pzX3Hc04RoPft89LaZJVp0xgngVGi90V7GvyC3mOGg4=
github.com/renproject/surge v1.2.2/go.mod h1:jNVsKCM3/2PAllkc2cx7g2saG9NrHRX5x20I/TDMXOs=
github.com/renproject/surge v1.2.5/go.mod h1:jNVsKCM3/2PAllkc2cx7g2saG9NrHRX5x20I/TDMXOs=
github.com/renproject/surge v1.2.6 h1:4EV2jbBPvQM8Wnv5zL1N1X/UbaH6AZiRUv7r4xZ8ncA=
github.com/renproject/surge v1.2.6/go.mod h1:jNVsKCM3/2PAllkc2cx7g2saG9NrHRX5x20I/TDMXOs=
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE=
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.23.0 h1:UskrK+saS9P9Y789yNNulYKdARjPZuS35B8gJF2x60g=
github.com/rs/zerolog v1.23.0/go.mod h1:6c7hFfxPOy7TacJc4Fcdi24/J0NKYGzjG8FWRI916Qo=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/sercand/kuberesolver v2.1.0+incompatible/go.mod h1:lWF3GL0xptCB/vCiJPl/ZshwPsX/n4Y7u0CW9E7aQIQ=
github.com/sercand/kuberesolver v2.4.0+incompatible/go.mod h1:lWF3GL0xptCB/vCiJPl/ZshwPsX/n4Y7u0CW9E7aQIQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI=
github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU=
github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag=
github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg=
github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw=
github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y=
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q=
github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ=
github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I=
github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0=
github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ=
github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0=
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE=
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/spf13/viper v1.8.0 h1:QRwDgoG8xX+kp69di68D+YYTCWfYEckbZRfUlEIAal0=
github.com/spf13/viper v1.8.0/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg=
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw=
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok=
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s=
github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U=
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI=
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4=
github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg=
github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tendermint v0.34.10/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0=
github.com/tendermint/tendermint v0.34.12 h1:m+kUYNhONedhJfHmHG8lqsdZvbR5t6vmhaok1yXjpKg=
github.com/tendermint/tendermint v0.34.12/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0=
github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8=
github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ=
github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw=
github.com/terra-money/core v0.5.5 h1:wgNUa0yNHkhtECF7w45uOvlzWMeKuefmE/fW0imM4Qc=
github.com/terra-money/core v0.5.5/go.mod h1:hC15x6CgPCbV6b8NQybzaPTq2gy0MYMbcm4oQON1T9w=
github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g=
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg=
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tj/go-spin v1.1.0 h1:lhdWZsvImxvZ3q1C5OIB7d72DuOwP4O2NdBg9PyzNds=
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4=
github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA=
github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v1.5.1-0.20181102163054-1fc5c315e03c/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y=
github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI=
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w=
github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/weaveworks/common v0.0.0-20200512154658-384f10054ec5/go.mod h1:c98fKi5B9u8OsKGiWHLRKus6ToQ1Tubeow44ECO1uxY=
github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA=
github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc/go.mod h1:r45hJU7yEoA81k6MWNhpMj/kms0n14dkzkxYHoB96UM=
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba h1:X4n8JG2e2biEZZXdBKt9HX7DN3bYGFUqljqqy0DqgnY=
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba/go.mod h1:CHQnYnQUEPydYCwuy8lmTHfGmdw9TKrhWV0xLx8l0oM=
github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/cbor-gen v0.0.0-20200402171437-3d27c146c105/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W5MvapuoHRP8rz4vxjwCK1pDqF1aQcWsV5PZ+AHbqdg=
github.com/whyrusleeping/cbor-gen v0.0.0-20200710004633-5379fc63235d/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200723185710-6a3894a6352b/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200826160007-0b9f6c5fb163/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2 h1:bsUlNhdmbtlfdLVXAVfuvKQ01RnWAM09TVrJkI7NZs4=
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-ctrlnet v0.0.0-20180313164037-f564fbbdaa95/go.mod h1:SJqKCCPXRfBFCwXjfNT/skfsceF7+MBFLI2OrvuRA7g=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/whyrusleeping/go-logging v0.0.1/go.mod h1:lDPYj54zutzG1XYfHAhcc7oNXEburHQBn+Iqd4yS4vE=
github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8=
github.com/whyrusleeping/go-smux-multiplex v3.0.16+incompatible/go.mod h1:34LEDbeKFZInPUrAG+bjuJmUXONGdEFW7XL0SpTY1y4=
github.com/whyrusleeping/go-smux-multistream v2.0.2+incompatible/go.mod h1:dRWHHvc4HDQSHh9gbKEBbUZ+f2Q8iZTPG3UOGYODxSQ=
github.com/whyrusleeping/go-smux-yamux v2.0.8+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI=
github.com/whyrusleeping/go-smux-yamux v2.0.9+incompatible/go.mod h1:6qHUzBXUbB9MXmw3AUdB52L8sEb/hScCqOdW2kj/wuI=
github.com/whyrusleeping/ledger-filecoin-go v0.9.1-0.20201010031517-c3dcc1bddce4/go.mod h1:K+EVq8d5QcQ2At5VECsA+SNZvWefyBXh8TnIsxo1OvQ=
github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA=
github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds=
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI=
github.com/whyrusleeping/pubsub v0.0.0-20190708150250-92bcb0691325/go.mod h1:g7ckxrjiFh8mi1AY7ox23PZD0g6QU/TxW3U3unX7I3A=
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee h1:lYbXeSvJi5zk5GLKVuid9TVjS9a0OmLIDKTfoZBL6Ow=
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee/go.mod h1:m2aV4LZI4Aez7dP5PMyVKEHhUyEJ/RjmPEDOpDvudHg=
github.com/whyrusleeping/yamux v1.1.5/go.mod h1:E8LnQQ8HKx5KD29HZFUwM1PxCOdPRzGwur1mcYhXcD8=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xlab/c-for-go v0.0.0-20201112171043-ea6dce5809cb h1:/7/dQyiKnxAOj9L69FhST7uMe17U015XPzX7cy+5ykM=
github.com/xlab/c-for-go v0.0.0-20201112171043-ea6dce5809cb/go.mod h1:pbNsDSxn1ICiNn9Ct4ZGNrwzfkkwYbx/lw8VuyutFIg=
github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JLlWugkzsrlB50jR9v2khiD9FxuSo=
github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245/go.mod h1:C+diUUz7pxhNY6KAoLgrTYARGWnt82zWTylZlxT92vk=
github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=
github.com/xorcare/golden v0.6.0/go.mod h1:7T39/ZMvaSEZlBPoYfVFmsBLmUl3uz9IuzWj/U6FtvQ=
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542 h1:oWgZJmC1DorFZDpfMfWg7xk29yEOZiXmo/wZl+utTI8=
github.com/xorcare/golden v0.6.1-0.20191112154924-b87f686d7542/go.mod h1:7T39/ZMvaSEZlBPoYfVFmsBLmUl3uz9IuzWj/U6FtvQ=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8=
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.12.1/go.mod h1:KatxXrVDzgWwbssUWsF5+cOJHXPvzQ09YSlzGNuhOEo=
go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw=
go.dedis.ch/kyber/v3 v3.0.4/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ=
go.dedis.ch/kyber/v3 v3.0.9/go.mod h1:rhNjUUg6ahf8HEg5HUvVBYoWY4boAafX8tYxX+PS+qg=
go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo=
go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4=
go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/dig v1.10.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw=
go.uber.org/fx v1.9.0/go.mod h1:mFdUyAUuJ3w4jAckiKSKbldsxy1ojpAMJ+dVZg5Y0Aw=
go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
go4.org v0.0.0-20200411211856-f5505b9728dd h1:BNJlw5kRTzdmyfh5U8F93HA2OwkP7ZGwA51eJ/0wKOU=
go4.org v0.0.0-20200411211856-f5505b9728dd/go.mod h1:CIiUVy99QCPfoE13bO4EZaz5GZMZXMSBGhxRdsvzbkg=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20181106170214-d68db9428509/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5 h1:rxKZ2gOnYxjfmakvUUqh9Gyb6KXfrj7JWTxORTYqb0E=
golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
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=
golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 h1:LQmS1nU0twXLA96Kt7U9qtHJEbBk3z6Q0V4UXjZkpr4=
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200519113804-d87ec0cfa476/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201022231255-08b38378de70/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d h1:4SFsTMi4UahlKoloni7L4eYzhFRifURQLw+yv0QDCx8=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190524152521-dbbf3f1254d4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190526052359-791d8a0f4d09/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191025090151-53bf42e6b339/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200926100807-9d91bd62050c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200827010519-17fd2f27a9e3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201112185108-eeaa07dd7696/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023 h1:0c3L82FDQ5rt1bjTBlchS8t6RQ6299/+5bWMnRLh+uI=
golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618=
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=
gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg=
google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8=
gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/golex v1.0.1 h1:EYKY1a3wStt0RzHaH8mdSRNg78Ub0OHxYfCRWw35YtM=
modernc.org/golex v1.0.1/go.mod h1:QCA53QtsT1NdGkaZZkF5ezFwk4IXh4BGNafAARTC254=
modernc.org/lex v1.0.0/go.mod h1:G6rxMTy3cH2iA0iXL/HRRv4Znu8MK4higxph/lE7ypk=
modernc.org/lexer v1.0.0/go.mod h1:F/Dld0YKYdZCLQ7bD0USbWL4YKCyTDRDHiDTOs0q0vk=
modernc.org/mathutil v1.1.1 h1:FeylZSVX8S+58VsyJlkEj2bcpdytmp9MmDKZkKx8OIE=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/strutil v1.1.0 h1:+1/yCzZxY2pZwwrsbH+4T7BQMoLQ9QiBshRC9eicYsc=
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/xc v1.0.0 h1:7ccXrupWZIS3twbUGrtKmHS2DXY6xegFua+6O3xgAFU=
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
================================================
FILE: infra/acala/Dockerfile
================================================
FROM ubuntu:xenial
RUN apt-get update && apt-get install --yes --fix-missing software-properties-common curl git clang
RUN apt-get install --yes --fix-missing --no-install-recommends build-essential
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Clone repository
RUN git clone https://github.com/AcalaNetwork/Acala.git
RUN mv Acala /app
WORKDIR /app
# TEMPORARY: use the branch that has a good reference to the submodules
# TODO: remove when the `master` branch of Acala is updated
RUN git fetch
RUN git checkout update-orml
RUN git pull
# Make sure submodule.recurse is set to true to make life with submodule easier.
RUN git config --global submodule.recurse true
# Build
RUN make init
RUN make build
WORKDIR /
COPY run.sh /root/
RUN chmod +x /root/run.sh
# rpc port
EXPOSE 9933
# ws port
EXPOSE 9944
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/acala/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Start
cd /app
make run
sleep 10
# Print setup
echo "ACALA_ADDRESS=$ADDRESS"
================================================
FILE: infra/avalanche/Dockerfile
================================================
FROM ubuntu:bionic
RUN apt update -y
RUN apt-get install -y wget curl build-essential
# INSTALL GO AND RUST
RUN wget -c https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# Fetch avalanchego
WORKDIR /app
RUN wget https://github.com/ava-labs/avalanchego/releases/download/v1.4.5/avalanchego-linux-amd64-v1.4.5.tar.gz
RUN tar -xzf avalanchego-linux-amd64-v1.4.5.tar.gz
RUN rm avalanchego-linux-amd64-v1.4.5.tar.gz
ENV PATH=$PATH:/app/avalanchego-v1.4.5
# COPY run script
COPY run.sh run.sh
RUN chmod +x run.sh
# RPC SERVER PORT
EXPOSE 9650
# RUN
ENTRYPOINT [ "./run.sh" ]
================================================
FILE: infra/avalanche/run.sh
================================================
#!/bin/bash
AVAX_USERNAME=$1
AVAX_PASSWORD=$2
AVAX_PK=$3
AVAX_ADDRESS=$4
C_AVAX_PK=$5
C_AVAX_HEX_ADDRESS=$6
C_AVAX_BECH32_ADDRESS=$7
avalanchego \
--assertions-enabled=true \
--tx-fee=1000000 \
--public-ip=0.0.0.0 \
--network-id=local \
--signature-verification-enabled=true \
--api-admin-enabled=true \
--api-ipcs-enabled=true \
--api-keystore-enabled=true \
--api-metrics-enabled=true \
--http-host=0.0.0.0 \
--http-port=9650 \
--http-tls-enabled=false \
--plugin-dir=/app/avalanchego-v1.4.5/avalanchego-latest/plugins \
--log-level=info \
--snow-avalanche-batch-size=30 \
--snow-avalanche-num-parents=5 \
--snow-sample-size=1 \
--snow-quorum-size=1 \
--snow-virtuous-commit-threshold=1 \
--snow-rogue-commit-threshold=4 \
--staking-enabled=false \
--staking-port=9651 \
--api-auth-required=false &
# create a new user
sleep 10
echo ""
echo "---create new user---"
echo ""
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"keystore.createUser",
"params" :{
"username":"'"$AVAX_USERNAME"'",
"password":"'"$AVAX_PASSWORD"'"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
# import private key that contains AVAX into X-chain
sleep 1
echo ""
echo "---import private key that contains AVAX into X-chain---"
echo ""
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.importKey",
"params" :{
"username":"'"$AVAX_USERNAME"'",
"password":"'"$AVAX_PASSWORD"'",
"privateKey":"'"$AVAX_PK"'"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
# import private key into C-chain
sleep 1
echo ""
echo "---import private key into C-chain---"
echo ""
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avax.importKey",
"params" :{
"username" :"'"$AVAX_USERNAME"'",
"password":"'"$AVAX_PASSWORD"'",
"privateKey":"'"$AVAX_PK"'"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/avax
# export the AVAX to C-chain
sleep 1
echo ""
echo "---export the AVAX to C-chain---"
echo ""
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.exportAVAX",
"params" :{
"to":"'"$C_AVAX_BECH32_ADDRESS"'",
"destinationChain": "C",
"amount": 5000000000000,
"username":"'"$AVAX_USERNAME"'",
"password":"'"$AVAX_PASSWORD"'"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
# import AVAX to the hex address
sleep 1
echo ""
echo "---import AVAX to the hex address---"
echo ""
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avax.importAVAX",
"params" :{
"to":"'"$C_AVAX_HEX_ADDRESS"'",
"sourceChain":"X",
"username":"'"$AVAX_USERNAME"'",
"password":"'"$AVAX_PASSWORD"'"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/avax
wait %1
================================================
FILE: infra/binance/Dockerfile
================================================
FROM ubuntu:xenial
RUN apt-get update --fix-missing
RUN apt-get install --yes curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install --yes nodejs
RUN npm install -g ganache-cli
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
EXPOSE 8575
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/binance/Dockerfile-riolta
================================================
# Build Geth in a stock Go builder container
FROM golang:1.14-alpine as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git
WORKDIR /app
RUN git clone -b 1.0.1.beta.2 https://github.com/binance-chain/bsc
WORKDIR /app/bsc
RUN make geth
RUN touch genesis.json
RUN touch config.yaml
RUN wget -q -O genesis.json https://github.com/binance-chain/bsc/releases/download/v1.0.0-beta.1/genesis.json
RUN wget -q -O config.yaml https://github.com/binance-chain/bsc/releases/download/v1.0.0-beta.1/config.toml
# RPC port
EXPOSE 8575
# init the node with genesis file
RUN ./build/bin/geth --datadir node init genesis.json
ENTRYPOINT ["./build/bin/geth", "--config", "./config.yaml", "--datadir", "./node", "--rpc", "--rpcport", "8575"]
================================================
FILE: infra/binance/run.sh
================================================
#!/bin/bash
MNEMONIC=$1
ADDRESS=$2
ganache-cli \
-h 0.0.0.0 \
-a 105 \
-k muirGlacier \
-i 420 \
-m "$MNEMONIC" \
-p 8575 \
-u $ADDRESS \
-b 1 \
-l 60000000 \
--chainId 420
================================================
FILE: infra/bitcoin/Dockerfile
================================================
FROM ubuntu:bionic
RUN apt-get update && apt-get install --yes software-properties-common
RUN apt-get install --yes curl
# bitcoind PPA is unmaintained, so we download it from the bitcoincore website.
# This can sometimes stall, which can be fixed by killing and restarting the
# build.
RUN curl https://bitcoincore.org/bin/bitcoin-core-0.21.0/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz | tar -xz
RUN mv ./bitcoin-0.21.0 /app
RUN chmod +x /app/bin/bitcoind
RUN chmod +x /app/bin/bitcoin-cli
COPY bitcoin.conf /root/.bitcoin/
COPY run.sh /root/
RUN chmod +x /root/run.sh
EXPOSE 18443
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/bitcoin/bitcoin.conf
================================================
daemon=1
regtest=1
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
server=1
txindex=1
[regtest]
rpcbind=0.0.0.0
================================================
FILE: infra/bitcoin/keygen.go
================================================
package main
import (
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
)
func main() {
privKey := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(privKey), &chaincfg.RegressionNetParams, true)
if err != nil {
panic(err)
}
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), &chaincfg.RegressionNetParams)
if err != nil {
panic(err)
}
fmt.Printf("BITCOIN_PK=%v\n", wif)
fmt.Printf("BITCOIN_ADDRESS=%v\n", addrPubKeyHash)
}
================================================
FILE: infra/bitcoin/run.sh
================================================
#!/bin/bash
ADDRESS=$1
PRIV_KEY=$2
# Start
/app/bin/bitcoind -regtest -daemon
sleep 20
# Print setup
echo "BITCOIN_ADDRESS=$ADDRESS"
/app/bin/bitcoin-cli createwallet "testwallet"
# Import the address
/app/bin/bitcoin-cli -regtest importaddress $ADDRESS
# Import the private key to spend UTXOs
/app/bin/bitcoin-cli -regtest importprivkey $PRIV_KEY
# Generate enough block to pass the maturation time
/app/bin/bitcoin-cli -regtest generatetoaddress 101 $ADDRESS
# Simulate mining
while :
do
# generate new btc to the address
/app/bin/bitcoin-cli -regtest generatetoaddress 1 $ADDRESS
sleep 5
# send tx to own address while paying fee to the miner
/app/bin/bitcoin-cli -regtest -named sendtoaddress address=$ADDRESS amount=0.1 subtractfeefromamount=true fee_rate=1
sleep 5
done
================================================
FILE: infra/bitcoincash/Dockerfile
================================================
FROM ubuntu:bionic
# Install bitcoind-abc.
RUN apt-get update && apt-get install --yes software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && \
apt-get install --yes g++-7 && \
add-apt-repository ppa:bitcoin-cash-node/ppa && apt-get update && \
apt-get install --yes bitcoind
COPY bitcoin.conf /root/.bitcoin/
COPY run.sh /root/
RUN chmod +x /root/run.sh
EXPOSE 19443
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/bitcoincash/bitcoin.conf
================================================
daemon=1
regtest=1
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
server=1
txindex=1
[regtest]
rpcport=19443
================================================
FILE: infra/bitcoincash/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Start
bitcoind
sleep 10
# Print setup
echo "BITCOINCASH_ADDRESS=$ADDRESS"
# Import the address
bitcoin-cli importaddress $ADDRESS
# Generate enough block to pass the maturation time
bitcoin-cli generatetoaddress 101 $ADDRESS
# Simulate mining
while :
do
bitcoin-cli generatetoaddress 1 $ADDRESS
sleep 10
done
================================================
FILE: infra/digibyte/Dockerfile
================================================
FROM ubuntu:xenial
ARG VERSION=7.17.2
ARG ARCH=x86_64
ARG RPCUSERNAME=user
ARG RPCPASSWORD=password
ARG ROOTDATADIR=/app
ARG RUN_AS_DAEMON=1
# Set to 1 for running it in testnet mode
ARG TESTNET=0
# Do we want any blockchain pruning to take place? Set to 4096 for a 4GB blockchain prune.
# Alternatively set size=1 to prune with RPC call 'pruneblockchainheight '
# Must have txindex=0 if set
ARG PRUNESIZE=0
# Install and clean again
RUN apt-get update && \
apt-get install --yes software-properties-common wget && \
rm -rf /var/lib/apt/lists
# Download DigiByte Binary
RUN wget -c https://github.com/DigiByte-Core/DigiByte/releases/download/v${VERSION}/digibyte-${VERSION}-${ARCH}-linux-gnu.tar.gz -O - | tar xz
RUN mv ./digibyte-${VERSION} "${ROOTDATADIR}"
RUN chmod +x "${ROOTDATADIR}/bin/digibyted"
RUN chmod +x "${ROOTDATADIR}/bin/digibyte-cli"
RUN ln -s "${ROOTDATADIR}/bin/digibyte-cli" "/usr/bin/digibyte-cli"
RUN ln -s "${ROOTDATADIR}/bin/digibyted" "/usr/bin/digibyted"
RUN export ROOTDATADIR="${ROOTDATADIR}"
# Generate config
RUN mkdir -p "/root/.digibyte"
RUN bash -c 'echo -e "server=1\n\
prune=${PRUNESIZE}\n\
maxconnections=300\n\
rpcallowip=127.0.0.1\n\
daemon=${RUN_AS_DAEMON}\n\
rpcuser=${RPCUSERNAME}\n\
rpcpassword=${RPCPASSWORD}\n\
txindex=1\n\
addresstype=bech32\n\
# Uncomment below if you need Dandelion disabled for any reason but it is left on by default intentionally\n\
#disabledandelion=1\n\
testnet=${TESTNET}\n\
regtest=1\n\
\n\
[regtest]\n\
rpcallowip=0.0.0.0/0\n\
rpcbind=0.0.0.0\n\
daemon=${RUN_AS_DAEMON}\n"' > "/root/.digibyte/digibyte.conf"
# Allow Mainnet RPC
EXPOSE 14022
# Allow Testnet RPC
EXPOSE 14023
# Allow Regtest RPC
EXPOSE 18443
COPY run.sh "/root"
RUN chmod +x "/root/run.sh"
ENTRYPOINT ["/root/run.sh"]
================================================
FILE: infra/digibyte/README.md
================================================
# README
## Generate a keypair (privatekey + address)
```bash
$ go run keygen.go
DIGIBYTE_PK=eagPs6RBxmTQyjni3K7vqPNBwjN4o5R8CEwP4eyHavMJMz29MCen
DIGIBYTE_ADDRESS=smtdQvMJRLaWwNaFUjdBtFzUR4evxQJcB9
```
## Build your docker container
```bash
docker build .
```
## Run the container
```bash
# Regtest
docker run -p 18443:18443 digibyte:latest "smtdQvMJRLaWwNaFUjdBtFzUR4evxQJcB9"
```
================================================
FILE: infra/digibyte/keygen.go
================================================
package main
import (
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/chain/digibyte"
)
func main() {
privKey := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(privKey), &digibyte.RegressionNetParams, true)
if err != nil {
panic(err)
}
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), &digibyte.RegressionNetParams)
if err != nil {
panic(err)
}
fmt.Printf("DIGIBYTE_PK=%v\n", wif)
fmt.Printf("DIGIBYTE_ADDRESS=%v\n", addrPubKeyHash)
}
================================================
FILE: infra/digibyte/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Start
digibyted
sleep 10
# Print setup
echo "DIGIBYTE_ADDRESS=$ADDRESS"
# Import the address
digibyte-cli importaddress $ADDRESS
# Generate enough block to pass the maturation time
digibyte-cli generatetoaddress 101 $ADDRESS
# Simulate mining
while :
do
digibyte-cli generatetoaddress 1 $ADDRESS
sleep 10
done
================================================
FILE: infra/docker-compose.yaml
================================================
version: "2"
services:
#
# Acala
#
acala:
build:
context: ./acala
ports:
- "0.0.0.0:9933:9933"
- "0.0.0.0:9944:9944"
entrypoint:
- "./root/run.sh"
- "${ACALA_ADDRESS}"
#
# Binance Smart Chain
#
binance:
build:
context: ./binance
ports:
- "0.0.0.0:8575:8575"
entrypoint:
- "./root/run.sh"
- "${BINANCE_MNEMONIC}"
- "${BINANCE_ADDRESS}"
#
# Bitcoin
#
bitcoin:
build:
context: ./bitcoin
ports:
- "0.0.0.0:18443:18443"
entrypoint:
- "./root/run.sh"
- "${BITCOIN_ADDRESS}"
- "${BITCOIN_PK}"
#
# Bitcoin Cash
#
bitcoincash:
build:
context: ./bitcoincash
ports:
- "0.0.0.0:19443:19443"
entrypoint:
- "./root/run.sh"
- "${BITCOINCASH_ADDRESS}"
#
# DigiByte
#
digibyte:
build:
context: ./digibyte
ports:
- "0.0.0.0:20443:18443"
entrypoint:
- "/root/run.sh"
- "${DIGIBYTE_ADDRESS}"
#
# Dogecoin
#
dogecoin:
build:
context: ./dogecoin
ports:
- "0.0.0.0:18332:18332"
entrypoint:
- "./root/run.sh"
- "${DOGECOIN_ADDRESS}"
#
# Ethereum (EIP-1559 compatible)
#
ethereum:
build:
context: ./ethereum
ports:
- "0.0.0.0:8545:8545"
#
# Fantom
#
fantom:
build:
context: ./fantom
ports:
- "0.0.0.0:18545:18545"
#
# Filecoin
#
filecoin:
build:
context: ./filecoin
ports:
- "0.0.0.0:1234:1234"
entrypoint:
- "/root/run.sh"
#
# Zcash
#
zcash:
build:
context: ./zcash
ports:
- "0.0.0.0:18232:18232"
entrypoint:
- "./root/run.sh"
- "${ZCASH_ADDRESS}"
##
## Terra
##
terra:
build:
context: ./terra
ports:
- "0.0.0.0:26657:26657"
entrypoint:
- "./root/run.sh"
- "${TERRA_ADDRESS}"
##
## Polygon
##
polygon:
build:
context: ./polygon
ports:
- "0.0.0.0:28545:8545"
entrypoint:
- "./root/run.sh"
##
## Solana
##
solana:
image: renbot/ren-solana:latest
ports:
- "0.0.0.0:8899-8900:8899-8900"
##
## Moonbeam
##
moonbeam:
image: purestake/moonbeam:tutorial-v7
ports:
- "0.0.0.0:9944:9944"
- "0.0.0.0:9933:9933"
command: --dev --ws-external --rpc-external
#
# Avalanche
#
avalanche:
build:
context: ./avalanche
ports:
- "0.0.0.0:9650:9650"
entrypoint:
- "./run.sh"
- "${AVAX_USERNAME}"
- "${AVAX_PASSWORD}"
- "${AVAX_PK}"
- "${AVAX_ADDRESS}"
- "${C_AVAX_PK}"
- "${C_AVAX_HEX_ADDRESS}"
- "${C_AVAX_BECH32_ADDRESS}"
#
# Goerli (EIP-1559 compatible)
#
goerli:
build:
context: ./goerli
ports:
- "0.0.0.0:1545:8545"
================================================
FILE: infra/dogecoin/Dockerfile
================================================
FROM ubuntu:xenial
RUN apt-get update --fix-missing && apt-get install --yes software-properties-common wget
RUN wget -c https://github.com/dogecoin/dogecoin/releases/download/v1.14.2/dogecoin-1.14.2-x86_64-linux-gnu.tar.gz -O - | tar xz
RUN mv ./dogecoin-1.14.2 /app
RUN chmod +x /app/bin/dogecoind
RUN chmod +x /app/bin/dogecoin-cli
COPY dogecoin.conf /root/.dogecoin/dogecoin.conf
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
EXPOSE 18332
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/dogecoin/dogecoin.conf
================================================
daemon=1
regtest=1
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
server=1
txindex=1
[regtest]
rpcbind=0.0.0.0
================================================
FILE: infra/dogecoin/keygen.go
================================================
package main
import (
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil"
"github.com/renproject/id"
"github.com/renproject/multichain/chain/dogecoin"
)
func main() {
privKey := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(privKey), &dogecoin.RegressionNetParams, true)
if err != nil {
panic(err)
}
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), &dogecoin.RegressionNetParams)
if err != nil {
panic(err)
}
fmt.Printf("DOGECOIN_PK=%v\n", wif)
fmt.Printf("DOGECOIN_ADDRESS=%v\n", addrPubKeyHash)
}
================================================
FILE: infra/dogecoin/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Start
/app/bin/dogecoind -conf=/root/.dogecoin/dogecoin.conf # -server -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -rpcuser=user -rpcpassword=password
sleep 10
# Print setup
echo "DOGECOIN_ADDRESS=$ADDRESS"
# Import the address
/app/bin/dogecoin-cli importaddress $ADDRESS
# Generate enough block to pass the maturation time
/app/bin/dogecoin-cli generatetoaddress 101 $ADDRESS
# Simulate mining
while :
do
/app/bin/dogecoin-cli generatetoaddress 1 $ADDRESS
sleep 10
done
================================================
FILE: infra/ethereum/Dockerfile
================================================
FROM node:16-alpine
WORKDIR /root/app
COPY package.json .
RUN npm install
COPY hardhat.config.js .
COPY run.sh .
RUN chmod +x run.sh
EXPOSE 8545
ENTRYPOINT ["./run.sh"]
================================================
FILE: infra/ethereum/hardhat.config.js
================================================
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.7.3",
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 1337,
initialBaseFeePerGas: 30000000,
blockGasLimit: 15000000,
hardfork: "london",
mining: {
auto: false,
interval: 1000
},
accounts: {
mnemonic: "clutch captain shoe salt awake harvest setup primary inmate ugly among become",
count: 105
}
}
}
}
================================================
FILE: infra/ethereum/package.json
================================================
{
"name": "hardhat-project",
"devDependencies": {
"hardhat": "^2.5.0"
}
}
================================================
FILE: infra/ethereum/run.sh
================================================
#!/bin/sh
npx hardhat --config hardhat.config.js node
================================================
FILE: infra/fantom/Dockerfile
================================================
FROM ubuntu:bionic
# Install dependencies
RUN apt-get update -y
RUN apt-get install -y build-essential git wget
# Install Go
RUN wget -c https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# Build Opera
WORKDIR /app
RUN git clone https://github.com/Fantom-foundation/go-opera.git
WORKDIR /app/go-opera
RUN git checkout release/1.0.0-rc.4
RUN make
ENV PATH=$PATH:/app/go-opera/build
# Expose the default port of the JSON-RPC server
EXPOSE 18545
ENTRYPOINT [ "opera", "--fakenet", "1/1", "--http", "--http.api=eth,net", "--http.vhosts", "*", "--http.addr", "0.0.0.0" ]
================================================
FILE: infra/filecoin/Dockerfile
================================================
FROM ubuntu:bionic
RUN apt update -y
RUN apt install -y mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl wget nano
RUN apt upgrade -y
RUN wget -c https://golang.org/dl/go1.14.6.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.14.6.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
WORKDIR /app
RUN git clone https://github.com/filecoin-project/lotus .
RUN git checkout d4cdc6d3340b8496c9f98e2d0daed8d1bd9b271e
RUN make 2k
RUN ./lotus fetch-params 2048
RUN ./lotus-seed pre-seal --sector-size 2KiB --num-sectors 2
RUN ./lotus-seed genesis new localnet.json
RUN ./lotus-seed genesis add-miner localnet.json ~/.genesis-sectors/pre-seal-t01000.json
COPY run.sh /root/run.sh
COPY miner.key /root/miner.key
COPY user.key /root/user.key
RUN chmod +x /root/run.sh
RUN chmod +x /root/miner.key
RUN chmod +x /root/user.key
EXPOSE 1234
CMD /root/run.sh
================================================
FILE: infra/filecoin/miner.key
================================================
7b2254797065223a22736563703235366b31222c22507269766174654b6579223a223168436f364f617442746f58636d304f6565665849473873374e505573576472372f6666735a58755964493d227d
================================================
FILE: infra/filecoin/run.sh
================================================
#!/bin/bash
cd /app/
export LOTUS_SKIP_GENESIS_CHECK=_yes_
./lotus daemon --lotus-make-genesis=dev.gen --genesis-template=localnet.json --bootstrap=false &
PID=$!
sleep 10
./lotus wallet import ~/.genesis-sectors/pre-seal-t01000.key
./lotus wallet import /root/miner.key
./lotus wallet import /root/user.key
./lotus auth create-token --perm admin
kill $PID
echo '
# Default config:
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/1234/http"
RemoteListenAddress = "127.0.0.1:1234"
Timeout = "30s"
#
[Libp2p]
# ListenAddresses = ["/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/0"]
# AnnounceAddresses = []
# NoAnnounceAddresses = []
# ConnMgrLow = 150
# ConnMgrHigh = 180
# ConnMgrGrace = "20s"
#
[Pubsub]
# Bootstrapper = false
# RemoteTracer = "/ip4/147.75.67.199/tcp/4001/p2p/QmTd6UvR47vUidRNZ1ZKXHrAFhqTJAD27rKL9XYghEKgKX"
#
[Client]
# UseIpfs = false
# IpfsMAddr = ""
# IpfsUseForRetrieval = false
#
[Metrics]
# Nickname = ""
# HeadNotifs = false
#' > ~/.lotus/config.toml
./lotus daemon --lotus-make-genesis=/root/dev.gen --genesis-template=/app/localnet.json --bootstrap=false &
sleep 5
./lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync
./lotus-miner run --nosync &
sleep 15
MAIN_WALLET="$(jq -r '.t01000.Owner' ~/.genesis-sectors/pre-seal-t01000.json)"
./lotus send --from $MAIN_WALLET t1ej2tountzqwnu6uswhqdzvw6yy5xvcig6rxl2qa 1000000
while :
do
sleep 10
done
================================================
FILE: infra/filecoin/user.key
================================================
7b2254797065223a22736563703235366b31222c22507269766174654b6579223a22756d6a634e436a487a5438455757485849754a4c4b58745035437153323435666238626c656c756e5448493d227d
================================================
FILE: infra/goerli/Dockerfile
================================================
FROM node:alpine
WORKDIR /root/app
COPY package.json .
RUN npm install
COPY hardhat.config.js .
COPY run.sh .
RUN chmod +x run.sh
EXPOSE 8545
ENTRYPOINT ["./run.sh"]
================================================
FILE: infra/goerli/hardhat.config.js
================================================
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.7.3",
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 5,
blockGasLimit: 15000000,
hardfork: "london",
mining: {
auto: false,
interval: 1000
},
accounts: {
mnemonic: "clutch captain shoe salt awake harvest setup primary inmate ugly among become",
count: 105
}
}
}
}
================================================
FILE: infra/goerli/package.json
================================================
{
"name": "hardhat-project",
"devDependencies": {
"hardhat": "^2.5.0"
}
}
================================================
FILE: infra/goerli/run.sh
================================================
#!/bin/sh
npx hardhat --config hardhat.config.js node
================================================
FILE: infra/polygon/Dockerfile
================================================
FROM maticnetwork/bor:master
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
RUN mkdir -p /root/.bor/keystore
COPY genesis.json /root/.bor/genesis.json
COPY nodekey /root/.bor/nodekey
COPY static-nodes.json /root/.bor/static-nodes.json
COPY json-keystore /root/.bor/keystore/UTC--2021-05-11T14-27-08.753Z--0xbf7A416377ed8f1F745A739C8ff59094EB2FEFD2
COPY password.txt /root/.bor/password.txt
ENTRYPOINT [ "./root/run.sh" ]
================================================
FILE: infra/polygon/genesis.json
================================================
{
"config": {
"chainId": 15001,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"bor": {
"period": 1,
"producerDelay": 4,
"sprint": 64,
"backupMultiplier": 1,
"validatorContract": "0x0000000000000000000000000000000000001000",
"stateReceiverContract": "0x0000000000000000000000000000000000001001"
}
},
"nonce": "0x0",
"timestamp": "0x5ce28211",
"extraData": "",
"gasLimit": "0x989680",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0000000000000000000000000000000000001000": {
"balance": "0x0",
"code": "0x608060405234801561001057600080fd5b50600436106101f05760003560e01c806360c8614d1161010f578063af26aa96116100a2578063d5b844eb11610071578063d5b844eb14610666578063dcf2793a14610684578063e3b7c924146106b6578063f59cf565146106d4576101f0565b8063af26aa96146105c7578063b71d7a69146105e7578063b7ab4db514610617578063c1b3c91914610636576101f0565b806370ba5707116100de57806370ba57071461052b57806398ab2b621461055b5780639d11b80714610579578063ae756451146105a9576101f0565b806360c8614d1461049c57806365b3a1e2146104bc57806366332354146104db578063687a9bd6146104f9576101f0565b80633434735f1161018757806344d6528f1161015657806344d6528f146103ee5780634dbc959f1461041e57806355614fcc1461043c578063582a8d081461046c576101f0565b80633434735f1461035257806335ddfeea1461037057806343ee8213146103a057806344c15cb1146103be576101f0565b806323f2a73f116101c357806323f2a73f146102a45780632bc06564146102d45780632de3a180146102f25780632eddf35214610322576101f0565b8063047a6c5b146101f55780630c35b1cb146102275780631270b5741461025857806323c2a2b414610288575b600080fd5b61020f600480360361020a9190810190612944565b610706565b60405161021e93929190613283565b60405180910390f35b610241600480360361023c9190810190612944565b61075d565b60405161024f9291906130a4565b60405180910390f35b610272600480360361026d919081019061296d565b610939565b60405161027f91906130db565b60405180910390f35b6102a2600480360361029d9190810190612a4c565b610a91565b005b6102be60048036036102b9919081019061296d565b61112a565b6040516102cb91906130db565b60405180910390f35b6102dc611281565b6040516102e99190613231565b60405180910390f35b61030c600480360361030791908101906128a1565b611286565b60405161031991906130f6565b60405180910390f35b61033c60048036036103379190810190612944565b611307565b6040516103499190613231565b60405180910390f35b61035a611437565b6040516103679190613089565b60405180910390f35b61038a600480360361038591908101906128dd565b61144f565b60405161039791906130db565b60405180910390f35b6103a861151a565b6040516103b591906130f6565b60405180910390f35b6103d860048036036103d391908101906129a9565b611531565b6040516103e59190613231565b60405180910390f35b6104086004803603610403919081019061296d565b611619565b6040516104159190613216565b60405180910390f35b610426611781565b6040516104339190613231565b60405180910390f35b61045660048036036104519190810190612826565b611791565b60405161046391906130db565b60405180910390f35b6104866004803603610481919081019061284f565b6117ab565b60405161049391906130f6565b60405180910390f35b6104a4611829565b6040516104b393929190613283565b60405180910390f35b6104c461189d565b6040516104d29291906130a4565b60405180910390f35b6104e361198e565b6040516104f09190613231565b60405180910390f35b610513600480360361050e9190810190612a10565b611993565b6040516105229392919061324c565b60405180910390f35b61054560048036036105409190810190612826565b6119f7565b60405161055291906130db565b60405180910390f35b610563611a11565b60405161057091906130f6565b60405180910390f35b610593600480360361058e9190810190612944565b611a28565b6040516105a09190613231565b60405180910390f35b6105b1611b59565b6040516105be91906130f6565b60405180910390f35b6105cf611b70565b6040516105de93929190613283565b60405180910390f35b61060160048036036105fc9190810190612944565b611bd1565b60405161060e9190613231565b60405180910390f35b61061f611cd1565b60405161062d9291906130a4565b60405180910390f35b610650600480360361064b9190810190612944565b611ce5565b60405161065d9190613231565b60405180910390f35b61066e611d06565b60405161067b91906132ba565b60405180910390f35b61069e60048036036106999190810190612a10565b611d0b565b6040516106ad9392919061324c565b60405180910390f35b6106be611d6f565b6040516106cb9190613231565b60405180910390f35b6106ee60048036036106e99190810190612944565b611d81565b6040516106fd93929190613283565b60405180910390f35b60008060006002600085815260200190815260200160002060000154600260008681526020019081526020016000206001015460026000878152602001908152602001600020600201549250925092509193909250565b60608060ff83116107795761077061189d565b91509150610934565b600061078484611bd1565b9050606060016000838152602001908152602001600020805490506040519080825280602002602001820160405280156107cd5781602001602082028038833980820191505090505b509050606060016000848152602001908152602001600020805490506040519080825280602002602001820160405280156108175781602001602082028038833980820191505090505b50905060008090505b60016000858152602001908152602001600020805490508110156109295760016000858152602001908152602001600020818154811061085c57fe5b906000526020600020906003020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683828151811061089a57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001600085815260200190815260200160002081815481106108f257fe5b90600052602060002090600302016001015482828151811061091057fe5b6020026020010181815250508080600101915050610820565b508181945094505050505b915091565b6000606060016000858152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610a0c578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505081526020019060010190610970565b50505050905060008090505b8151811015610a84578373ffffffffffffffffffffffffffffffffffffffff16828281518110610a4457fe5b60200260200101516040015173ffffffffffffffffffffffffffffffffffffffff161415610a7757600192505050610a8b565b8080600101915050610a18565b5060009150505b92915050565b73fffffffffffffffffffffffffffffffffffffffe73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0a906131f6565b60405180910390fd5b6000610b1d611781565b90506000811415610b3157610b30611dab565b5b610b456001826120cc90919063ffffffff16565b8814610b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7d90613176565b60405180910390fd5b868611610bc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbf906131d6565b60405180910390fd5b6000604060018989030181610bd957fe5b0614610c1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c11906131b6565b60405180910390fd5b8660026000838152602001908152602001600020600101541115610c73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6a90613156565b60405180910390fd5b6000600260008a81526020019081526020016000206000015414610ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc390613196565b60405180910390fd5b604051806060016040528089815260200188815260200187815250600260008a8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050600388908060018154018082558091505090600182039060005260206000200160009091929091909150555060008060008a815260200190815260200160002081610d669190612620565b506000600160008a815260200190815260200160002081610d879190612620565b506060610ddf610dda87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506120eb565b612119565b905060008090505b8151811015610f51576060610e0e838381518110610e0157fe5b6020026020010151612119565b90506000808c81526020019081526020016000208054809190600101610e349190612620565b506040518060600160405280610e5d83600081518110610e5057fe5b60200260200101516121f6565b8152602001610e7f83600181518110610e7257fe5b60200260200101516121f6565b8152602001610ea183600281518110610e9457fe5b6020026020010151612267565b73ffffffffffffffffffffffffffffffffffffffff168152506000808d81526020019081526020016000208381548110610ed757fe5b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050508080600101915050610de7565b506060610fa9610fa486868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506120eb565b612119565b905060008090505b815181101561111d576060610fd8838381518110610fcb57fe5b6020026020010151612119565b9050600160008d81526020019081526020016000208054809190600101610fff9190612620565b5060405180606001604052806110288360008151811061101b57fe5b60200260200101516121f6565b815260200161104a8360018151811061103d57fe5b60200260200101516121f6565b815260200161106c8360028151811061105f57fe5b6020026020010151612267565b73ffffffffffffffffffffffffffffffffffffffff16815250600160008e815260200190815260200160002083815481106110a357fe5b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050508080600101915050610fb1565b5050505050505050505050565b60006060600080858152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156111fc578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505081526020019060010190611160565b50505050905060008090505b8151811015611274578373ffffffffffffffffffffffffffffffffffffffff1682828151811061123457fe5b60200260200101516040015173ffffffffffffffffffffffffffffffffffffffff1614156112675760019250505061127b565b8080600101915050611208565b5060009150505b92915050565b604081565b60006002600160f81b84846040516020016112a393929190612ff6565b6040516020818303038152906040526040516112bf9190613033565b602060405180830381855afa1580156112dc573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506112ff9190810190612878565b905092915050565b60006060600080848152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156113d9578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250508152602001906001019061133d565b505050509050600080905060008090505b825181101561142c5761141d83828151811061140257fe5b602002602001015160200151836120cc90919063ffffffff16565b915080806001019150506113ea565b508092505050919050565b73fffffffffffffffffffffffffffffffffffffffe81565b600080600080859050600060218087518161146657fe5b04029050600081111561147f5761147c876117ab565b91505b6000602190505b818111611509576000600182038801519050818801519550806000602081106114ab57fe5b1a60f81b9450600060f81b857effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156114f0576114e98685611286565b93506114fd565b6114fa8487611286565b93505b50602181019050611486565b508782149450505050509392505050565b6040516115269061305f565b604051809103902081565b60008060009050600080905060008090505b84518167ffffffffffffffff16101561160c57606061156e868367ffffffffffffffff16604161228a565b90506000611585828961231690919063ffffffff16565b905061158f612652565b6115998a83611619565b90506115a58a8361112a565b80156115dc57508473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16115b156115fe578194506115fb8160200151876120cc90919063ffffffff16565b95505b505050604181019050611543565b5081925050509392505050565b611621612652565b6060600080858152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156116f1578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505081526020019060010190611655565b50505050905060008090505b8151811015611779578373ffffffffffffffffffffffffffffffffffffffff1682828151811061172957fe5b60200260200101516040015173ffffffffffffffffffffffffffffffffffffffff16141561176c5781818151811061175d57fe5b60200260200101519250611779565b80806001019150506116fd565b505092915050565b600061178c43611bd1565b905090565b60006117a461179e611781565b8361112a565b9050919050565b60006002600060f81b836040516020016117c6929190612fca565b6040516020818303038152906040526040516117e29190613033565b602060405180830381855afa1580156117ff573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506118229190810190612878565b9050919050565b60008060008061184a600161183c611781565b6120cc90919063ffffffff16565b905060026000828152602001908152602001600020600001546002600083815260200190815260200160002060010154600260008481526020019081526020016000206002015493509350935050909192565b606080606060016040519080825280602002602001820160405280156118d25781602001602082028038833980820191505090505b50905073bf7a416377ed8f1f745a739c8ff59094eb2fefd2816000815181106118f757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050606060016040519080825280602002602001820160405280156119635781602001602082028038833980820191505090505b5090506127108160008151811061197657fe5b60200260200101818152505081819350935050509091565b60ff81565b600160205281600052604060002081815481106119ac57fe5b9060005260206000209060030201600091509150508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905083565b6000611a0a611a04611781565b83610939565b9050919050565b604051611a1d9061304a565b604051809103902081565b6000606060016000848152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015611afb578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152505081526020019060010190611a5f565b505050509050600080905060008090505b8251811015611b4e57611b3f838281518110611b2457fe5b602002602001015160200151836120cc90919063ffffffff16565b91508080600101915050611b0c565b508092505050919050565b604051611b6590613074565b604051809103902081565b600080600080611b7e611781565b905060026000828152602001908152602001600020600001546002600083815260200190815260200160002060010154600260008481526020019081526020016000206002015493509350935050909192565b60008060038054905090505b6000811115611c9157611bee612689565b6002600060036001850381548110611c0257fe5b906000526020600020015481526020019081526020016000206040518060600160405290816000820154815260200160018201548152602001600282015481525050905083816020015111158015611c5f57506000816040015114155b8015611c6f575080604001518411155b15611c8257806000015192505050611ccc565b50808060019003915050611bdd565b5060006003805490501115611cc757600360016003805490500381548110611cb557fe5b90600052602060002001549050611ccc565b600090505b919050565b606080611cdd4361075d565b915091509091565b60038181548110611cf257fe5b906000526020600020016000915090505481565b600281565b60006020528160005260406000208181548110611d2457fe5b9060005260206000209060030201600091509150508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905083565b600060404381611d7b57fe5b04905090565b60026020528060005260406000206000915090508060000154908060010154908060020154905083565b606080611db661189d565b8092508193505050600080905060405180606001604052808281526020016000815260200160ff815250600260008381526020019081526020016000206000820151816000015560208201518160010155604082015181600201559050506003819080600181540180825580915050906001820390600052602060002001600090919290919091505550600080600083815260200190815260200160002081611e5f9190612620565b5060006001600083815260200190815260200160002081611e809190612620565b5060008090505b8351811015611fa2576000808381526020019081526020016000208054809190600101611eb49190612620565b506040518060600160405280828152602001848381518110611ed257fe5b60200260200101518152602001858381518110611eeb57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168152506000808481526020019081526020016000208281548110611f2957fe5b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050508080600101915050611e87565b5060008090505b83518110156120c657600160008381526020019081526020016000208054809190600101611fd79190612620565b506040518060600160405280828152602001848381518110611ff557fe5b6020026020010151815260200185838151811061200e57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681525060016000848152602001908152602001600020828154811061204d57fe5b9060005260206000209060030201600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050508080600101915050611fa9565b50505050565b6000808284019050838110156120e157600080fd5b8091505092915050565b6120f36126aa565b600060208301905060405180604001604052808451815260200182815250915050919050565b606061212482612420565b61212d57600080fd5b60006121388361246e565b905060608160405190808252806020026020018201604052801561217657816020015b6121636126c4565b81526020019060019003908161215b5790505b509050600061218885602001516124df565b8560200151019050600080600090505b848110156121e9576121a983612568565b91506040518060400160405280838152602001848152508482815181106121cc57fe5b602002602001018190525081830192508080600101915050612198565b5082945050505050919050565b600080826000015111801561221057506021826000015111155b61221957600080fd5b600061222883602001516124df565b9050600081846000015103905060008083866020015101905080519150602083101561225b57826020036101000a820491505b81945050505050919050565b6000601582600001511461227a57600080fd5b612283826121f6565b9050919050565b60608183018451101561229c57600080fd5b60608215600081146122b95760405191506020820160405261230a565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156122f757805183526020830192506020810190506122da565b50868552601f19601f8301166040525050505b50809150509392505050565b6000806000806041855114612331576000935050505061241a565b602085015192506040850151915060ff6041860151169050601b8160ff16101561235c57601b810190505b601b8160ff16141580156123745750601c8160ff1614155b15612385576000935050505061241a565b6000600187838686604051600081526020016040526040516123aa9493929190613111565b6020604051602081039080840390855afa1580156123cc573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561241257600080fd5b809450505050505b92915050565b600080826000015114156124375760009050612469565b60008083602001519050805160001a915060c060ff168260ff16101561246257600092505050612469565b6001925050505b919050565b6000808260000151141561248557600090506124da565b6000809050600061249984602001516124df565b84602001510190506000846000015185602001510190505b808210156124d3576124c282612568565b8201915082806001019350506124b1565b8293505050505b919050565b600080825160001a9050608060ff168110156124ff576000915050612563565b60b860ff16811080612524575060c060ff168110158015612523575060f860ff1681105b5b15612533576001915050612563565b60c060ff168110156125535760018060b80360ff16820301915050612563565b60018060f80360ff168203019150505b919050565b6000806000835160001a9050608060ff168110156125895760019150612616565b60b860ff168110156125a6576001608060ff168203019150612615565b60c060ff168110156125d65760b78103600185019450806020036101000a85510460018201810193505050612614565b60f860ff168110156125f357600160c060ff168203019150612613565b60f78103600185019450806020036101000a855104600182018101935050505b5b5b5b8192505050919050565b81548183558181111561264d5760030281600302836000526020600020918201910161264c91906126de565b5b505050565b60405180606001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b60405180606001604052806000815260200160008152602001600081525090565b604051806040016040528060008152602001600081525090565b604051806040016040528060008152602001600081525090565b61273191905b8082111561272d5760008082016000905560018201600090556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506003016126e4565b5090565b90565b600081359050612743816134b3565b92915050565b600081359050612758816134ca565b92915050565b60008151905061276d816134ca565b92915050565b60008083601f84011261278557600080fd5b8235905067ffffffffffffffff81111561279e57600080fd5b6020830191508360018202830111156127b657600080fd5b9250929050565b600082601f8301126127ce57600080fd5b81356127e16127dc82613302565b6132d5565b915080825260208301602083018583830111156127fd57600080fd5b61280883828461345d565b50505092915050565b600081359050612820816134e1565b92915050565b60006020828403121561283857600080fd5b600061284684828501612734565b91505092915050565b60006020828403121561286157600080fd5b600061286f84828501612749565b91505092915050565b60006020828403121561288a57600080fd5b60006128988482850161275e565b91505092915050565b600080604083850312156128b457600080fd5b60006128c285828601612749565b92505060206128d385828601612749565b9150509250929050565b6000806000606084860312156128f257600080fd5b600061290086828701612749565b935050602061291186828701612749565b925050604084013567ffffffffffffffff81111561292e57600080fd5b61293a868287016127bd565b9150509250925092565b60006020828403121561295657600080fd5b600061296484828501612811565b91505092915050565b6000806040838503121561298057600080fd5b600061298e85828601612811565b925050602061299f85828601612734565b9150509250929050565b6000806000606084860312156129be57600080fd5b60006129cc86828701612811565b93505060206129dd86828701612749565b925050604084013567ffffffffffffffff8111156129fa57600080fd5b612a06868287016127bd565b9150509250925092565b60008060408385031215612a2357600080fd5b6000612a3185828601612811565b9250506020612a4285828601612811565b9150509250929050565b600080600080600080600060a0888a031215612a6757600080fd5b6000612a758a828b01612811565b9750506020612a868a828b01612811565b9650506040612a978a828b01612811565b955050606088013567ffffffffffffffff811115612ab457600080fd5b612ac08a828b01612773565b9450945050608088013567ffffffffffffffff811115612adf57600080fd5b612aeb8a828b01612773565b925092505092959891949750929550565b6000612b088383612b2c565b60208301905092915050565b6000612b208383612f9d565b60208301905092915050565b612b35816133d2565b82525050565b612b44816133d2565b82525050565b6000612b558261334e565b612b5f8185613389565b9350612b6a8361332e565b8060005b83811015612b9b578151612b828882612afc565b9750612b8d8361336f565b925050600181019050612b6e565b5085935050505092915050565b6000612bb382613359565b612bbd818561339a565b9350612bc88361333e565b8060005b83811015612bf9578151612be08882612b14565b9750612beb8361337c565b925050600181019050612bcc565b5085935050505092915050565b612c0f816133e4565b82525050565b612c26612c21826133f0565b61349f565b82525050565b612c358161341c565b82525050565b612c4c612c478261341c565b6134a9565b82525050565b6000612c5d82613364565b612c6781856133ab565b9350612c7781856020860161346c565b80840191505092915050565b6000612c906004836133c7565b91507f766f7465000000000000000000000000000000000000000000000000000000006000830152600482019050919050565b6000612cd0602d836133b6565b91507f537461727420626c6f636b206d7573742062652067726561746572207468616e60008301527f2063757272656e74207370616e000000000000000000000000000000000000006020830152604082019050919050565b6000612d36600f836133b6565b91507f496e76616c6964207370616e20696400000000000000000000000000000000006000830152602082019050919050565b6000612d766013836133b6565b91507f5370616e20616c726561647920657869737473000000000000000000000000006000830152602082019050919050565b6000612db66045836133b6565b91507f446966666572656e6365206265747765656e20737461727420616e6420656e6460008301527f20626c6f636b206d75737420626520696e206d756c7469706c6573206f66207360208301527f7072696e740000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000612e42602a836133b6565b91507f456e6420626c6f636b206d7573742062652067726561746572207468616e207360008301527f7461727420626c6f636b000000000000000000000000000000000000000000006020830152604082019050919050565b6000612ea8600e836133c7565b91507f6865696d64616c6c2d31353030310000000000000000000000000000000000006000830152600e82019050919050565b6000612ee86005836133c7565b91507f31353030310000000000000000000000000000000000000000000000000000006000830152600582019050919050565b6000612f286012836133b6565b91507f4e6f742053797374656d204164646573732100000000000000000000000000006000830152602082019050919050565b606082016000820151612f716000850182612f9d565b506020820151612f846020850182612f9d565b506040820151612f976040850182612b2c565b50505050565b612fa681613446565b82525050565b612fb581613446565b82525050565b612fc481613450565b82525050565b6000612fd68285612c15565b600182019150612fe68284612c3b565b6020820191508190509392505050565b60006130028286612c15565b6001820191506130128285612c3b565b6020820191506130228284612c3b565b602082019150819050949350505050565b600061303f8284612c52565b915081905092915050565b600061305582612c83565b9150819050919050565b600061306a82612e9b565b9150819050919050565b600061307f82612edb565b9150819050919050565b600060208201905061309e6000830184612b3b565b92915050565b600060408201905081810360008301526130be8185612b4a565b905081810360208301526130d28184612ba8565b90509392505050565b60006020820190506130f06000830184612c06565b92915050565b600060208201905061310b6000830184612c2c565b92915050565b60006080820190506131266000830187612c2c565b6131336020830186612fbb565b6131406040830185612c2c565b61314d6060830184612c2c565b95945050505050565b6000602082019050818103600083015261316f81612cc3565b9050919050565b6000602082019050818103600083015261318f81612d29565b9050919050565b600060208201905081810360008301526131af81612d69565b9050919050565b600060208201905081810360008301526131cf81612da9565b9050919050565b600060208201905081810360008301526131ef81612e35565b9050919050565b6000602082019050818103600083015261320f81612f1b565b9050919050565b600060608201905061322b6000830184612f5b565b92915050565b60006020820190506132466000830184612fac565b92915050565b60006060820190506132616000830186612fac565b61326e6020830185612fac565b61327b6040830184612b3b565b949350505050565b60006060820190506132986000830186612fac565b6132a56020830185612fac565b6132b26040830184612fac565b949350505050565b60006020820190506132cf6000830184612fbb565b92915050565b6000604051905081810181811067ffffffffffffffff821117156132f857600080fd5b8060405250919050565b600067ffffffffffffffff82111561331957600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006133dd82613426565b9050919050565b60008115159050919050565b60007fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b8381101561348a57808201518184015260208101905061346f565b83811115613499576000848401525b50505050565b6000819050919050565b6000819050919050565b6134bc816133d2565b81146134c757600080fd5b50565b6134d38161341c565b81146134de57600080fd5b50565b6134ea81613446565b81146134f557600080fd5b5056fea365627a7a72315820421f0e2879cc0d2332ed8ec9bd7d2e5227bba908a312849a3318dfaf3b5bd3106c6578706572696d656e74616cf564736f6c634300050b0040"
},
"0000000000000000000000000000000000001001": {
"balance": "0x0",
"code": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806319494a17146100465780633434735f146100e15780635407ca671461012b575b600080fd5b6100c76004803603604081101561005c57600080fd5b81019080803590602001909291908035906020019064010000000081111561008357600080fd5b82018360208201111561009557600080fd5b803590602001918460018302840111640100000000831117156100b757600080fd5b9091929391929390505050610149565b604051808215151515815260200191505060405180910390f35b6100e961047a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610133610492565b6040518082815260200191505060405180910390f35b600073fffffffffffffffffffffffffffffffffffffffe73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f742053797374656d2041646465737321000000000000000000000000000081525060200191505060405180910390fd5b606061025761025285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610498565b6104c6565b905060006102788260008151811061026b57fe5b60200260200101516105a3565b905080600160005401146102f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f537461746549647320617265206e6f742073657175656e7469616c000000000081525060200191505060405180910390fd5b600080815480929190600101919050555060006103248360018151811061031757fe5b6020026020010151610614565b905060606103458460028151811061033857fe5b6020026020010151610637565b9050610350826106c3565b1561046f576000624c4b409050606084836040516024018083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156103aa57808201518184015260208101905061038f565b50505050905090810190601f1680156103d75780820380516001836020036101000a031916815260200191505b5093505050506040516020818303038152906040527f26c53bea000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060008082516020840160008887f1965050505b505050509392505050565b73fffffffffffffffffffffffffffffffffffffffe81565b60005481565b6104a0610943565b600060208301905060405180604001604052808451815260200182815250915050919050565b60606104d1826106dc565b6104da57600080fd5b60006104e58361072a565b905060608160405190808252806020026020018201604052801561052357816020015b61051061095d565b8152602001906001900390816105085790505b5090506000610535856020015161079b565b8560200151019050600080600090505b848110156105965761055683610824565b915060405180604001604052808381526020018481525084828151811061057957fe5b602002602001018190525081830192508080600101915050610545565b5082945050505050919050565b60008082600001511180156105bd57506021826000015111155b6105c657600080fd5b60006105d5836020015161079b565b9050600081846000015103905060008083866020015101905080519150602083101561060857826020036101000a820491505b81945050505050919050565b6000601582600001511461062757600080fd5b610630826105a3565b9050919050565b6060600082600001511161064a57600080fd5b6000610659836020015161079b565b905060008184600001510390506060816040519080825280601f01601f19166020018201604052801561069b5781602001600182028038833980820191505090505b50905060008160200190506106b78487602001510182856108dc565b81945050505050919050565b600080823b905060008163ffffffff1611915050919050565b600080826000015114156106f35760009050610725565b60008083602001519050805160001a915060c060ff168260ff16101561071e57600092505050610725565b6001925050505b919050565b600080826000015114156107415760009050610796565b60008090506000610755846020015161079b565b84602001510190506000846000015185602001510190505b8082101561078f5761077e82610824565b82019150828060010193505061076d565b8293505050505b919050565b600080825160001a9050608060ff168110156107bb57600091505061081f565b60b860ff168110806107e0575060c060ff1681101580156107df575060f860ff1681105b5b156107ef57600191505061081f565b60c060ff1681101561080f5760018060b80360ff1682030191505061081f565b60018060f80360ff168203019150505b919050565b6000806000835160001a9050608060ff1681101561084557600191506108d2565b60b860ff16811015610862576001608060ff1682030191506108d1565b60c060ff168110156108925760b78103600185019450806020036101000a855104600182018101935050506108d0565b60f860ff168110156108af57600160c060ff1682030191506108cf565b60f78103600185019450806020036101000a855104600182018101935050505b5b5b5b8192505050919050565b60008114156108ea5761093e565b5b602060ff16811061091a5782518252602060ff1683019250602060ff1682019150602060ff16810390506108eb565b6000600182602060ff16036101000a03905080198451168184511681811785525050505b505050565b604051806040016040528060008152602001600081525090565b60405180604001604052806000815260200160008152509056fea265627a7a7231582083fbdacb76f32b4112d0f7db9a596937925824798a0026ba0232322390b5263764736f6c634300050b0032"
},
"0000000000000000000000000000000000001010": {
"balance": "0x204fce28085b549b31600000",
"code": "0x60806040526004361061019c5760003560e01c806377d32e94116100ec578063acd06cb31161008a578063e306f77911610064578063e306f77914610a7b578063e614d0d614610aa6578063f2fde38b14610ad1578063fc0c546a14610b225761019c565b8063acd06cb31461097a578063b789543c146109cd578063cc79f97b14610a505761019c565b80639025e64c116100c65780639025e64c146107c957806395d89b4114610859578063a9059cbb146108e9578063abceeba21461094f5761019c565b806377d32e94146106315780638da5cb5b146107435780638f32d59b1461079a5761019c565b806347e7ef24116101595780637019d41a116101335780637019d41a1461053357806370a082311461058a578063715018a6146105ef578063771282f6146106065761019c565b806347e7ef2414610410578063485cc9551461046b57806360f96a8f146104dc5761019c565b806306fdde03146101a15780631499c5921461023157806318160ddd1461028257806319d27d9c146102ad5780632e1a7d4d146103b1578063313ce567146103df575b600080fd5b3480156101ad57600080fd5b506101b6610b79565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f65780820151818401526020810190506101db565b50505050905090810190601f1680156102235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023d57600080fd5b506102806004803603602081101561025457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb6565b005b34801561028e57600080fd5b50610297610c24565b6040518082815260200191505060405180910390f35b3480156102b957600080fd5b5061036f600480360360a08110156102d057600080fd5b81019080803590602001906401000000008111156102ed57600080fd5b8201836020820111156102ff57600080fd5b8035906020019184600183028401116401000000008311171561032157600080fd5b9091929391929390803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c3a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103dd600480360360208110156103c757600080fd5b8101908080359060200190929190505050610e06565b005b3480156103eb57600080fd5b506103f4610f58565b604051808260ff1660ff16815260200191505060405180910390f35b34801561041c57600080fd5b506104696004803603604081101561043357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f61565b005b34801561047757600080fd5b506104da6004803603604081101561048e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061111d565b005b3480156104e857600080fd5b506104f16111ec565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561053f57600080fd5b50610548611212565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059657600080fd5b506105d9600480360360208110156105ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611238565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b50610604611259565b005b34801561061257600080fd5b5061061b611329565b6040518082815260200191505060405180910390f35b34801561063d57600080fd5b506107016004803603604081101561065457600080fd5b81019080803590602001909291908035906020019064010000000081111561067b57600080fd5b82018360208201111561068d57600080fd5b803590602001918460018302840111640100000000831117156106af57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061132f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074f57600080fd5b506107586114b4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107a657600080fd5b506107af6114dd565b604051808215151515815260200191505060405180910390f35b3480156107d557600080fd5b506107de611534565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561081e578082015181840152602081019050610803565b50505050905090810190601f16801561084b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561086557600080fd5b5061086e61156d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108ae578082015181840152602081019050610893565b50505050905090810190601f1680156108db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610935600480360360408110156108ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115aa565b604051808215151515815260200191505060405180910390f35b34801561095b57600080fd5b506109646115d0565b6040518082815260200191505060405180910390f35b34801561098657600080fd5b506109b36004803603602081101561099d57600080fd5b810190808035906020019092919050505061165d565b604051808215151515815260200191505060405180910390f35b3480156109d957600080fd5b50610a3a600480360360808110156109f057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919050505061167d565b6040518082815260200191505060405180910390f35b348015610a5c57600080fd5b50610a6561169d565b6040518082815260200191505060405180910390f35b348015610a8757600080fd5b50610a906116a3565b6040518082815260200191505060405180910390f35b348015610ab257600080fd5b50610abb6116a9565b6040518082815260200191505060405180910390f35b348015610add57600080fd5b50610b2060048036036020811015610af457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611736565b005b348015610b2e57600080fd5b50610b37611753565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60606040518060400160405280600b81526020017f4d6174696320546f6b656e000000000000000000000000000000000000000000815250905090565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f44697361626c656420666561747572650000000000000000000000000000000081525060200191505060405180910390fd5b6000601260ff16600a0a6402540be40002905090565b6000808511610c4857600080fd5b6000831480610c575750824311155b610cc9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5369676e6174757265206973206578706972656400000000000000000000000081525060200191505060405180910390fd5b6000610cd73387878761167d565b9050600015156005600083815260200190815260200160002060009054906101000a900460ff16151514610d73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f536967206465616374697661746564000000000000000000000000000000000081525060200191505060405180910390fd5b60016005600083815260200190815260200160002060006101000a81548160ff021916908315150217905550610ded8189898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061132f565b9150610dfa828488611779565b50509695505050505050565b60003390506000610e1682611238565b9050610e2d83600654611b3690919063ffffffff16565b600681905550600083118015610e4257508234145b610eb4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e73756666696369656e7420616d6f756e740000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167febff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f8584610f3087611238565b60405180848152602001838152602001828152602001935050505060405180910390a3505050565b60006012905090565b610f696114dd565b610f7257600080fd5b600081118015610faf5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b611004576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611f046023913960400191505060405180910390fd5b600061100f83611238565b905060008390508073ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015801561105c573d6000803e3d6000fd5b5061107283600654611b5690919063ffffffff16565b6006819055508373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f4e2ca0515ed1aef1395f66b5303bb5d6f1bf9d61a353fa53f73f8ac9973fa9f685856110f489611238565b60405180848152602001838152602001828152602001935050505060405180910390a350505050565b600760009054906101000a900460ff1615611183576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ee16023913960400191505060405180910390fd5b6001600760006101000a81548160ff02191690831515021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506111e882611b75565b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b6112616114dd565b61126a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60065481565b600080600080604185511461134a57600093505050506114ae565b602085015192506040850151915060ff6041860151169050601b8160ff16101561137557601b810190505b601b8160ff161415801561138d5750601c8160ff1614155b1561139e57600093505050506114ae565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156113fb573d6000803e3d6000fd5b505050602060405103519350600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4572726f7220696e2065637265636f766572000000000000000000000000000081525060200191505060405180910390fd5b5050505b92915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6040518060400160405280600281526020017f3a9900000000000000000000000000000000000000000000000000000000000081525081565b60606040518060400160405280600581526020017f4d41544943000000000000000000000000000000000000000000000000000000815250905090565b60008134146115bc57600090506115ca565b6115c7338484611779565b90505b92915050565b6040518060800160405280605b8152602001611f79605b91396040516020018082805190602001908083835b6020831061161f57805182526020820191506020810190506020830392506115fc565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012081565b60056020528060005260406000206000915054906101000a900460ff1681565b600061169361168e86868686611c6d565b611d43565b9050949350505050565b613a9981565b60015481565b604051806080016040528060528152602001611f27605291396040516020018082805190602001908083835b602083106116f857805182526020820191506020810190506020830392506116d5565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012081565b61173e6114dd565b61174757600080fd5b61175081611b75565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000803073ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156117f957600080fd5b505afa15801561180d573d6000803e3d6000fd5b505050506040513d602081101561182357600080fd5b8101908080519060200190929190505050905060003073ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156118b557600080fd5b505afa1580156118c9573d6000803e3d6000fd5b505050506040513d60208110156118df57600080fd5b810190808051906020019092919050505090506118fd868686611d8d565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c48786863073ffffffffffffffffffffffffffffffffffffffff166370a082318e6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a0557600080fd5b505afa158015611a19573d6000803e3d6000fd5b505050506040513d6020811015611a2f57600080fd5b81019080805190602001909291905050503073ffffffffffffffffffffffffffffffffffffffff166370a082318e6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611abd57600080fd5b505afa158015611ad1573d6000803e3d6000fd5b505050506040513d6020811015611ae757600080fd5b8101908080519060200190929190505050604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a46001925050509392505050565b600082821115611b4557600080fd5b600082840390508091505092915050565b600080828401905083811015611b6b57600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611baf57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806040518060800160405280605b8152602001611f79605b91396040516020018082805190602001908083835b60208310611cbf5780518252602082019150602081019050602083039250611c9c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120905060405181815273ffffffffffffffffffffffffffffffffffffffff8716602082015285604082015284606082015283608082015260a0812092505081915050949350505050565b60008060015490506040517f190100000000000000000000000000000000000000000000000000000000000081528160028201528360228201526042812092505081915050919050565b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f63616e27742073656e6420746f204d524332300000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e75573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fe54686520636f6e747261637420697320616c726561647920696e697469616c697a6564496e73756666696369656e7420616d6f756e74206f7220696e76616c69642075736572454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429546f6b656e5472616e736665724f726465722861646472657373207370656e6465722c75696e7432353620746f6b656e49644f72416d6f756e742c6279746573333220646174612c75696e743235362065787069726174696f6e29a265627a7a72315820bb602c3c6bcd412ef9bc4b050494e16a2ec21725618669ec9857d8853ab3333a64736f6c634300050b0032"
},
"bf7A416377ed8f1F745A739C8ff59094EB2FEFD2": {
"balance": "0x3635c9adc5dea00000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
================================================
FILE: infra/polygon/json-keystore
================================================
{
"version": 3,
"id": "6f3e9ee2-0db1-464b-8977-3d6dab963efa",
"address": "bf7a416377ed8f1f745a739c8ff59094eb2fefd2",
"crypto": {
"ciphertext": "8bce0b16e5b34d3cf5f9090e49253450e39f8c56a2e7344514e9d81b1db51c0b",
"cipherparams": {
"iv": "df9eaeaedbf9ee8c29c1416db77abaff"
},
"cipher": "aes-128-ctr",
"kdf": "scrypt",
"kdfparams": {
"dklen": 32,
"salt": "b30d9d712a504e7c96d4331b351b38ce5e121b6d4d33290345ab2def479fb408",
"n": 8192,
"r": 8,
"p": 1
},
"mac": "b5465c6825699d4e441454cba0e8cc508c07438077c359ab0ca516ace51f0218"
}
}
================================================
FILE: infra/polygon/nodekey
================================================
bf7f3c94e16d94784358f555c2ac58ea9f77f009816af471a0aab815d5578848
================================================
FILE: infra/polygon/password.txt
================================================
password0
================================================
FILE: infra/polygon/run.sh
================================================
#!/bin/sh
NODE_DIR=/root/.bor
DATA_DIR=/root/.bor/data
ADDRESS="bf7A416377ed8f1F745A739C8ff59094EB2FEFD2"
bor --datadir $DATA_DIR init $NODE_DIR/genesis.json
cp $NODE_DIR/nodekey $DATA_DIR/bor/
cp $NODE_DIR/static-nodes.json $DATA_DIR/bor/
bor --nousb \
--datadir $DATA_DIR \
--port 30303 \
--bor.withoutheimdall \
--http --http.addr '0.0.0.0' \
--http.vhosts '*' \
--http.corsdomain '*' \
--http.port 8545 \
--http.api 'personal,eth,net,web3,txpool,miner,admin,bor' \
--syncmode 'full' \
--networkid '15001' \
--miner.gaslimit '2000000000' \
--txpool.nolocals \
--txpool.accountslots '128' \
--txpool.globalslots '20000' \
--txpool.lifetime '0h16m0s' \
--unlock $ADDRESS \
--keystore $NODE_DIR/keystore \
--password $NODE_DIR/password.txt \
--allow-insecure-unlock \
--mine
================================================
FILE: infra/polygon/static-nodes.json
================================================
[
"enode://344282ecde713de509be84a6aa0e65d2b36c9a8475373ef0b62dc3e086eacf4b58083c65eaf039f1097d80048699643a05aeea215afe97c27170346501f16fac@172.20.1.100:30303"
]
================================================
FILE: infra/terra/Dockerfile
================================================
FROM ubuntu:xenial
RUN apt-get update --fix-missing && apt-get install --yes software-properties-common build-essential wget curl git
RUN wget -c https://golang.org/dl/go1.16.8.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go1.16.8.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
WORKDIR /app
RUN git clone https://github.com/terra-money/classic-core.git
WORKDIR /app/classic-core
RUN git fetch --all -p
RUN git checkout v0.5.5
RUN make install
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
EXPOSE 26657
ENV PATH=$PATH:/root/go/bin
WORKDIR /
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/terra/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Print setup
echo "TERRA_ADDRESS=$ADDRESS"
# Register client key
terrad keys add validator --keyring-backend=test
echo $(terrad keys show validator --keyring-backend=test)
# Initialize tesnet
terrad init testnet --chain-id testnet
terrad add-genesis-account $(terrad keys show validator -a --keyring-backend=test) 10000000000uluna
terrad add-genesis-account $ADDRESS 10000000000uluna,10000000000ukrw,10000000000uusd,10000000000usdr,10000000000umnt
terrad gentx validator 10000000000uluna --keyring-backend=test --chain-id=testnet
terrad collect-gentxs
# Start terrad
terrad start --rpc.laddr "tcp://0.0.0.0:26657"
================================================
FILE: infra/zcash/Dockerfile
================================================
FROM debian:buster
# Install zcashd.
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-transport-https gnupg2 ca-certificates wget && \
wget -qO - https://apt.z.cash/zcash.asc | apt-key add - && \
echo "deb [arch=amd64] https://apt.z.cash/ buster main" | tee /etc/apt/sources.list.d/zcash.list && \
apt-get update && apt-get install -y --no-install-recommends zcash && \
mkdir -p /root/.zcash-params && zcash-fetch-params
COPY zcash.conf /root/.zcash/zcash.conf
COPY run.sh /root/run.sh
RUN chmod +x /root/run.sh
EXPOSE 18232
ENTRYPOINT ["./root/run.sh"]
================================================
FILE: infra/zcash/run.sh
================================================
#!/bin/bash
ADDRESS=$1
# Start
zcashd \
-mineraddress=$ADDRESS \
-nuparams=5ba81b19:10 \
-nuparams=76b809bb:20 \
-nuparams=2bb40e60:30 \
-nuparams=f5b9230b:40 \
-nuparams=e9ff75a6:50 \
-nuparams=c2d6d0b4:60
sleep 20
echo "ZCASH_ADDRESS=$ADDRESS"
# Import the address
zcash-cli importaddress $ADDRESS
# Generate enough block to pass the maturation tim=
zcash-cli generate 101
# Simulate mining
while :
do
zcash-cli generate 1
sleep 10
done
================================================
FILE: infra/zcash/zcash.conf
================================================
daemon=1
regtest=1
rpcuser=user
rpcpassword=password
rpcallowip=0.0.0.0/0
rpcport=18232
server=1
txindex=1
gen=1
minetolocalwallet=0
================================================
FILE: multichain.go
================================================
// Package multichain defines all supported assets and chains. It also
// re-exports the individual multichain APIs.
package multichain
import (
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/api/address"
"github.com/renproject/multichain/api/contract"
"github.com/renproject/multichain/api/gas"
"github.com/renproject/multichain/api/utxo"
"github.com/renproject/surge"
)
type (
// An Address is a human-readable representation of a public identity. It can
// be the address of an external account, contract, or script.
Address = address.Address
// The AddressEncodeDecoder interfaces combines encoding and decoding
// functionality into one interface.
AddressEncodeDecoder = address.EncodeDecoder
// RawAddress is an address that has been decoded into its binary form.
RawAddress = address.RawAddress
)
type (
// The AccountTx interface defines the functionality that must be exposed by
// account-based transactions.
AccountTx = account.Tx
// The AccountTxBuilder interface defines the functionality required to build
// account-based transactions. Most chain implementations require additional
// information, and this should be accepted during the construction of the
// chain-specific transaction builder.
AccountTxBuilder = account.TxBuilder
// The AccountClient interface defines the functionality required to interact
// with a chain over RPC.
AccountClient = account.Client
)
type (
// A UTXOutpoint identifies a specific output produced by a transaction.
UTXOutpoint = utxo.Outpoint
// A UTXOutput is produced by a transaction. It includes the conditions
// required to spend the output (called the pubkey script, based on Bitcoin).
UTXOutput = utxo.Output
// A UTXOInput specifies an existing output, produced by a previous
// transaction, to be consumed by another transaction. It includes the script
// that meets the conditions specified by the consumed output (called the sig
// script, based on Bitcoin).
UTXOInput = utxo.Input
// A UTXORecipient specifies an address, and an amount, for which a
// transaction will produce an output. Depending on the output, the address
// can take on different formats (e.g. in Bitcoin, addresses can be P2PK,
// P2PKH, or P2SH).
UTXORecipient = utxo.Recipient
// A UTXOTx interfaces defines the functionality that must be exposed by
// utxo-based transactions.
UTXOTx = utxo.Tx
// A UTXOTxBuilder interface defines the functionality required to build
// account-based transactions. Most chain implementations require additional
// information, and this should be accepted during the construction of the
// chain-specific transaction builder.
UTXOTxBuilder = utxo.TxBuilder
// A UTXOClient interface defines the functionality required to interact with
// a chain over RPC.
UTXOClient = utxo.Client
)
type (
// ContractCallData is used to specify a function and its parameters when
// invoking business logic on a contract.
ContractCallData = contract.CallData
// The ContractCaller interface defines the functionality required to call
// readonly functions on a contract. Calling functions that mutate contract
// state should be done using the Account API.
ContractCaller = contract.Caller
)
type (
// The GasEstimator interface defines the functionality required to know the
// current recommended gas prices.
GasEstimator = gas.Estimator
)
// An Asset uniquely identifies assets using human-readable strings.
type Asset string
// Enumeration of supported assets. When introducing a new chain, or new asset
// from an existing chain, you must add a human-readable string to this set of
// enumerated values. Assets must be listed in alphabetical order.
const (
ArbETH = Asset("ArbETH") // Arbitrum Ether
AVAX = Asset("AVAX") // Avalanche
BCH = Asset("BCH") // Bitcoin Cash
BNB = Asset("BNB") // Binance Coin
BTC = Asset("BTC") // Bitcoin
CAT = Asset("CAT") // Catalog
DGB = Asset("DGB") // DigiByte
DOGE = Asset("DOGE") // Dogecoin
ETH = Asset("ETH") // Ether
FIL = Asset("FIL") // Filecoin
FTM = Asset("FTM") // Fantom
GETH = Asset("gETH") // Goerli Ether
GLMR = Asset("GLMR") // Glimmer
KAVA = Asset("KAVA") // Kava
LUNA = Asset("LUNA") // Luna
MATIC = Asset("MATIC") // Matic PoS (Polygon)
oETH = Asset("oETH") // Optimism Ether
SOL = Asset("SOL") // Solana
ZEC = Asset("ZEC") // Zcash
USDC_Avalanche = Asset("USDC_Avalanche") // Circle USD (Avalanche)
USDT_Avalanche = Asset("USDT_Avalanche") // Tether (Avalanche)
BADGER = Asset("BADGER") // Badger DAO
BUSD = Asset("BUSD") // Binance USD
CRV = Asset("CRV") // Curve
DAI = Asset("DAI") // Dai
EURT = Asset("EURT") // Euro Tether
FTT = Asset("FTT") // FTX
ibBTC = Asset("ibBTC") // Interest Bearing Bitcoin
KNC = Asset("KNC") // Kyber Network
LINK = Asset("LINK") // Chainlink
MIM = Asset("MIM") // Magic Internet Money
REN = Asset("REN") // Ren
ROOK = Asset("ROOK") // KeeperDAO
SUSHI = Asset("SUSHI") // Sushiswap
UNI = Asset("UNI") // Uniswap
USDC = Asset("USDC") // Circle USD (Ethereum)
USDT = Asset("USDT") // Tether (Ethereum)
DAI_Goerli = Asset("DAI_Goerli") // Dai (Goerli)
REN_Goerli = Asset("REN_Goerli") // Ren (Goerli)
USDC_Goerli = Asset("USDC_Goerli") // Circle USD (Goerli)
USDT_Goerli = Asset("USDT_Goerli") // Tether (Goerli)
USDC_Polygon = Asset("USDC_Polygon") // Circle USD (Polygon)
USDT_Polygon = Asset("USDT_Polygon") // Tether (Polygon)
// These assets are defined separately because they are mock assets. These
// assets should only be used for testing.
AMOCK1 = Asset("AMOCK1") // Account-based mock asset
AMOCK2 = Asset("AMOCK2") // Account-based mock asset
AMOCK3 = Asset("AMOCK3") // ERC-20 mock token asset on chain AccountMocker1
UMOCK = Asset("UMOCK") // UTXO-based mock asset
)
// AssetType represents the type of asset, whether native-asset of an account
// chain or a token on an account chain.
type AssetType string
const (
// AssetTypeNative is an identifier for all the native assets of account
// based chains namely. For instance, ETH for Ethereum, BNB for
// BinanceSmartChain.
AssetTypeNative = AssetType("NativeAsset")
// AssetTypeToken is an identifier for all tokens (ERC20, BEP20) deployed on
// programmable account-based chains. For instance, REN and USDC are ERC-20
// tokens on Ethereum.
AssetTypeToken = AssetType("TokenAsset")
)
// SizeHint returns the number of bytes required to represent the asset type in
// binary.
func (assetType AssetType) SizeHint() int {
return surge.SizeHintString(string(assetType))
}
// Marshal the asset type to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (assetType AssetType) Marshal(buf []byte, rem int) ([]byte, int, error) {
return surge.MarshalString(string(assetType), buf, rem)
}
// Unmarshal the asset type from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (assetType *AssetType) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return surge.UnmarshalString((*string)(assetType), buf, rem)
}
// OriginChain returns the chain upon which the asset originates. For example,
// the origin chain of BTC is Bitcoin.
func (asset Asset) OriginChain() Chain {
switch asset {
case ArbETH:
return Arbitrum
case AVAX:
return Avalanche
case BCH:
return BitcoinCash
case BNB:
return BinanceSmartChain
case BTC:
return Bitcoin
case CAT:
return Catalog
case DGB:
return DigiByte
case DOGE:
return Dogecoin
case ETH:
return Ethereum
case FIL:
return Filecoin
case FTM:
return Fantom
case GETH:
return Goerli
case GLMR:
return Moonbeam
case KAVA:
return Kava
case LUNA:
return Terra
case MATIC:
return Polygon
case oETH:
return Optimism
case SOL:
return Solana
case ZEC:
return Zcash
case USDC_Avalanche, USDT_Avalanche:
return Avalanche
case BADGER, BUSD, CRV, DAI, EURT, FTT, ibBTC, KNC, LINK, MIM, REN, ROOK,
SUSHI, UNI, USDC, USDT:
return Ethereum
case DAI_Goerli, REN_Goerli, USDC_Goerli, USDT_Goerli:
return Goerli
case USDC_Polygon, USDT_Polygon:
return Polygon
// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.
case AMOCK1, AMOCK3:
return AccountMocker1
case AMOCK2:
return AccountMocker2
case UMOCK:
return UTXOMocker
default:
return Chain("")
}
}
// ChainType returns the chain-type (Account or UTXO) for the given asset
func (asset Asset) ChainType() ChainType {
switch asset {
case BCH, BTC, DGB, DOGE, ZEC:
return ChainTypeUTXOBased
case ArbETH, AVAX, BNB, CAT, ETH, FIL, FTM, GETH, GLMR, KAVA, LUNA, MATIC,
oETH, SOL:
return ChainTypeAccountBased
case USDC_Avalanche, USDT_Avalanche:
return ChainTypeAccountBased
case BADGER, BUSD, CRV, DAI, EURT, FTT, ibBTC, KNC, LINK, MIM,
REN, ROOK, SUSHI, UNI, USDC, USDT:
return ChainTypeAccountBased
case DAI_Goerli, REN_Goerli, USDC_Goerli, USDT_Goerli:
return ChainTypeAccountBased
case USDC_Polygon, USDT_Polygon:
return ChainTypeAccountBased
// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.
case AMOCK1, AMOCK2, AMOCK3:
return ChainTypeAccountBased
case UMOCK:
return ChainTypeUTXOBased
default:
return ChainType("")
}
}
// Type returns the asset-type (Native or Token) for the given asset.
func (asset Asset) Type() AssetType {
switch asset {
case ArbETH, AVAX, BNB, CAT, ETH, FTM, GETH, GLMR, KAVA, MATIC, oETH, SOL:
return AssetTypeNative
case USDC_Avalanche, USDT_Avalanche:
return AssetTypeToken
case BADGER, BUSD, CRV, DAI, EURT, FTT, ibBTC, KNC, LINK, MIM,
REN, ROOK, SUSHI, UNI, USDC, USDT:
return AssetTypeToken
case DAI_Goerli, REN_Goerli, USDC_Goerli, USDT_Goerli:
return AssetTypeToken
case USDC_Polygon, USDT_Polygon:
return AssetTypeToken
// These assets are handled separately because they are mock assets. These
// assets should only be used for testing.
case AMOCK1, AMOCK2:
return AssetTypeNative
case AMOCK3:
return AssetTypeToken
default:
return AssetType("")
}
}
// SizeHint returns the number of bytes required to represent the asset in
// binary.
func (asset Asset) SizeHint() int {
return surge.SizeHintString(string(asset))
}
// Marshal the asset to binary.
func (asset Asset) Marshal(buf []byte, rem int) ([]byte, int, error) {
return surge.MarshalString(string(asset), buf, rem)
}
// Unmarshal the asset from binary.
func (asset *Asset) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return surge.UnmarshalString((*string)(asset), buf, rem)
}
// A Chain uniquely identifies a blockchain using a human-readable string.
type Chain string
// Enumeration of supported chains. When introducing a new chain, you must add a
// human-readable string to this set of enumerated values. Chains must be listed
// in alphabetical order.
const (
Arbitrum = Chain("Arbitrum")
Avalanche = Chain("Avalanche")
BinanceSmartChain = Chain("BinanceSmartChain")
Bitcoin = Chain("Bitcoin")
BitcoinCash = Chain("BitcoinCash")
Catalog = Chain("Catalog")
DigiByte = Chain("DigiByte")
Dogecoin = Chain("Dogecoin")
Ethereum = Chain("Ethereum")
Fantom = Chain("Fantom")
Filecoin = Chain("Filecoin")
Kava = Chain("Kava")
Moonbeam = Chain("Moonbeam")
Optimism = Chain("Optimism")
Polygon = Chain("Polygon")
Solana = Chain("Solana")
Terra = Chain("Terra")
Zcash = Chain("Zcash")
Kovan = Chain("Kovan")
Goerli = Chain("Goerli")
// These chains are defined separately because they are mock chains. These
// chains should only be used for testing.
AccountMocker1 = Chain("AccountMocker1")
AccountMocker2 = Chain("AccountMocker2")
UTXOMocker = Chain("UTXOMocker")
)
// SizeHint returns the number of bytes required to represent the chain in
// binary.
func (chain Chain) SizeHint() int {
return surge.SizeHintString(string(chain))
}
// Marshal the chain to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (chain Chain) Marshal(buf []byte, rem int) ([]byte, int, error) {
return surge.MarshalString(string(chain), buf, rem)
}
// Unmarshal the chain from binary. You should not call this function directly,
// unless you are implementing unmarshalling for a container type.
func (chain *Chain) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return surge.UnmarshalString((*string)(chain), buf, rem)
}
// ChainType returns the chain type (whether account-based or utxo-based chain)
// for the chain.
func (chain Chain) ChainType() ChainType {
switch chain {
case Bitcoin, BitcoinCash, DigiByte, Dogecoin, Zcash:
return ChainTypeUTXOBased
case Avalanche, BinanceSmartChain, Catalog, Ethereum, Arbitrum, Fantom,
Filecoin, Kava, Moonbeam, Optimism, Polygon, Solana, Terra:
return ChainTypeAccountBased
case Kovan, Goerli:
return ChainTypeAccountBased
// These chains are handled separately because they are mock chains. These
// chains should only be used for testing.
case AccountMocker1, AccountMocker2:
return ChainTypeAccountBased
case UTXOMocker:
return ChainTypeUTXOBased
default:
return ChainType("")
}
}
// IsAccountBased returns true when invoked on an account-based chain, otherwise
// returns false.
func (chain Chain) IsAccountBased() bool {
return chain.ChainType() == ChainTypeAccountBased
}
// IsUTXOBased returns true when invoked on a utxo-based chain, otherwise
// returns false.
func (chain Chain) IsUTXOBased() bool {
return chain.ChainType() == ChainTypeUTXOBased
}
// NativeAsset returns the underlying native asset for a chain. For example, the
// root asset of Bitcoin chain is BTC.
func (chain Chain) NativeAsset() Asset {
switch chain {
case Arbitrum:
return ArbETH
case Avalanche:
return AVAX
case BinanceSmartChain:
return BNB
case BitcoinCash:
return BCH
case Bitcoin:
return BTC
case Catalog:
return CAT
case DigiByte:
return DGB
case Dogecoin:
return DOGE
case Ethereum:
return ETH
case Fantom:
return FTM
case Filecoin:
return FIL
case Goerli:
return GETH
case Kava:
return KAVA
case Moonbeam:
return GLMR
case Polygon:
return MATIC
case Optimism:
return oETH
case Solana:
return SOL
case Terra:
return LUNA
case Zcash:
return ZEC
// These chains are handled separately because they are mock chains. These
// chains should only be used for testing.
case AccountMocker1:
return AMOCK1
case AccountMocker2:
return AMOCK2
case UTXOMocker:
return UMOCK
default:
return Asset("")
}
}
// ChainType represents the type of chain (whether account-based or utxo-based)
type ChainType string
const (
// ChainTypeAccountBased is an identifier for all account-based chains,
// namely, BinanceSmartChain, Ethereum, Filecoin, and so on.
ChainTypeAccountBased = ChainType("Account")
// ChainTypeUTXOBased is an identifier for all utxo-based chains, namely,
// Bitcoin, BitcoinCash, DigiByte, and so on.
ChainTypeUTXOBased = ChainType("UTXO")
)
// SizeHint returns the number of bytes required to represent the chain type in
// binary.
func (chainType ChainType) SizeHint() int {
return surge.SizeHintString(string(chainType))
}
// Marshal the chain type to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (chainType ChainType) Marshal(buf []byte, rem int) ([]byte, int, error) {
return surge.MarshalString(string(chainType), buf, rem)
}
// Unmarshal the chain type from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (chainType *ChainType) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return surge.UnmarshalString((*string)(chainType), buf, rem)
}
// Network identifies the network type for the multichain deployment
type Network string
const (
// NetworkLocalnet represents a local network for chains. It is usually only
// accessible from the device running the network, and is not accessible
// over the Internet. Chain rules are often slightly different to allow for
// faster block times and easier access to testing funds. This is also
// sometimes referred to as "regnet" or "regression network". It should only
// be used for local testing.
NetworkLocalnet = Network("localnet")
// NetworkDevnet represents the development network for chains. This network
// is typically a deployed version of the localnet. Chain rules are often
// slightly different to allow for faster block times and easier access to
// testing funds.
NetworkDevnet = Network("devnet")
// NetworkTestnet represents the test network for chains. This network is
// typically a publicly accessible network that has the same, or very
// similar, chain rules compared to mainnet. Assets on this type of network
// are usually not considered to have value.
NetworkTestnet = Network("testnet")
// NetworkMainnet represents the main network for chains.
NetworkMainnet = Network("mainnet")
)
// SizeHint returns the number of bytes required to represent the network in
// binary.
func (net Network) SizeHint() int {
return surge.SizeHintString(string(net))
}
// Marshal the network to binary. You should not call this function directly,
// unless you are implementing marshalling for a container type.
func (net Network) Marshal(buf []byte, rem int) ([]byte, int, error) {
return surge.MarshalString(string(net), buf, rem)
}
// Unmarshal the network from binary. You should not call this function
// directly, unless you are implementing unmarshalling for a container type.
func (net *Network) Unmarshal(buf []byte, rem int) ([]byte, int, error) {
return surge.UnmarshalString((*string)(net), buf, rem)
}
================================================
FILE: multichain_suite_test.go
================================================
package multichain_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestMultichain(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Multichain Suite")
}
================================================
FILE: multichain_test.go
================================================
package multichain_test
import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"math/big"
"math/rand"
"os"
"os/exec"
"path/filepath"
"reflect"
"strings"
"testing/quick"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/base58"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cosmossdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/crypto"
filaddress "github.com/filecoin-project/go-address"
filtypes "github.com/filecoin-project/lotus/chain/types"
"github.com/renproject/id"
"github.com/renproject/multichain"
"github.com/renproject/multichain/api/account"
"github.com/renproject/multichain/chain/avalanche"
"github.com/renproject/multichain/chain/bitcoin"
"github.com/renproject/multichain/chain/bitcoincash"
"github.com/renproject/multichain/chain/bsc"
"github.com/renproject/multichain/chain/dogecoin"
"github.com/renproject/multichain/chain/ethereum"
"github.com/renproject/multichain/chain/fantom"
"github.com/renproject/multichain/chain/filecoin"
"github.com/renproject/multichain/chain/polygon"
"github.com/renproject/multichain/chain/terra"
"github.com/renproject/multichain/chain/zcash"
"github.com/renproject/pack"
"github.com/renproject/surge"
"github.com/tyler-smith/go-bip39"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var (
testBTC = flag.Bool("btc", false, "Pass this flag to test Bitcoin")
testBCH = flag.Bool("bch", false, "Pass this flag to test Bitcoincash")
testDOGE = flag.Bool("doge", false, "Pass this flag to test Dogecoin")
testFIL = flag.Bool("fil", false, "Pass this flag to test Filecoin")
testETH = flag.Bool("eth", false, "Pass this flag to test Ethereum")
testMATIC = flag.Bool("matic", false, "Pass this flag to test Polygon")
testAVAX = flag.Bool("avax", false, "Pass this flag to test Avalanche")
testBSC = flag.Bool("bsc", false, "Pass this flag to test Binance Smart Chain")
testFTM = flag.Bool("ftm", false, "Pass this flag to test Fantom")
testLUNA = flag.Bool("luna", false, "Pass this flag to test Terra")
testZEC = flag.Bool("zec", false, "Pass this flag to test Zcash")
)
var _ = Describe("Multichain", func() {
// new randomness
r := rand.New(rand.NewSource(time.Now().UnixNano()))
// Create context to work within.
ctx := context.Background()
// Initialise the logger.
loggerConfig := zap.NewDevelopmentConfig()
loggerConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
logger, err := loggerConfig.Build()
Expect(err).ToNot(HaveOccurred())
// Populate the test flags by underlying asset chain.
testFlags := map[multichain.Chain]bool{}
testFlags[multichain.Bitcoin] = *testBTC
testFlags[multichain.BitcoinCash] = *testBCH
testFlags[multichain.Dogecoin] = *testDOGE
testFlags[multichain.Filecoin] = *testFIL
testFlags[multichain.Ethereum] = *testETH
testFlags[multichain.BinanceSmartChain] = *testBSC
testFlags[multichain.Polygon] = *testMATIC
testFlags[multichain.Avalanche] = *testAVAX
testFlags[multichain.Fantom] = *testFTM
testFlags[multichain.Terra] = *testLUNA
testFlags[multichain.Zcash] = *testZEC
//
// Multichain Configs
//
Context("Multichain Declarations", func() {
Context("All supporting chains/assets are declared", func() {
accountChains := []struct {
chain multichain.Chain
asset multichain.Asset
}{
{
multichain.Arbitrum,
multichain.ArbETH,
},
{
multichain.Avalanche,
multichain.AVAX,
},
{
multichain.Fantom,
multichain.FTM,
},
{
multichain.Filecoin,
multichain.FIL,
},
{
multichain.Ethereum,
multichain.ETH,
},
{
multichain.BinanceSmartChain,
multichain.BNB,
},
{
multichain.Moonbeam,
multichain.GLMR,
},
{
multichain.Polygon,
multichain.MATIC,
},
{
multichain.Solana,
multichain.SOL,
},
{
multichain.Terra,
multichain.LUNA,
},
{
multichain.Goerli,
multichain.GETH,
},
}
utxoChains := []struct {
chain multichain.Chain
asset multichain.Asset
}{
{
multichain.Bitcoin,
multichain.BTC,
},
{
multichain.BitcoinCash,
multichain.BCH,
},
{
multichain.DigiByte,
multichain.DGB,
},
{
multichain.Dogecoin,
multichain.DOGE,
},
{
multichain.Zcash,
multichain.ZEC,
},
}
for _, accountChain := range accountChains {
accountChain := accountChain
Specify(fmt.Sprintf("Chain=%v, Asset=%v should be supported", accountChain.chain, accountChain.asset), func() {
Expect(accountChain.chain.IsAccountBased()).To(BeTrue())
Expect(accountChain.chain.ChainType()).To(Equal(multichain.ChainTypeAccountBased))
Expect(accountChain.chain.NativeAsset()).To(Equal(accountChain.asset))
Expect(accountChain.asset.ChainType()).To(Equal(multichain.ChainTypeAccountBased))
Expect(accountChain.asset.OriginChain()).To(Equal(accountChain.chain))
})
}
for _, utxoChain := range utxoChains {
utxoChain := utxoChain
Specify(fmt.Sprintf("Chain=%v, Asset=%v should be supported", utxoChain.chain, utxoChain.asset), func() {
Expect(utxoChain.chain.IsUTXOBased()).To(BeTrue())
Expect(utxoChain.chain.ChainType()).To(Equal(multichain.ChainTypeUTXOBased))
Expect(utxoChain.chain.NativeAsset()).To(Equal(utxoChain.asset))
Expect(utxoChain.asset.ChainType()).To(Equal(multichain.ChainTypeUTXOBased))
Expect(utxoChain.asset.OriginChain()).To(Equal(utxoChain.chain))
})
}
})
Context("Assets are declared appropriately", func() {
nativeAssets := []multichain.Asset{
multichain.ArbETH, multichain.AVAX, multichain.BNB, multichain.ETH,
multichain.FTM, multichain.GLMR, multichain.MATIC, multichain.SOL,
}
tokenAssets := []struct {
asset multichain.Asset
chain multichain.Chain
}{
{
multichain.DAI,
multichain.Ethereum,
},
{
multichain.REN,
multichain.Ethereum,
},
{
multichain.USDC,
multichain.Ethereum,
},
}
for _, asset := range nativeAssets {
asset := asset
Specify(fmt.Sprintf("Asset=%v should be supported", asset), func() {
Expect(asset.Type()).To(Equal(multichain.AssetTypeNative))
})
}
for _, asset := range tokenAssets {
asset := asset
Specify(fmt.Sprintf("Asset=%v should be supported", asset.asset), func() {
Expect(asset.asset.Type()).To(Equal(multichain.AssetTypeToken))
Expect(asset.asset.OriginChain()).To(Equal(asset.chain))
})
}
})
})
//
// ADDRESS API
//
Context("Address API", func() {
chainTable := []struct {
chain multichain.Chain
newEncodeDecoder func() multichain.AddressEncodeDecoder
newAddress func() multichain.Address
newRawAddress func() multichain.RawAddress
newSHAddress func() multichain.Address
newSHRawAddress func() multichain.RawAddress
}{
{
multichain.Bitcoin,
func() multichain.AddressEncodeDecoder {
addrEncodeDecoder := bitcoin.NewAddressEncodeDecoder(&chaincfg.RegressionNetParams)
return addrEncodeDecoder
},
func() multichain.Address {
// Generate a random SECP256K1 private key.
pk := id.NewPrivKey()
// Get bitcoin WIF private key with the pub key configured to be in
// the compressed form.
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), &chaincfg.RegressionNetParams, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
// Return the human-readable encoded bitcoin address in base58 format.
return multichain.Address(addrPubKeyHash.EncodeAddress())
},
func() multichain.RawAddress {
// Generate a random SECP256K1 private key.
pk := id.NewPrivKey()
// Get bitcoin WIF private key with the pub key configured to be in
// the compressed form.
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), &chaincfg.RegressionNetParams, true)
Expect(err).NotTo(HaveOccurred())
// Get the address pubKey hash. This is the most commonly used format
// for a bitcoin address.
addrPubKeyHash, err := btcutil.NewAddressPubKeyHash(btcutil.Hash160(wif.SerializePubKey()), &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
// Encode into the checksummed base58 format.
encoded := addrPubKeyHash.EncodeAddress()
return multichain.RawAddress(pack.Bytes(base58.Decode(encoded)))
},
func() multichain.Address {
// Random bytes of script.
script := make([]byte, r.Intn(100))
r.Read(script)
// Create address script hash from the random script bytes.
addrScriptHash, err := btcutil.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
// Return in human-readable encoded form.
return multichain.Address(addrScriptHash.EncodeAddress())
},
func() multichain.RawAddress {
// Random bytes of script.
script := make([]byte, r.Intn(100))
r.Read(script)
// Create address script hash from the random script bytes.
addrScriptHash, err := btcutil.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
// Encode to the checksummed base58 format.
encoded := addrScriptHash.EncodeAddress()
return multichain.RawAddress(pack.Bytes(base58.Decode(encoded)))
},
},
{
multichain.Filecoin,
func() multichain.AddressEncodeDecoder {
return filecoin.NewAddressEncodeDecoder()
},
func() multichain.Address {
pubKey := make([]byte, 64)
r.Read(pubKey)
addr, err := filaddress.NewSecp256k1Address(pubKey)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(addr.String())
},
func() multichain.RawAddress {
rawAddr := make([]byte, 20)
r.Read(rawAddr)
formattedRawAddr := append([]byte{byte(filaddress.SECP256K1)}, rawAddr[:]...)
return multichain.RawAddress(pack.NewBytes(formattedRawAddr[:]))
},
func() multichain.Address {
return multichain.Address("")
},
func() multichain.RawAddress {
return multichain.RawAddress([]byte{})
},
},
{
multichain.Terra,
func() multichain.AddressEncodeDecoder {
return terra.NewAddressEncodeDecoder()
},
func() multichain.Address {
pk := secp256k1.GenPrivKey()
addr := cosmossdk.AccAddress(pk.PubKey().Address())
return multichain.Address(addr.String())
},
func() multichain.RawAddress {
pk := secp256k1.GenPrivKey()
rawAddr := pk.PubKey().Address()
return multichain.RawAddress(pack.Bytes(rawAddr))
},
func() multichain.Address {
return multichain.Address("")
},
func() multichain.RawAddress {
return multichain.RawAddress([]byte{})
},
},
{
multichain.BitcoinCash,
func() multichain.AddressEncodeDecoder {
addrEncodeDecoder := bitcoincash.NewAddressEncodeDecoder(&chaincfg.RegressionNetParams)
return addrEncodeDecoder
},
func() multichain.Address {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), &chaincfg.RegressionNetParams, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := bitcoincash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(addrPubKeyHash.EncodeAddress())
},
func() multichain.RawAddress {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), &chaincfg.RegressionNetParams, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := bitcoincash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
addrBytes := addrPubKeyHash.ScriptAddress()
addrBytes = append([]byte{0x00}, addrBytes...)
return multichain.RawAddress(pack.Bytes(addrBytes))
},
func() multichain.Address {
script := make([]byte, r.Intn(100))
r.Read(script)
addrScriptHash, err := bitcoincash.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(addrScriptHash.EncodeAddress())
},
func() multichain.RawAddress {
script := make([]byte, r.Intn(100))
r.Read(script)
addrScriptHash, err := bitcoincash.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
addrBytes := addrScriptHash.ScriptAddress()
addrBytes = append([]byte{8}, addrBytes...)
return multichain.RawAddress(pack.Bytes(addrBytes))
},
},
{
multichain.Zcash,
func() multichain.AddressEncodeDecoder {
addrEncodeDecoder := zcash.NewAddressEncodeDecoder(&zcash.RegressionNetParams)
return addrEncodeDecoder
},
func() multichain.Address {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), zcash.RegressionNetParams.Params, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(addrPubKeyHash.EncodeAddress())
},
func() multichain.RawAddress {
pk := id.NewPrivKey()
wif, err := btcutil.NewWIF((*btcec.PrivateKey)(pk), zcash.RegressionNetParams.Params, true)
Expect(err).NotTo(HaveOccurred())
addrPubKeyHash, err := zcash.NewAddressPubKeyHash(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()), &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.RawAddress(pack.Bytes(base58.Decode(addrPubKeyHash.EncodeAddress())))
},
func() multichain.Address {
script := make([]byte, r.Intn(100))
r.Read(script)
addrScriptHash, err := zcash.NewAddressScriptHash(script, &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(addrScriptHash.EncodeAddress())
},
func() multichain.RawAddress {
script := make([]byte, r.Intn(100))
r.Read(script)
addrScriptHash, err := zcash.NewAddressScriptHash(script, &zcash.RegressionNetParams)
Expect(err).NotTo(HaveOccurred())
return multichain.RawAddress(pack.Bytes(base58.Decode(addrScriptHash.EncodeAddress())))
},
},
}
for _, chain := range chainTable {
chain := chain
Context(fmt.Sprintf("%v", chain.chain), func() {
encodeDecoder := chain.newEncodeDecoder()
It("should encode a raw address correctly", func() {
rawAddr := chain.newRawAddress()
encodedAddr, err := encodeDecoder.EncodeAddress(rawAddr)
Expect(err).NotTo(HaveOccurred())
decodedRawAddr, err := encodeDecoder.DecodeAddress(encodedAddr)
Expect(err).NotTo(HaveOccurred())
Expect(decodedRawAddr).To(Equal(rawAddr))
})
It("should decode an address correctly", func() {
addr := chain.newAddress()
decodedRawAddr, err := encodeDecoder.DecodeAddress(addr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := encodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(addr))
})
if chain.chain.IsUTXOBased() {
It("should encoded a raw script address correctly", func() {
rawScriptAddr := chain.newSHRawAddress()
encodedAddr, err := encodeDecoder.EncodeAddress(rawScriptAddr)
Expect(err).NotTo(HaveOccurred())
decodedRawAddr, err := encodeDecoder.DecodeAddress(encodedAddr)
Expect(err).NotTo(HaveOccurred())
Expect(decodedRawAddr).To(Equal(rawScriptAddr))
})
It("should decode a script address correctly", func() {
scriptAddr := chain.newSHAddress()
decodedRawAddr, err := encodeDecoder.DecodeAddress(scriptAddr)
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := encodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(encodedAddr).To(Equal(scriptAddr))
})
}
if chain.chain == multichain.Bitcoin {
mainnetEncodeDecoder := bitcoin.NewAddressEncodeDecoder(&chaincfg.MainNetParams)
It("should decode a Bech32 address correctly", func() {
segwitAddrs := []string{
"bc1qp3gcp95e85rupv9zgj57j0lvsqnzcehawzaax3",
"bc1qh6fjfx39ae4ahvusc4eggyrwjm65zyu83mzwlx",
"bc1q3zqxadsagdwjp2fpddn8dk5ge8lf0nn0p750ar",
"bc1q2lthuszmh0mynte4nzsfqtjjseu6fdrmeffr62",
"bc1qdqkfrt2hpgncqwut88809he6wxysfw8w3cgsh4",
"bc1qna5zwwuqcst3dqqx8rmwa66jpa45w28tlypg54",
"bc1qjk2ytl6uctuxfsyf8dn6ptwfsthfat4hd78l0m",
"bc1qyg6zhg9dhmkj0wz4svsdz6g0ujll225v0wc5hx",
"bc1quvtmmjccre6plqslujw7qcy820fycg2q2a73an",
"bc1qztxl2qc3k90uud846qfeawqzz3aedhq48vv3lu",
"bc1qvkknfkfhfr0axql478klvjs6sanwj6njym5wf2",
"bc1qya5t2pj7hqpezcnwh72k69h4cgg3srqwtd0e6w",
}
for _, segwitAddr := range segwitAddrs {
decodedRawAddr, err := mainnetEncodeDecoder.DecodeAddress(multichain.Address(segwitAddr))
Expect(err).NotTo(HaveOccurred())
encodedAddr, err := mainnetEncodeDecoder.EncodeAddress(decodedRawAddr)
Expect(err).NotTo(HaveOccurred())
Expect(string(encodedAddr)).To(Equal(segwitAddr))
}
})
It("should encode a Bech32 address correctly", func() {
loop := func() bool {
l := 21
if r.Intn(2) == 1 {
l = 33
}
randBytes := make([]byte, l)
r.Read(randBytes)
randBytes[0] = byte(0)
rawAddr := multichain.RawAddress(randBytes)
encodedAddr, err := mainnetEncodeDecoder.EncodeAddress(rawAddr)
Expect(err).NotTo(HaveOccurred())
decodedRawAddr, err := mainnetEncodeDecoder.DecodeAddress(encodedAddr)
Expect(err).NotTo(HaveOccurred())
Expect(decodedRawAddr).To(Equal(rawAddr))
return true
}
Expect(quick.Check(loop, nil)).To(Succeed())
})
}
})
}
})
//
// ACCOUNT API
//
Context("Account API", func() {
accountChainTable := []struct {
senderEnv func() (id.PrivKey, *id.PubKey, multichain.Address)
privKeyToAddr func(pk id.PrivKey) multichain.Address
rpcURL pack.String
randomRecipientAddr func() multichain.Address
initialise func(pack.String) (multichain.AccountClient, multichain.AccountTxBuilder)
txParams func(multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes)
chain multichain.Chain
}{
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
mnemonic := os.Getenv("ETHEREUM_MNEMONIC")
if mnemonic == "" {
panic("ETHEREUM_MNEMONIC is undefined")
}
const ZERO uint32 = 0x80000000
path := []uint32{ZERO + 44, ZERO + 60, ZERO, 0, 0}
path[len(path)-1] = uint32(0)
seed := bip39.NewSeed(mnemonic, "")
key, err := hdkeychain.NewMaster(seed, &chaincfg.MainNetParams)
Expect(err).NotTo(HaveOccurred())
for _, val := range path {
key, err = key.DeriveNonStandard(val)
if err != nil {
Expect(err).NotTo(HaveOccurred())
}
}
privKey, err := key.ECPrivKey()
if err != nil {
Expect(err).NotTo(HaveOccurred())
}
newKey := privKey.ToECDSA()
Expect(err).NotTo(HaveOccurred())
pk := (*id.PrivKey)(newKey)
address := multichain.Address(crypto.PubkeyToAddress(pk.PublicKey).Hex())
return *pk, pk.PubKey(), address
},
func(privKey id.PrivKey) multichain.Address {
return multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
},
ethereum.DefaultClientRPCURL,
func() multichain.Address {
recipientKey := id.NewPrivKey()
return multichain.Address(crypto.PubkeyToAddress(recipientKey.PublicKey).Hex())
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client, err := ethereum.NewClient(string(rpcURL), big.NewInt(1337))
Expect(err).NotTo(HaveOccurred())
txBuilder := ethereum.NewTxBuilder(big.NewInt(1337))
return client, txBuilder
},
func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(2000000))
gasLimit := pack.NewU256FromU64(pack.U64(1000000))
gasPrice := pack.NewU256FromU64(pack.U64(3000000000))
gasCap := pack.NewU256FromU64(pack.U64(100000000000))
payload := pack.NewBytes([]byte("multichain"))
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.Ethereum,
},
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
keyPath := filepath.Join(".", "infra", "polygon", "json-keystore")
keyjson, err := ioutil.ReadFile(fmt.Sprintf("%v", keyPath))
Expect(err).NotTo(HaveOccurred())
password := "password0"
keyStoreKey, err := keystore.DecryptKey(keyjson, password)
Expect(err).NotTo(HaveOccurred())
newKey := keyStoreKey.PrivateKey
pk := (*id.PrivKey)(newKey)
address := multichain.Address(crypto.PubkeyToAddress(pk.PublicKey).Hex())
return *pk, pk.PubKey(), address
},
func(privKey id.PrivKey) multichain.Address {
return multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
},
polygon.DefaultClientRPCURL,
func() multichain.Address {
recipientKey := id.NewPrivKey()
return multichain.Address(crypto.PubkeyToAddress(recipientKey.PublicKey).Hex())
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client, err := polygon.NewClient(string(rpcURL), big.NewInt(15001))
Expect(err).NotTo(HaveOccurred())
txBuilder := polygon.NewTxBuilder(big.NewInt(15001))
return client, txBuilder
},
func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(2000000))
gasLimit := pack.NewU256FromU64(pack.U64(1000000))
gasPrice := pack.NewU256FromU64(pack.U64(1000000000000))
gasCap := pack.NewU256FromInt(gasPrice.Int())
payload := pack.NewBytes([]byte("multichain"))
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.Polygon,
},
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
mnemonic := os.Getenv("BINANCE_MNEMONIC")
if mnemonic == "" {
panic("BINANCE_MNEMONIC is undefined")
}
const ZERO uint32 = 0x80000000
path := []uint32{ZERO + 44, ZERO + 60, ZERO, 0, 0}
path[len(path)-1] = uint32(0)
seed := bip39.NewSeed(mnemonic, "")
key, err := hdkeychain.NewMaster(seed, &chaincfg.MainNetParams)
Expect(err).NotTo(HaveOccurred())
for _, val := range path {
key, err = key.DeriveNonStandard(val)
if err != nil {
Expect(err).NotTo(HaveOccurred())
}
}
privKey, err := key.ECPrivKey()
if err != nil {
Expect(err).NotTo(HaveOccurred())
}
newKey := privKey.ToECDSA()
Expect(err).NotTo(HaveOccurred())
pk := (*id.PrivKey)(newKey)
address := multichain.Address(crypto.PubkeyToAddress(pk.PublicKey).Hex())
return *pk, pk.PubKey(), address
},
func(privKey id.PrivKey) multichain.Address {
return multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
},
bsc.DefaultClientRPCURL,
func() multichain.Address {
recipientKey := id.NewPrivKey()
return multichain.Address(crypto.PubkeyToAddress(recipientKey.PublicKey).Hex())
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client, err := bsc.NewClient(string(rpcURL), big.NewInt(420))
Expect(err).NotTo(HaveOccurred())
txBuilder := bsc.NewTxBuilder(big.NewInt(420))
return client, txBuilder
},
func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(2000000))
gasLimit := pack.NewU256FromU64(pack.U64(100000))
gasPrice := pack.NewU256FromU64(pack.U64(1))
gasCap := pack.NewU256FromInt(gasPrice.Int())
payload := pack.NewBytes([]byte("multichain"))
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.BinanceSmartChain,
},
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
pk := os.Getenv("C_AVAX_PK")
if pk == "" {
panic("C_AVAX_PK is undefined")
}
pk = strings.TrimPrefix(pk, "0x")
key, err := crypto.HexToECDSA(pk)
privKey := (*id.PrivKey)(key)
Expect(err).NotTo(HaveOccurred())
address := multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
return *privKey, privKey.PubKey(), address
},
func(privKey id.PrivKey) multichain.Address {
return multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
},
avalanche.DefaultClientRPCURL,
func() multichain.Address {
recipientKey := id.NewPrivKey()
return multichain.Address(crypto.PubkeyToAddress(recipientKey.PublicKey).Hex())
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client, err := avalanche.NewClient(string(rpcURL), big.NewInt(43112))
Expect(err).NotTo(HaveOccurred())
txBuilder := avalanche.NewTxBuilder(big.NewInt(43112))
return client, txBuilder
},
func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(1))
gasLimit := pack.NewU256FromU64(pack.U64(100000))
gasPrice := pack.NewU256FromU64(pack.U64(225000000000))
gasCap := pack.NewU256FromInt(gasPrice.Int())
payload := pack.NewBytes([]byte(""))
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.Avalanche,
},
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
pk := os.Getenv("FANTOM_PK")
if pk == "" {
panic("FANTOM_PK is undefined")
}
key, err := crypto.HexToECDSA(pk)
privKey := (*id.PrivKey)(key)
Expect(err).NotTo(HaveOccurred())
address := multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
return *privKey, privKey.PubKey(), address
},
func(privKey id.PrivKey) multichain.Address {
return multichain.Address(crypto.PubkeyToAddress(privKey.PublicKey).Hex())
},
fantom.DefaultClientRPCURL,
func() multichain.Address {
recipientKey := id.NewPrivKey()
return multichain.Address(crypto.PubkeyToAddress(recipientKey.PublicKey).Hex())
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client, err := fantom.NewClient(string(rpcURL), big.NewInt(4003))
Expect(err).NotTo(HaveOccurred())
txBuilder := fantom.NewTxBuilder(big.NewInt(4003))
return client, txBuilder
},
func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(2000000))
gasLimit := pack.NewU256FromU64(pack.U64(1000000))
gasPrice := pack.NewU256FromU64(pack.U64(1000000000))
gasCap := pack.NewU256FromInt(gasPrice.Int())
payload := pack.NewBytes([]byte("multichain"))
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.Fantom,
},
{
senderEnv: func() (id.PrivKey, *id.PubKey, multichain.Address) {
pkEnv := os.Getenv("TERRA_PK")
if pkEnv == "" {
panic("TERRA_PK is undefined")
}
pkBytes, err := hex.DecodeString(pkEnv)
Expect(err).NotTo(HaveOccurred())
pk := secp256k1.PrivKey{Key: pkBytes}
addrEncodeDecoder := terra.NewAddressEncodeDecoder()
senderAddr, err := addrEncodeDecoder.EncodeAddress(pk.PubKey().Address().Bytes())
Expect(err).NotTo(HaveOccurred())
senderPrivKey := id.PrivKey{}
err = surge.FromBinary(&senderPrivKey, pkBytes)
Expect(err).NotTo(HaveOccurred())
return senderPrivKey, senderPrivKey.PubKey(), senderAddr
},
privKeyToAddr: func(privKey id.PrivKey) multichain.Address {
pkBytes, err := surge.ToBinary(privKey)
Expect(err).NotTo(HaveOccurred())
pk := secp256k1.PrivKey{Key: pkBytes}
addrEncodeDecoder := terra.NewAddressEncodeDecoder()
addr, err := addrEncodeDecoder.EncodeAddress(pk.PubKey().Address().Bytes())
Expect(err).NotTo(HaveOccurred())
return addr
},
rpcURL: "http://127.0.0.1:26657",
randomRecipientAddr: func() multichain.Address {
recipientKey := secp256k1.GenPrivKey()
recipient := multichain.Address(cosmossdk.AccAddress(recipientKey.PubKey().Address()).String())
return recipient
},
initialise: func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
client := terra.NewClient(
terra.DefaultClientOptions().
WithHost(rpcURL).
WithCoinDenom("uluna"),
)
txBuilder := terra.NewTxBuilder(
terra.DefaultTxBuilderOptions().
WithChainID("testnet"),
client,
)
return client, txBuilder
},
txParams: func(_ multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.U64(2000000))
gasLimit := pack.NewU256FromU64(pack.U64(100000))
gasPrice := pack.NewU256FromU64(pack.U64(1))
gasCap := pack.NewU256FromInt(gasPrice.Int())
payload := pack.NewBytes([]byte("multichain"))
return amount, gasLimit, gasPrice, gasCap, payload
},
chain: multichain.Terra,
},
{
func() (id.PrivKey, *id.PubKey, multichain.Address) {
pkEnv := os.Getenv("FILECOIN_PK")
if pkEnv == "" {
panic("FILECOIN_PK is undefined")
}
var ki filtypes.KeyInfo
data, err := hex.DecodeString(pkEnv)
Expect(err).NotTo(HaveOccurred())
err = json.Unmarshal(data, &ki)
Expect(err).NotTo(HaveOccurred())
privKey := id.PrivKey{}
err = surge.FromBinary(&privKey, ki.PrivateKey)
Expect(err).NotTo(HaveOccurred())
pubKey := privKey.PubKey()
// FIXME: add method in renproject/id to get uncompressed pubkey bytes
pubKeyCompressed, err := surge.ToBinary(pubKey)
Expect(err).NotTo(HaveOccurred())
/*addr*/ _, err = filaddress.NewSecp256k1Address(pubKeyCompressed)
Expect(err).NotTo(HaveOccurred())
addrStr := os.Getenv("FILECOIN_ADDRESS")
if addrStr == "" {
panic("FILECOIN_ADDRESS is undefined")
}
return privKey, pubKey, multichain.Address(pack.String(addrStr))
},
func(privKey id.PrivKey) multichain.Address {
pubKey := privKey.PubKey()
pubKeyCompressed, err := surge.ToBinary(pubKey)
Expect(err).NotTo(HaveOccurred())
addr, err := filaddress.NewSecp256k1Address(pubKeyCompressed)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(pack.String(addr.String()))
},
"http://127.0.0.1:1234/rpc/v0",
func() multichain.Address {
pk := id.NewPrivKey()
pubKey := pk.PubKey()
pubKeyCompressed, err := surge.ToBinary(pubKey)
Expect(err).NotTo(HaveOccurred())
addr, err := filaddress.NewSecp256k1Address(pubKeyCompressed)
Expect(err).NotTo(HaveOccurred())
return multichain.Address(pack.String(addr.String()))
},
func(rpcURL pack.String) (multichain.AccountClient, multichain.AccountTxBuilder) {
// dirty hack to fetch auth token
client, err := filecoin.NewClient(
filecoin.DefaultClientOptions().
WithRPCURL(rpcURL).
WithAuthToken(fetchAuthToken()),
)
Expect(err).NotTo(HaveOccurred())
txBuilder := filecoin.NewTxBuilder()
return client, txBuilder
},
func(client multichain.AccountClient) (pack.U256, pack.U256, pack.U256, pack.U256, pack.Bytes) {
amount := pack.NewU256FromU64(pack.NewU64(100000000))
gasLimit := pack.NewU256FromU64(pack.NewU64(2189560))
// Fetch gas price and gas cap using the gas estimator.
filecoinClient := client.(*filecoin.Client)
gasPrice, gasCap, err := filecoin.NewGasEstimator(filecoinClient, gasLimit.Int().Int64()).
EstimateGas(context.Background())
Expect(err).NotTo(HaveOccurred())
payload := pack.Bytes(nil)
return amount, gasLimit, gasPrice, gasCap, payload
},
multichain.Filecoin,
},
}
for _, accountChain := range accountChainTable {
accountChain := accountChain
if !testFlags[accountChain.chain] {
continue
}
Context(fmt.Sprintf("%v", accountChain.chain), func() {
Specify("build, broadcast and fetch tx", func() {
// Load private key and the associated address.
senderPrivKey, senderPubKey, senderAddr := accountChain.senderEnv()
senderPubKeyBytes, err := surge.ToBinary(senderPubKey)
Expect(err).NotTo(HaveOccurred())
// Get a random recipient address.
recipientAddr := accountChain.randomRecipientAddr()
// Initialise the account chain's client, and possibly get a nonce for
// the sender.
accountClient, txBuilder := accountChain.initialise(accountChain.rpcURL)
sendTx := func() (pack.Bytes, account.Tx) {
// Get the appropriate nonce for sender.
nonce, err := accountClient.AccountNonce(ctx, senderAddr)
Expect(err).NotTo(HaveOccurred())
// Build a transaction.
amount, gasLimit, gasPrice, gasCap, payload := accountChain.txParams(accountClient)
accountTx, err := txBuilder.BuildTx(
ctx,
senderPubKey,
recipientAddr,
amount, nonce, gasLimit, gasPrice, gasCap,
payload,
)
Expect(err).NotTo(HaveOccurred())
// Get the transaction bytes and sign them.
sighashes, err := accountTx.Sighashes()
Expect(err).NotTo(HaveOccurred())
hash := id.Hash(sighashes[0])
sig, err := senderPrivKey.Sign(&hash)
Expect(err).NotTo(HaveOccurred())
sigBytes, err := surge.ToBinary(sig)
Expect(err).NotTo(HaveOccurred())
txSignature := pack.Bytes65{}
copy(txSignature[:], sigBytes)
err = accountTx.Sign(
[]pack.Bytes65{txSignature},
pack.NewBytes(senderPubKeyBytes),
)
Expect(err).NotTo(HaveOccurred())
// Submit the transaction to the account chain.
txHash := accountTx.Hash()
err = accountClient.SubmitTx(ctx, accountTx)
Expect(err).NotTo(HaveOccurred())
logger.Debug("submit tx", zap.String("from", string(senderAddr)), zap.String("to", string(recipientAddr)), zap.Any("txHash", txHash))
return txHash, accountTx
}
txHash, accountTx := sendTx()
if accountChain.chain == multichain.Avalanche {
time.Sleep(5 * time.Second)
sendTx()
}
// Wait slightly before we query the chain's node.
time.Sleep(time.Second)
for {
// Loop until the transaction has at least a few confirmations.
tx, confs, err := accountClient.Tx(ctx, txHash)
if err == nil && confs > 0 {
Expect(confs.Uint64()).To(BeNumerically(">", 0))
Expect(tx.Value()).To(Equal(accountTx.Value()))
Expect(tx.From()).To(Equal(accountTx.From()))
Expect(tx.To()).To(Equal(accountTx.To()))
// FIXME: Filecoin signed message hash is different, so we ignore this check for filecoin. Appropriate check should be added for Filecoin.
if accountChain.chain != multichain.Filecoin {
Expect(tx.Hash()).To(Equal(accountTx.Hash()))
}
break
}
// wait and retry querying for the transaction
time.Sleep(5 * time.Second)
}
})
It("should be able to fetch the latest block", func() {
// Initialise client
accountClient, _ := accountChain.initialise(accountChain.rpcURL)
latestBlock, err := accountClient.LatestBlock(ctx)
Expect(err).NotTo(HaveOccurred())
Expect(uint64(latestBlock)).To(BeNumerically(">", 1))
})
})
}
})
//
// UTXO API
//
Context("UTXO API", func() {
utxoChainTable := []struct {
privKeyEnv string
newAddressPKH func([]byte) (btcutil.Address, error)
newAddressSH func([]byte) (btcutil.Address, error)
rpcURL pack.String
initialise func(pack.String, btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error))
txBuilder multichain.UTXOTxBuilder
chain multichain.Chain
}{
{
"BITCOIN_PK",
func(pkh []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressPubKeyHash(pkh, &chaincfg.RegressionNetParams)
return addr, err
},
func(script []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
return addr, err
},
pack.NewString("http://0.0.0.0:18443"),
func(rpcURL pack.String, pkhAddr btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error)) {
client := bitcoin.NewClient(bitcoin.DefaultClientOptions())
outputs, err := client.UnspentOutputs(ctx, 0, 999999999, multichain.Address(pkhAddr.EncodeAddress()))
Expect(err).NotTo(HaveOccurred())
return client, outputs, client.Confirmations
},
bitcoin.NewTxBuilder(&chaincfg.RegressionNetParams),
multichain.Bitcoin,
},
{
"BITCOINCASH_PK",
func(pkh []byte) (btcutil.Address, error) {
addr, err := bitcoincash.NewAddressPubKeyHash(pkh, &chaincfg.RegressionNetParams)
return addr, err
},
func(script []byte) (btcutil.Address, error) {
addr, err := bitcoincash.NewAddressScriptHash(script, &chaincfg.RegressionNetParams)
return addr, err
},
pack.NewString("http://0.0.0.0:19443"),
func(rpcURL pack.String, pkhAddr btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error)) {
client := bitcoincash.NewClient(bitcoincash.DefaultClientOptions())
outputs, err := client.UnspentOutputs(ctx, 0, 999999999, multichain.Address(pkhAddr.EncodeAddress()))
Expect(err).NotTo(HaveOccurred())
return client, outputs, client.Confirmations
},
bitcoincash.NewTxBuilder(&chaincfg.RegressionNetParams),
multichain.BitcoinCash,
},
{
"DOGECOIN_PK",
func(pkh []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressPubKeyHash(pkh, &dogecoin.RegressionNetParams)
return addr, err
},
func(script []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressScriptHash(script, &dogecoin.RegressionNetParams)
return addr, err
},
pack.NewString("http://0.0.0.0:18332"),
func(rpcURL pack.String, pkhAddr btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error)) {
client := dogecoin.NewClient(dogecoin.DefaultClientOptions())
outputs, err := client.UnspentOutputs(ctx, 0, 999999999, multichain.Address(pkhAddr.EncodeAddress()))
Expect(err).NotTo(HaveOccurred())
return client, outputs, client.Confirmations
},
dogecoin.NewTxBuilder(&dogecoin.RegressionNetParams),
multichain.Dogecoin,
},
{
"ZCASH_PK",
func(pkh []byte) (btcutil.Address, error) {
addr, err := zcash.NewAddressPubKeyHash(pkh, &zcash.RegressionNetParams)
return addr, err
},
func(script []byte) (btcutil.Address, error) {
addr, err := zcash.NewAddressScriptHash(script, &zcash.RegressionNetParams)
return addr, err
},
pack.String("http://0.0.0.0:18232"),
func(rpcURL pack.String, pkhAddr btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error)) {
client := zcash.NewClient(zcash.DefaultClientOptions())
outputs, err := client.UnspentOutputs(ctx, 0, 999999999, multichain.Address(pkhAddr.EncodeAddress()))
Expect(err).NotTo(HaveOccurred())
return client, outputs, client.Confirmations
},
zcash.NewTxBuilder(&zcash.RegressionNetParams, 1000000),
multichain.Zcash,
},
/*
{
"DIGIBYTE_PK",
func(pkh []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressPubKeyHash(pkh, &digibyte.RegressionNetParams)
return addr, err
},
func(script []byte) (btcutil.Address, error) {
addr, err := btcutil.NewAddressScriptHash(script, &digibyte.RegressionNetParams)
return addr, err
},
pack.NewString("http://0.0.0.0:20443"),
func(rpcURL pack.String, pkhAddr btcutil.Address) (multichain.UTXOClient, []multichain.UTXOutput, func(context.Context, pack.Bytes) (int64, error)) {
client := digibyte.NewClient(digibyte.DefaultClientOptions())
outputs, err := client.UnspentOutputs(ctx, 0, 999999999, multichain.Address(pkhAddr.EncodeAddress()))
Expect(err).NotTo(HaveOccurred())
return client, outputs, client.Confirmations
},
digibyte.NewTxBuilder(&digibyte.RegressionNetParams),
multichain.DigiByte,
},
*/
}
for _, utxoChain := range utxoChainTable {
utxoChain := utxoChain
if !testFlags[utxoChain.chain] {
continue
}
Context(fmt.Sprintf("%v", utxoChain.chain), func() {
Specify("(P2PKH) build, broadcast and fetch tx", func() {
// Load private key.
pkEnv := os.Getenv(utxoChain.privKeyEnv)
if pkEnv == "" {
panic(fmt.Sprintf("%v is undefined", utxoChain.privKeyEnv))
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).NotTo(HaveOccurred())
// Get the PKH address from the loaded private key.
pkhAddr, err := utxoChain.newAddressPKH(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()))
Expect(err).NotTo(HaveOccurred())
// Recipient 1
pkhAddrUncompressed, err := utxoChain.newAddressPKH(btcutil.Hash160(wif.PrivKey.PubKey().SerializeUncompressed()))
Expect(err).ToNot(HaveOccurred())
// Recipient 2
recipientPrivKey := id.NewPrivKey()
recipientPubKey := recipientPrivKey.PubKey()
recipientPubKeyCompressed, err := surge.ToBinary(recipientPubKey)
Expect(err).NotTo(HaveOccurred())
recipientPkhAddr, err := utxoChain.newAddressPKH(btcutil.Hash160(((*btcec.PublicKey)(recipientPubKey)).SerializeCompressed()))
Expect(err).NotTo(HaveOccurred())
// Initialise the UTXO client and fetch the unspent outputs. Also get a
// function to query the number of block confirmations for a transaction.
utxoClient, unspentOutputs, confsFn := utxoChain.initialise(utxoChain.rpcURL, pkhAddr)
Expect(len(unspentOutputs)).To(BeNumerically(">", 0))
var output multichain.UTXOutput
thresholdValue := pack.NewU256FromU64(pack.NewU64(2500))
for _, unspentOutput := range unspentOutputs {
if unspentOutput.Value.GreaterThan(thresholdValue) {
output = unspentOutput
break
}
}
// Build a transaction
inputs := []multichain.UTXOInput{
{Output: multichain.UTXOutput{
Outpoint: multichain.UTXOutpoint{
Hash: output.Outpoint.Hash[:],
Index: output.Outpoint.Index,
},
PubKeyScript: output.PubKeyScript,
Value: output.Value,
}},
}
utxoValue1 := pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) / 4))
utxoValue2 := pack.NewU256FromU64(pack.NewU64((output.Value.Int().Uint64() - 1000) * 3 / 4))
recipients := []multichain.UTXORecipient{
{
To: multichain.Address(pkhAddrUncompressed.EncodeAddress()),
Value: utxoValue1,
},
{
To: multichain.Address(recipientPkhAddr.EncodeAddress()),
Value: utxoValue2,
},
}
utxoTx, err := utxoChain.txBuilder.BuildTx(inputs, recipients)
Expect(err).NotTo(HaveOccurred())
// Get the sighashes that need to be signed, and sign them.
sighashes, err := utxoTx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(utxoTx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the signed transaction to the UTXO chain's node.
txHash, err := utxoTx.Hash()
Expect(err).ToNot(HaveOccurred())
err = utxoClient.SubmitTx(ctx, utxoTx)
Expect(err).ToNot(HaveOccurred())
// Check confirmations after waiting for the transaction to be in the
// mempool.
time.Sleep(time.Second)
for {
// Loop until the transaction has at least a few
// confirmations.
confs, err := confsFn(ctx, txHash)
Expect(err).ToNot(HaveOccurred())
logger.Debug(fmt.Sprintf("[%v] confirming", utxoChain.chain), zap.Uint64("current", uint64(confs)))
if confs >= 1 {
break
}
time.Sleep(10 * time.Second)
}
// Load the output and verify that it is equal to the original output.
output2, _, err := utxoClient.Output(ctx, output.Outpoint)
Expect(err).ToNot(HaveOccurred())
Expect(reflect.DeepEqual(output, output2)).To(BeTrue())
// Load the first output and verify the value.
output3, _, err := utxoClient.Output(ctx, multichain.UTXOutpoint{
Hash: txHash,
Index: pack.NewU32(0),
})
Expect(err).ToNot(HaveOccurred())
Expect(output3.Value).To(Equal(utxoValue1))
// Load the second output and verify the value.
output4, _, err := utxoClient.Output(ctx, multichain.UTXOutpoint{
Hash: txHash,
Index: pack.NewU32(1),
})
Expect(err).ToNot(HaveOccurred())
Expect(output4.Value).To(Equal(utxoValue2))
// Construct UTXO to be signed by invalid key. This UTXO should fail
// when submitted to the network, since the signer doesn't have the
// right to spend it.
// We submit the invalid signed UTXO (which should fail), and wait
// for a maximum of 5 seconds.
inputs2 := []multichain.UTXOInput{{
Output: output4,
}}
recipients2 := []multichain.UTXORecipient{{
To: multichain.Address(pkhAddr.EncodeAddress()),
Value: output4.Value.Sub(pack.NewU256FromU64(pack.U64(500))),
}}
utxoTx2, err := utxoChain.txBuilder.BuildTx(inputs2, recipients2)
Expect(err).NotTo(HaveOccurred())
sighashes2, err := utxoTx2.Sighashes()
signatures2 := make([]pack.Bytes65, len(sighashes2))
for i := range sighashes2 {
hash := id.Hash(sighashes2[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures2[i] = pack.NewBytes65(signature)
}
Expect(utxoTx2.Sign(signatures2, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
failingCtx, failingCancelFn := context.WithTimeout(ctx, 5*time.Second)
Expect(utxoClient.SubmitTx(failingCtx, utxoTx2)).To(HaveOccurred())
failingCancelFn()
// Try to spend UTXO from valid key. We should be able to successfully
// submit the signed UTXO to the network.
utxoTx3, err := utxoChain.txBuilder.BuildTx(inputs2, recipients2)
Expect(err).NotTo(HaveOccurred())
sighashes3, err := utxoTx3.Sighashes()
signatures3 := make([]pack.Bytes65, len(sighashes3))
for i := range sighashes3 {
hash := id.Hash(sighashes3[i])
signature, err := recipientPrivKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures3[i] = pack.NewBytes65(signature)
}
Expect(utxoTx3.Sign(signatures3, pack.NewBytes(recipientPubKeyCompressed))).To(Succeed())
Expect(utxoClient.SubmitTx(ctx, utxoTx3)).NotTo(HaveOccurred())
})
Specify("(P2SH) build, broadcast and fetch tx", func() {
// Load private key.
pkEnv := os.Getenv(utxoChain.privKeyEnv)
if pkEnv == "" {
panic(fmt.Sprintf("%v is undefined", utxoChain.privKeyEnv))
}
wif, err := btcutil.DecodeWIF(pkEnv)
Expect(err).NotTo(HaveOccurred())
// Get the PKH address from the loaded private key.
pkhAddr, err := utxoChain.newAddressPKH(btcutil.Hash160(wif.PrivKey.PubKey().SerializeCompressed()))
Expect(err).NotTo(HaveOccurred())
// Recipient
recipientPrivKey := id.NewPrivKey()
recipientPubKey := recipientPrivKey.PubKey()
recipientPubKeyCompressed, err := surge.ToBinary(recipientPubKey)
Expect(err).NotTo(HaveOccurred())
pubKey := pack.Bytes(((*btcec.PublicKey)(recipientPubKey)).SerializeCompressed())
script, err := getScript(pubKey)
Expect(err).NotTo(HaveOccurred())
pubKeyScript, err := getPubKeyScript(pubKey)
Expect(err).NotTo(HaveOccurred())
recipientP2SH, err := utxoChain.newAddressSH(script)
Expect(err).NotTo(HaveOccurred())
// Initialise the UTXO client and fetch the unspent outputs. Also get a
// function to query the number of block confirmations for a transaction.
utxoClient, unspentOutputs, confsFn := utxoChain.initialise(utxoChain.rpcURL, pkhAddr)
Expect(len(unspentOutputs)).To(BeNumerically(">", 0))
var output multichain.UTXOutput
thresholdValue := pack.NewU256FromU64(pack.NewU64(2500))
for _, unspentOutput := range unspentOutputs {
if unspentOutput.Value.GreaterThan(thresholdValue) {
output = unspentOutput
break
}
}
// Build a transaction
inputs := []multichain.UTXOInput{
{Output: multichain.UTXOutput{
Outpoint: multichain.UTXOutpoint{
Hash: output.Outpoint.Hash[:],
Index: output.Outpoint.Index,
},
PubKeyScript: output.PubKeyScript,
Value: output.Value,
}},
}
recipients := []multichain.UTXORecipient{
{
To: multichain.Address(recipientP2SH.EncodeAddress()),
Value: output.Value.Sub(pack.NewU256FromU64(pack.U64(500))),
},
}
utxoTx, err := utxoChain.txBuilder.BuildTx(inputs, recipients)
Expect(err).NotTo(HaveOccurred())
// Get the sighashes that need to be signed, and sign them.
sighashes, err := utxoTx.Sighashes()
signatures := make([]pack.Bytes65, len(sighashes))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes {
hash := id.Hash(sighashes[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures[i] = pack.NewBytes65(signature)
}
Expect(utxoTx.Sign(signatures, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Submit the signed transaction to the UTXO chain's node.
txHash, err := utxoTx.Hash()
Expect(err).ToNot(HaveOccurred())
err = utxoClient.SubmitTx(ctx, utxoTx)
Expect(err).ToNot(HaveOccurred())
logger.Debug("[P2KH -> P2SH] submit tx", zap.String("from", pkhAddr.EncodeAddress()), zap.String("to", recipientP2SH.EncodeAddress()), zap.String("txHash", string(txHashToHex(txHash))))
// Check confirmations after waiting for the transaction to be in the
// mempool.
time.Sleep(time.Second)
for {
// Loop until the transaction has at least a few
// confirmations.
confs, err := confsFn(ctx, txHash)
Expect(err).ToNot(HaveOccurred())
logger.Debug(fmt.Sprintf("[%v] confirming", utxoChain.chain), zap.Uint64("current", uint64(confs)))
if confs >= 1 {
break
}
time.Sleep(10 * time.Second)
}
// Load the output and verify that the pub key script is as calculated
// initially.
output2, _, err := utxoClient.Output(ctx, multichain.UTXOutpoint{
Hash: txHash,
Index: pack.NewU32(0),
})
Expect(err).ToNot(HaveOccurred())
Expect(output2.PubKeyScript.Equal(pubKeyScript)).To(BeTrue())
// Validate that the output2 is spendable
sigScript, err := getScript(pubKey)
Expect(err).NotTo(HaveOccurred())
inputs2 := []multichain.UTXOInput{{
Output: output2,
SigScript: sigScript,
}}
recipients2 := []multichain.UTXORecipient{{
To: multichain.Address(pkhAddr.EncodeAddress()),
Value: output2.Value.Sub(pack.NewU256FromU64(pack.U64(500))),
}}
utxoTx2, err := utxoChain.txBuilder.BuildTx(inputs2, recipients2)
Expect(err).NotTo(HaveOccurred())
// Create another transaction using the same inputs, which we will
// sign with the original user's address. Validate that none other
// than the recipient's signature can spend this UTXO.
utxoTx3, err := utxoChain.txBuilder.BuildTx(inputs2, recipients2)
Expect(err).NotTo(HaveOccurred())
// Get the sighashes that need to be signed, and sign them.
sighashes2, err := utxoTx2.Sighashes()
signatures2 := make([]pack.Bytes65, len(sighashes2))
signatures3 := make([]pack.Bytes65, len(sighashes2))
Expect(err).ToNot(HaveOccurred())
for i := range sighashes2 {
hash := id.Hash(sighashes2[i])
signature, err := recipientPrivKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures2[i] = pack.NewBytes65(signature)
}
for i := range sighashes2 {
hash := id.Hash(sighashes2[i])
privKey := (*id.PrivKey)(wif.PrivKey)
signature, err := privKey.Sign(&hash)
Expect(err).ToNot(HaveOccurred())
signatures3[i] = pack.NewBytes65(signature)
}
Expect(utxoTx2.Sign(signatures2, pack.NewBytes(recipientPubKeyCompressed))).To(Succeed())
Expect(utxoTx3.Sign(signatures3, pack.NewBytes(wif.SerializePubKey()))).To(Succeed())
// Try to submit tx signed by invalid spender. This should fail since
failingCtx, failingCancelFn := context.WithTimeout(ctx, 5*time.Second)
Expect(utxoClient.SubmitTx(failingCtx, utxoTx3)).To(HaveOccurred())
failingCancelFn()
// Submit the signed transaction to the UTXO chain's node.
txHash2, err := utxoTx2.Hash()
Expect(err).ToNot(HaveOccurred())
err = utxoClient.SubmitTx(ctx, utxoTx2)
Expect(err).ToNot(HaveOccurred())
logger.Debug("[P2SH -> P2KH] submit tx", zap.String("from", recipientP2SH.EncodeAddress()), zap.String("to", pkhAddr.EncodeAddress()), zap.String("txHash", string(txHashToHex(txHash2))))
// Check confirmations after waiting for the transaction to be in the
// mempool.
time.Sleep(time.Second)
for {
// Loop until the transaction has at least a few
// confirmations.
confs, err := confsFn(ctx, txHash2)
Expect(err).ToNot(HaveOccurred())
logger.Debug(fmt.Sprintf("[%v] confirming", utxoChain.chain), zap.Uint64("current", uint64(confs)))
if confs >= 1 {
break
}
time.Sleep(10 * time.Second)
}
})
It("should be able to fetch the latest block", func() {
// get a random address
randAddr := make([]byte, 20)
r.Read(randAddr)
pkhAddr, err := utxoChain.newAddressPKH(randAddr)
Expect(err).NotTo(HaveOccurred())
// initialise client
utxoClient, _, _ := utxoChain.initialise(utxoChain.rpcURL, pkhAddr)
latestBlock, err := utxoClient.LatestBlock(ctx)
Expect(err).NotTo(HaveOccurred())
Expect(uint64(latestBlock)).To(BeNumerically(">", 1))
})
})
}
})
})
func txHashToHex(txHash pack.Bytes) pack.String {
// bitcoin's msgTx is a byte-reversed hash
// https://github.com/btcsuite/btcd/blob/master/chaincfg/chainhash/hash.go#L27-L28
txHashCopy := make([]byte, len(txHash))
copy(txHashCopy[:], txHash)
hashSize := len(txHashCopy)
for i := 0; i < hashSize/2; i++ {
txHashCopy[i], txHashCopy[hashSize-1-i] = txHashCopy[hashSize-1-i], txHashCopy[i]
}
return pack.String(hex.EncodeToString(txHashCopy))
}
func fetchAuthToken() pack.String {
// fetch the auth token from filecoin's running docker container
cmd := exec.Command("docker", "exec", "infra_filecoin_1", "/bin/bash", "-c", "/app/lotus auth api-info --perm admin")
var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + stderr.String())
panic(fmt.Sprintf("could not run command: %v", err))
}
tokenWithSuffix := strings.TrimPrefix(out.String(), "FULLNODE_API_INFO=")
authToken := strings.Split(tokenWithSuffix, ":/")
return pack.NewString(fmt.Sprintf("Bearer %s", authToken[0]))
}
func getScript(pubKey pack.Bytes) (pack.Bytes, error) {
pubKeyHash160 := btcutil.Hash160(pubKey)
return txscript.NewScriptBuilder().
AddOp(txscript.OP_DUP).
AddOp(txscript.OP_HASH160).
AddData(pubKeyHash160).
AddOp(txscript.OP_EQUALVERIFY).
AddOp(txscript.OP_CHECKSIG).
Script()
}
func getPubKeyScript(pubKey pack.Bytes) (pack.Bytes, error) {
script, err := getScript(pubKey)
if err != nil {
return nil, fmt.Errorf("invalid script: %v", err)
}
pubKeyScript, err := txscript.NewScriptBuilder().
AddOp(txscript.OP_HASH160).
AddData(btcutil.Hash160(script)).
AddOp(txscript.OP_EQUAL).
Script()
if err != nil {
return nil, fmt.Errorf("invalid pubkeyscript: %v", err)
}
return pubKeyScript, nil
}
================================================
FILE: test.sh
================================================
source ./infra/.env
docker-compose -f ./infra/docker-compose.yaml up --build -d
echo "Waiting for multichain to boot..."
sleep 30
go test -v ./...
docker-compose -f ./infra/docker-compose.yaml down
echo "Done!"