├── .gitignore ├── backend ├── testdata │ └── nonjsonfixture ├── electrum │ ├── README.md │ └── LICENSE ├── common.go ├── electrum_backend_test.go └── backend.go ├── coffee.jpg ├── vendor ├── github.com │ ├── btcsuite │ │ ├── websocket │ │ │ ├── .travis.yml │ │ │ ├── AUTHORS │ │ │ ├── .gitignore │ │ │ ├── util.go │ │ │ ├── LICENSE │ │ │ └── json.go │ │ ├── btcd │ │ │ ├── chaincfg │ │ │ │ ├── chainhash │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── hashfuncs.go │ │ │ │ │ └── README.md │ │ │ │ └── README.md │ │ │ ├── txscript │ │ │ │ ├── consensus.go │ │ │ │ ├── log.go │ │ │ │ ├── doc.go │ │ │ │ └── README.md │ │ │ ├── rpcclient │ │ │ │ ├── CONTRIBUTORS │ │ │ │ ├── log.go │ │ │ │ └── README.md │ │ │ ├── btcjson │ │ │ │ ├── CONTRIBUTORS │ │ │ │ ├── chainsvrwsresults.go │ │ │ │ ├── btcdextresults.go │ │ │ │ └── helpers.go │ │ │ ├── LICENSE │ │ │ ├── btcec │ │ │ │ ├── doc.go │ │ │ │ ├── genprecomps.go │ │ │ │ ├── precompute.go │ │ │ │ └── privkey.go │ │ │ └── wire │ │ │ │ ├── error.go │ │ │ │ ├── msgverack.go │ │ │ │ ├── msggetaddr.go │ │ │ │ ├── msgmempool.go │ │ │ │ ├── msgfilterclear.go │ │ │ │ ├── msgsendheaders.go │ │ │ │ ├── msgfeefilter.go │ │ │ │ ├── msggetcfcheckpt.go │ │ │ │ ├── msggetcfheaders.go │ │ │ │ └── msggetcfilters.go │ │ ├── btclog │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── doc.go │ │ │ ├── README.md │ │ │ ├── goclean.sh │ │ │ └── interface.go │ │ ├── btcutil │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── const.go │ │ │ ├── bech32 │ │ │ │ ├── doc.go │ │ │ │ └── README.md │ │ │ ├── cov_report.sh │ │ │ ├── net.go │ │ │ ├── base58 │ │ │ │ ├── cov_report.sh │ │ │ │ ├── doc.go │ │ │ │ ├── README.md │ │ │ │ ├── base58check.go │ │ │ │ ├── base58.go │ │ │ │ ├── genalphabet.go │ │ │ │ └── alphabet.go │ │ │ ├── hdkeychain │ │ │ │ ├── cov_report.sh │ │ │ │ └── test_coverage.txt │ │ │ ├── hash160.go │ │ │ ├── net_noop.go │ │ │ ├── LICENSE │ │ │ ├── goclean.sh │ │ │ ├── doc.go │ │ │ └── README.md │ │ └── go-socks │ │ │ ├── socks │ │ │ ├── addr.go │ │ │ └── conn.go │ │ │ └── LICENSE │ ├── pkg │ │ └── errors │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── appveyor.yml │ │ │ ├── LICENSE │ │ │ └── README.md │ ├── stretchr │ │ └── testify │ │ │ ├── assert │ │ │ ├── assertion_format.go.tmpl │ │ │ ├── assertion_forward.go.tmpl │ │ │ ├── errors.go │ │ │ ├── forward_assertions.go │ │ │ └── doc.go │ │ │ └── LICENSE │ ├── bcext │ │ ├── gcash │ │ │ ├── chaincfg │ │ │ │ ├── chainhash │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── hashfuncs.go │ │ │ │ │ └── README.md │ │ │ │ └── README.md │ │ │ ├── LICENSE │ │ │ ├── btcec │ │ │ │ ├── doc.go │ │ │ │ ├── genprecomps.go │ │ │ │ ├── precompute.go │ │ │ │ └── privkey.go │ │ │ └── wire │ │ │ │ ├── error.go │ │ │ │ ├── msgverack.go │ │ │ │ ├── msggetaddr.go │ │ │ │ ├── msgmempool.go │ │ │ │ ├── msgfilterclear.go │ │ │ │ ├── msgsendheaders.go │ │ │ │ ├── msgfeefilter.go │ │ │ │ ├── msggetcfcheckpt.go │ │ │ │ ├── invvect.go │ │ │ │ ├── msggetcfheaders.go │ │ │ │ └── msggetcfilters.go │ │ └── cashutil │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── glide.yaml │ │ │ ├── const.go │ │ │ ├── net.go │ │ │ ├── cov_report.sh │ │ │ ├── base58 │ │ │ ├── cov_report.sh │ │ │ ├── doc.go │ │ │ ├── README.md │ │ │ ├── base58check.go │ │ │ ├── base58.go │ │ │ ├── genalphabet.go │ │ │ └── alphabet.go │ │ │ ├── hash160.go │ │ │ ├── net_noop.go │ │ │ ├── LICENSE │ │ │ ├── goclean.sh │ │ │ ├── doc.go │ │ │ └── README.md │ ├── alecthomas │ │ ├── units │ │ │ ├── README.md │ │ │ ├── doc.go │ │ │ ├── si.go │ │ │ ├── COPYING │ │ │ └── bytes.go │ │ └── template │ │ │ ├── README.md │ │ │ └── LICENSE │ ├── davecgh │ │ └── go-spew │ │ │ ├── LICENSE │ │ │ └── spew │ │ │ └── bypasssafe.go │ ├── Masterminds │ │ └── semver │ │ │ ├── .travis.yml │ │ │ ├── Makefile │ │ │ ├── collection.go │ │ │ ├── appveyor.yml │ │ │ ├── LICENSE.txt │ │ │ └── CHANGELOG.md │ └── pmezard │ │ └── go-difflib │ │ └── LICENSE ├── gopkg.in │ └── alecthomas │ │ └── kingpin.v2 │ │ ├── .travis.yml │ │ ├── guesswidth.go │ │ ├── guesswidth_unix.go │ │ ├── completions.go │ │ ├── envar.go │ │ ├── COPYING │ │ ├── actions.go │ │ ├── values.json │ │ └── doc.go ├── golang.org │ └── x │ │ └── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── PATENTS │ │ └── LICENSE └── modules.txt ├── .github └── dependabot.yml ├── BUG-BOUNTY.md ├── .travis.yml ├── blockfinder └── blockfinder_test.go ├── CONTRIBUTING.md ├── go.mod └── deriver └── address_deriver_test.go /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | beancounter 3 | *.csv 4 | -------------------------------------------------------------------------------- /backend/testdata/nonjsonfixture: -------------------------------------------------------------------------------- 1 | SOME DATA THAT'S NOT VALID JSON 2 | -------------------------------------------------------------------------------- /coffee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/square/beancounter/master/coffee.jpg -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.1 5 | - 1.2 6 | - tip 7 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | install: go get -t -v ./... 4 | go: 1.2 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /backend/electrum/README.md: -------------------------------------------------------------------------------- 1 | This code was imported from github.com/mbyczkowski/go-electrum, a fork of 2 | github.com/qshuai/go-electrum, a fork of github.com/d4l3k/go-electrum. 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.3 5 | - 1.5.4 6 | - 1.6.2 7 | - 1.7.1 8 | - tip 9 | 10 | script: 11 | - go test -v ./... 12 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth.go: -------------------------------------------------------------------------------- 1 | // +build appengine !linux,!freebsd,!darwin,!dragonfly,!netbsd,!openbsd 2 | 3 | package kingpin 4 | 5 | import "io" 6 | 7 | func guessWidth(w io.Writer) int { 8 | return 80 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Gorilla WebSocket authors for copyright 2 | # purposes. 3 | # 4 | # Please keep the list sorted. 5 | 6 | Gary Burd 7 | Joachim Bauch 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/chaincfg/chainhash/doc.go: -------------------------------------------------------------------------------- 1 | // Package chainhash provides abstracted hash functionality. 2 | // 3 | // This package provides a generic hash type and associated functions that 4 | // allows the specific hash algorithm to be abstracted. 5 | package chainhash 6 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/chaincfg/chainhash/doc.go: -------------------------------------------------------------------------------- 1 | // Package chainhash provides abstracted hash functionality. 2 | // 3 | // This package provides a generic hash type and associated functions that 4 | // allows the specific hash algorithm to be abstracted. 5 | package chainhash 6 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/units/README.md: -------------------------------------------------------------------------------- 1 | # Units - Helpful unit multipliers and functions for Go 2 | 3 | The goal of this package is to have functionality similar to the [time](http://golang.org/pkg/time/) package. 4 | 5 | It allows for code like this: 6 | 7 | ```go 8 | n, err := ParseBase2Bytes("1KB") 9 | // n == 1024 10 | n = units.Mebibyte * 512 11 | ``` 12 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.7.x 4 | - 1.8.x 5 | sudo: false 6 | install: 7 | - go get -d -t -v ./... 8 | - go get -v golang.org/x/tools/cmd/cover 9 | - go get -v github.com/bradfitz/goimports 10 | - go get -v github.com/golang/lint/golint 11 | script: 12 | - export PATH=$PATH:$HOME/gopath/bin 13 | - ./goclean.sh 14 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /BUG-BOUNTY.md: -------------------------------------------------------------------------------- 1 | Serious about security 2 | ====================== 3 | 4 | Square recognizes the important contributions the security research community 5 | can make. We therefore encourage reporting security issues with the code 6 | contained in this repository. 7 | 8 | If you believe you have discovered a security vulnerability, please follow the 9 | guidelines at . 10 | 11 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/units/doc.go: -------------------------------------------------------------------------------- 1 | // Package units provides helpful unit multipliers and functions for Go. 2 | // 3 | // The goal of this package is to have functionality similar to the time [1] package. 4 | // 5 | // 6 | // [1] http://golang.org/pkg/time/ 7 | // 8 | // It allows for code like this: 9 | // 10 | // n, err := ParseBase2Bytes("1KB") 11 | // // n == 1024 12 | // n = units.Mebibyte * 512 13 | package units 14 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.9.4" 4 | - "1.10" 5 | sudo: false 6 | install: 7 | - go get -d -t -v ./... 8 | - go get -v github.com/alecthomas/gometalinter 9 | - gometalinter --install 10 | script: 11 | - export PATH=$PATH:$HOME/gopath/bin 12 | - ./goclean.sh 13 | after_success: 14 | - go get -v github.com/mattn/goveralls 15 | - goveralls -coverprofile=profile.cov -service=travis-ci 16 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.9.4" 4 | - "1.10" 5 | sudo: false 6 | install: 7 | - go get -d -t -v ./... 8 | - go get -v github.com/alecthomas/gometalinter 9 | - gometalinter --install 10 | script: 11 | - export PATH=$PATH:$HOME/gopath/bin 12 | - ./goclean.sh 13 | after_success: 14 | - go get -v github.com/mattn/goveralls 15 | - goveralls -coverprofile=profile.cov -service=travis-ci 16 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/.gitignore: -------------------------------------------------------------------------------- 1 | # Temp files 2 | *~ 3 | 4 | # Log files 5 | *.log 6 | 7 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 8 | *.o 9 | *.a 10 | *.so 11 | 12 | # Folders 13 | _obj 14 | _test 15 | 16 | # Architecture specific extensions/prefixes 17 | *.[568vq] 18 | [568vq].out 19 | 20 | *.cgo1.go 21 | *.cgo2.c 22 | _cgo_defun.c 23 | _cgo_gotypes.go 24 | _cgo_export.* 25 | 26 | _testmain.go 27 | 28 | *.exe 29 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/.gitignore: -------------------------------------------------------------------------------- 1 | # Temp files 2 | *~ 3 | 4 | # Log files 5 | *.log 6 | 7 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 8 | *.o 9 | *.a 10 | *.so 11 | 12 | # Folders 13 | _obj 14 | _test 15 | 16 | # Architecture specific extensions/prefixes 17 | *.[568vq] 18 | [568vq].out 19 | 20 | *.cgo1.go 21 | *.cgo2.c 22 | _cgo_defun.c 23 | _cgo_gotypes.go 24 | _cgo_export.* 25 | 26 | _testmain.go 27 | 28 | *.exe 29 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/.gitignore: -------------------------------------------------------------------------------- 1 | # Temp files 2 | *~ 3 | 4 | # Log files 5 | *.log 6 | 7 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 8 | *.o 9 | *.a 10 | *.so 11 | 12 | # Folders 13 | _obj 14 | _test 15 | 16 | # Architecture specific extensions/prefixes 17 | *.[568vq] 18 | [568vq].out 19 | 20 | *.cgo1.go 21 | *.cgo2.c 22 | _cgo_defun.c 23 | _cgo_gotypes.go 24 | _cgo_export.* 25 | 26 | _testmain.go 27 | 28 | *.exe 29 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs 17 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/template/README.md: -------------------------------------------------------------------------------- 1 | # Go's `text/template` package with newline elision 2 | 3 | This is a fork of Go 1.4's [text/template](http://golang.org/pkg/text/template/) package with one addition: a backslash immediately after a closing delimiter will delete all subsequent newlines until a non-newline. 4 | 5 | eg. 6 | 7 | ``` 8 | {{if true}}\ 9 | hello 10 | {{end}}\ 11 | ``` 12 | 13 | Will result in: 14 | 15 | ``` 16 | hello\n 17 | ``` 18 | 19 | Rather than: 20 | 21 | ``` 22 | \n 23 | hello\n 24 | \n 25 | ``` 26 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/go-socks/socks/addr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Samuel Stauffer. All rights reserved. 2 | // Use of this source code is governed by a 3-clause BSD 3 | // license that can be found in the LICENSE file. 4 | 5 | package socks 6 | 7 | import "fmt" 8 | 9 | type ProxiedAddr struct { 10 | Net string 11 | Host string 12 | Port int 13 | } 14 | 15 | func (a *ProxiedAddr) Network() string { 16 | return a.Net 17 | } 18 | 19 | func (a *ProxiedAddr) String() string { 20 | return fmt.Sprintf("%s:%d", a.Host, a.Port) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/txscript/consensus.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package txscript 6 | 7 | const ( 8 | // LockTimeThreshold is the number below which a lock time is 9 | // interpreted to be a block number. Since an average of one block 10 | // is generated per 10 minutes, this allows blocks for about 9,512 11 | // years. 12 | LockTimeThreshold = 5e8 // Tue Nov 5 00:53:20 1985 UTC 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/glide.yaml: -------------------------------------------------------------------------------- 1 | package: github.com/bcext/cashutil 2 | import: 3 | - package: github.com/aead/siphash 4 | - package: github.com/bcext/gcash 5 | version: 067de8b6c8108fb5df47ccbea453b0c6e727d5ba 6 | subpackages: 7 | - blockchain 8 | - btcec 9 | - chaincfg 10 | - chaincfg/chainhash 11 | - txscript 12 | - wire 13 | - package: github.com/kkdai/bstream 14 | - package: golang.org/x/crypto 15 | subpackages: 16 | - ripemd160 17 | testImport: 18 | - package: github.com/davecgh/go-spew 19 | subpackages: 20 | - spew 21 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/const.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package cashutil 6 | 7 | const ( 8 | // SatoshiPerBitcent is the number of satoshi in one bitcoin cent. 9 | SatoshiPerBitcent = 1e6 10 | 11 | // SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BCH). 12 | SatoshiPerBitcoin = 1e8 13 | 14 | // MaxSatoshi is the maximum transaction amount allowed in satoshi. 15 | MaxSatoshi = 21e6 * SatoshiPerBitcoin 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/const.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcutil 6 | 7 | const ( 8 | // SatoshiPerBitcent is the number of satoshi in one bitcoin cent. 9 | SatoshiPerBitcent = 1e6 10 | 11 | // SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC). 12 | SatoshiPerBitcoin = 1e8 13 | 14 | // MaxSatoshi is the maximum transaction amount allowed in satoshi. 15 | MaxSatoshi = 21e6 * SatoshiPerBitcoin 16 | ) 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | language: go 4 | 5 | go: 6 | - '1.13.4' 7 | 8 | before_install: 9 | - go get github.com/mattn/goveralls 10 | 11 | install: 12 | - GOOS=linux GOARCH=amd64 go build -o beancounter-${TRAVIS_TAG}-linux-amd64 13 | - GOOS=darwin GOARCH=amd64 go build -o beancounter-${TRAVIS_TAG}-osx-amd64 14 | - GOOS=windows GOARCH=amd64 go build -o beancounter-${TRAVIS_TAG}-windows-amd64.exe 15 | 16 | script: 17 | - go test -v ./... -coverprofile coverage.out 18 | 19 | after_success: 20 | - $HOME/gopath/bin/goveralls -coverprofile coverage.out -service=travis-ci 21 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/rpcclient/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the list of people who have contributed code to the repository. 2 | # 3 | # Names should be added to this file only after verifying that the individual 4 | # or the individual's organization has agreed to the LICENSE. 5 | # 6 | # Names should be added to this file like so: 7 | # Name 8 | 9 | Dave Collins 10 | Geert-Johan Riemer 11 | Josh Rickmar 12 | Michalis Kargakis 13 | Ruben de Vries /dev/null 2>&1 11 | if [ $? -ne 0 ]; then 12 | echo >&2 "This script requires the gocov tool." 13 | echo >&2 "You may obtain it with the following command:" 14 | echo >&2 "go get github.com/axw/gocov/gocov" 15 | exit 1 16 | fi 17 | gocov test | gocov report 18 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/cov_report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script uses gocov to generate a test coverage report. 4 | # The gocov tool my be obtained with the following command: 5 | # go get github.com/axw/gocov/gocov 6 | # 7 | # It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. 8 | 9 | # Check for gocov. 10 | type gocov >/dev/null 2>&1 11 | if [ $? -ne 0 ]; then 12 | echo >&2 "This script requires the gocov tool." 13 | echo >&2 "You may obtain it with the following command:" 14 | echo >&2 "go get github.com/axw/gocov/gocov" 15 | exit 1 16 | fi 17 | gocov test | gocov report 18 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/net.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | 7 | package btcutil 8 | 9 | import ( 10 | "net" 11 | ) 12 | 13 | // interfaceAddrs returns a list of the system's network interface addresses. 14 | // It is wrapped here so that we can substitute it for other functions when 15 | // building for systems that do not allow access to net.InterfaceAddrs(). 16 | func interfaceAddrs() ([]net.Addr, error) { 17 | return net.InterfaceAddrs() 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/cov_report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script uses gocov to generate a test coverage report. 4 | # The gocov tool my be obtained with the following command: 5 | # go get github.com/axw/gocov/gocov 6 | # 7 | # It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. 8 | 9 | # Check for gocov. 10 | type gocov >/dev/null 2>&1 11 | if [ $? -ne 0 ]; then 12 | echo >&2 "This script requires the gocov tool." 13 | echo >&2 "You may obtain it with the following command:" 14 | echo >&2 "go get github.com/axw/gocov/gocov" 15 | exit 1 16 | fi 17 | gocov test | gocov report 18 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/cov_report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script uses gocov to generate a test coverage report. 4 | # The gocov tool my be obtained with the following command: 5 | # go get github.com/axw/gocov/gocov 6 | # 7 | # It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. 8 | 9 | # Check for gocov. 10 | type gocov >/dev/null 2>&1 11 | if [ $? -ne 0 ]; then 12 | echo >&2 "This script requires the gocov tool." 13 | echo >&2 "You may obtain it with the following command:" 14 | echo >&2 "go get github.com/axw/gocov/gocov" 15 | exit 1 16 | fi 17 | gocov test | gocov report 18 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/hdkeychain/cov_report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script uses gocov to generate a test coverage report. 4 | # The gocov tool my be obtained with the following command: 5 | # go get github.com/axw/gocov/gocov 6 | # 7 | # It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. 8 | 9 | # Check for gocov. 10 | type gocov >/dev/null 2>&1 11 | if [ $? -ne 0 ]; then 12 | echo >&2 "This script requires the gocov tool." 13 | echo >&2 "You may obtain it with the following command:" 14 | echo >&2 "go get github.com/axw/gocov/gocov" 15 | exit 1 16 | fi 17 | gocov test | gocov report 18 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/hash160.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package cashutil 6 | 7 | import ( 8 | "crypto/sha256" 9 | "hash" 10 | 11 | "golang.org/x/crypto/ripemd160" 12 | ) 13 | 14 | // Calculate the hash of hasher over buf. 15 | func calcHash(buf []byte, hasher hash.Hash) []byte { 16 | hasher.Write(buf) 17 | return hasher.Sum(nil) 18 | } 19 | 20 | // Hash160 calculates the hash ripemd160(sha256(b)). 21 | func Hash160(buf []byte) []byte { 22 | return calcHash(calcHash(buf, sha256.New()), ripemd160.New()) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/net_noop.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package cashutil 8 | 9 | import ( 10 | "net" 11 | ) 12 | 13 | // interfaceAddrs returns a list of the system's network interface addresses. 14 | // It is wrapped here so that we can substitute it for a no-op function that 15 | // returns an empty slice of net.Addr when building for systems that do not 16 | // allow access to net.InterfaceAddrs(). 17 | func interfaceAddrs() ([]net.Addr, error) { 18 | return []net.Addr{}, nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/hash160.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcutil 6 | 7 | import ( 8 | "crypto/sha256" 9 | "hash" 10 | 11 | "golang.org/x/crypto/ripemd160" 12 | ) 13 | 14 | // Calculate the hash of hasher over buf. 15 | func calcHash(buf []byte, hasher hash.Hash) []byte { 16 | hasher.Write(buf) 17 | return hasher.Sum(nil) 18 | } 19 | 20 | // Hash160 calculates the hash ripemd160(sha256(b)). 21 | func Hash160(buf []byte) []byte { 22 | return calcHash(calcHash(buf, sha256.New()), ripemd160.New()) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/net_noop.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build appengine 6 | 7 | package btcutil 8 | 9 | import ( 10 | "net" 11 | ) 12 | 13 | // interfaceAddrs returns a list of the system's network interface addresses. 14 | // It is wrapped here so that we can substitute it for a no-op function that 15 | // returns an empty slice of net.Addr when building for systems that do not 16 | // allow access to net.InterfaceAddrs(). 17 | func interfaceAddrs() ([]net.Addr, error) { 18 | return []net.Addr{}, nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcjson/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the list of people who have contributed code to the repository. 2 | # 3 | # Names should be added to this file only after verifying that the individual 4 | # or the individual's organization has agreed to the LICENSE. 5 | # 6 | # Names should be added to this file like so: 7 | # Name 8 | 9 | John C. Vernaleo 10 | Dave Collins 11 | Owain G. Ainsworth 12 | David Hill 13 | Josh Rickmar 14 | Andreas Metsälä 15 | Francis Lam 16 | Geert-Johan Riemer 17 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcjson/chainsvrwsresults.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2017 The btcsuite developers 2 | // Copyright (c) 2015-2017 The Decred developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package btcjson 7 | 8 | // SessionResult models the data from the session command. 9 | type SessionResult struct { 10 | SessionID uint64 `json:"sessionid"` 11 | } 12 | 13 | // RescannedBlock contains the hash and all discovered transactions of a single 14 | // rescanned block. 15 | // 16 | // NOTE: This is a btcsuite extension ported from 17 | // github.com/decred/dcrd/dcrjson. 18 | type RescannedBlock struct { 19 | Hash string `json:"hash"` 20 | Transactions []string `json:"transactions"` 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/units/si.go: -------------------------------------------------------------------------------- 1 | package units 2 | 3 | // SI units. 4 | type SI int64 5 | 6 | // SI unit multiples. 7 | const ( 8 | Kilo SI = 1000 9 | Mega = Kilo * 1000 10 | Giga = Mega * 1000 11 | Tera = Giga * 1000 12 | Peta = Tera * 1000 13 | Exa = Peta * 1000 14 | ) 15 | 16 | func MakeUnitMap(suffix, shortSuffix string, scale int64) map[string]float64 { 17 | return map[string]float64{ 18 | shortSuffix: 1, 19 | "K" + suffix: float64(scale), 20 | "M" + suffix: float64(scale * scale), 21 | "G" + suffix: float64(scale * scale * scale), 22 | "T" + suffix: float64(scale * scale * scale * scale), 23 | "P" + suffix: float64(scale * scale * scale * scale * scale), 24 | "E" + suffix: float64(scale * scale * scale * scale * scale * scale), 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2014 Conformal Systems LLC. 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcjson/btcdextresults.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-2017 The btcsuite developers 2 | // Copyright (c) 2015-2017 The Decred developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package btcjson 7 | 8 | // VersionResult models objects included in the version response. In the actual 9 | // result, these objects are keyed by the program or API name. 10 | // 11 | // NOTE: This is a btcsuite extension ported from 12 | // github.com/decred/dcrd/dcrjson. 13 | type VersionResult struct { 14 | VersionString string `json:"versionstring"` 15 | Major uint32 `json:"major"` 16 | Minor uint32 `json:"minor"` 17 | Patch uint32 `json:"patch"` 18 | Prerelease string `json:"prerelease"` 19 | BuildMetadata string `json:"buildmetadata"` 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6.x 5 | - 1.7.x 6 | - 1.8.x 7 | - 1.9.x 8 | - 1.10.x 9 | - tip 10 | 11 | # Setting sudo access to false will let Travis CI use containers rather than 12 | # VMs to run the tests. For more details see: 13 | # - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ 14 | # - http://docs.travis-ci.com/user/workers/standard-infrastructure/ 15 | sudo: false 16 | 17 | script: 18 | - make setup 19 | - make test 20 | 21 | notifications: 22 | webhooks: 23 | urls: 24 | - https://webhooks.gitter.im/e/06e3328629952dabe3e0 25 | on_success: change # options: [always|never|change] default: always 26 | on_failure: always # options: [always|never|change] default: always 27 | on_start: never # options: [always|never|change] default: always 28 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: setup 2 | setup: 3 | go get -u gopkg.in/alecthomas/gometalinter.v1 4 | gometalinter.v1 --install 5 | 6 | .PHONY: test 7 | test: validate lint 8 | @echo "==> Running tests" 9 | go test -v 10 | 11 | .PHONY: validate 12 | validate: 13 | @echo "==> Running static validations" 14 | @gometalinter.v1 \ 15 | --disable-all \ 16 | --enable deadcode \ 17 | --severity deadcode:error \ 18 | --enable gofmt \ 19 | --enable gosimple \ 20 | --enable ineffassign \ 21 | --enable misspell \ 22 | --enable vet \ 23 | --tests \ 24 | --vendor \ 25 | --deadline 60s \ 26 | ./... || exit_code=1 27 | 28 | .PHONY: lint 29 | lint: 30 | @echo "==> Running linters" 31 | @gometalinter.v1 \ 32 | --disable-all \ 33 | --enable golint \ 34 | --vendor \ 35 | --deadline 60s \ 36 | ./... || : 37 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We appreciate your desire to contribute code to this repo. You may do so through GitHub 4 | by forking the repository and sending a pull request. 5 | 6 | When submitting code, please make every effort to follow existing conventions 7 | and style in order to keep the code as readable as possible. Please also make 8 | sure all tests pass. 9 | 10 | Before your code can be accepted into the project you must also sign the 11 | [Individual Contributor License Agreement (CLA)][1]. 12 | 13 | Pull requests need to be approved by two members of Square's security engineering team. 14 | 15 | Commits are signed by Square's security engineers. Merges are signed by GitHub. Contributors 16 | are not required to sign their commits. 17 | 18 | [1]: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1 19 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/collection.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | // Collection is a collection of Version instances and implements the sort 4 | // interface. See the sort package for more details. 5 | // https://golang.org/pkg/sort/ 6 | type Collection []*Version 7 | 8 | // Len returns the length of a collection. The number of Version instances 9 | // on the slice. 10 | func (c Collection) Len() int { 11 | return len(c) 12 | } 13 | 14 | // Less is needed for the sort interface to compare two Version objects on the 15 | // slice. If checks if one is less than the other. 16 | func (c Collection) Less(i, j int) bool { 17 | return c[i].LessThan(c[j]) 18 | } 19 | 20 | // Swap is needed for the sort interface to replace the Version objects 21 | // at two different positions in the slice. 22 | func (c Collection) Swap(i, j int) { 23 | c[i], c[j] = c[j], c[i] 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2017 The btcsuite developers 4 | Copyright (c) 2015-2016 The Decred developers 5 | 6 | Permission to use, copy, modify, and distribute this software for any 7 | purpose with or without fee is hereby granted, provided that the above 8 | copyright notice and this permission notice appear in all copies. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2017 The btcsuite developers 4 | Copyright (c) 2016-2017 The Lightning Network Developers 5 | 6 | Permission to use, copy, modify, and distribute this software for any 7 | purpose with or without fee is hereby granted, provided that the above 8 | copyright notice and this permission notice appear in all copies. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2017 The btcsuite developers 4 | Copyright (c) 2015-2016 The Decred developers 5 | Copyright (c) 2018 The bcext developers 6 | 7 | Permission to use, copy, modify, and distribute this software for any 8 | purpose with or without fee is hereby granted, provided that the above 9 | copyright notice and this permission notice appear in all copies. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/guesswidth_unix.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,linux freebsd darwin dragonfly netbsd openbsd 2 | 3 | package kingpin 4 | 5 | import ( 6 | "io" 7 | "os" 8 | "strconv" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | func guessWidth(w io.Writer) int { 14 | // check if COLUMNS env is set to comply with 15 | // http://pubs.opengroup.org/onlinepubs/009604499/basedefs/xbd_chap08.html 16 | colsStr := os.Getenv("COLUMNS") 17 | if colsStr != "" { 18 | if cols, err := strconv.Atoi(colsStr); err == nil { 19 | return cols 20 | } 21 | } 22 | 23 | if t, ok := w.(*os.File); ok { 24 | fd := t.Fd() 25 | var dimensions [4]uint16 26 | 27 | if _, _, err := syscall.Syscall6( 28 | syscall.SYS_IOCTL, 29 | uintptr(fd), 30 | uintptr(syscall.TIOCGWINSZ), 31 | uintptr(unsafe.Pointer(&dimensions)), 32 | 0, 0, 0, 33 | ); err == 0 { 34 | return int(dimensions[1]) 35 | } 36 | } 37 | return 80 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2013-2017 The btcsuite developers 4 | Copyright (c) 2016-2017 The Lightning Network Developers 5 | Copyright (c) 2018 The bcext developers 6 | 7 | Permission to use, copy, modify, and distribute this software for any 8 | purpose with or without fee is hereby granted, provided that the above 9 | copyright notice and this permission notice appear in all copies. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/square/beancounter 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/Masterminds/semver v1.5.0 7 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect 8 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect 9 | github.com/bcext/cashutil v0.0.0-20180827115045-9ba6cf292283 10 | github.com/bcext/gcash v0.0.0-20180921133405-3f4b56493047 // indirect 11 | github.com/btcsuite/btcd v0.0.0-20180924021209-2a560b2036be 12 | github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect 13 | github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a 14 | github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect 15 | github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect 16 | github.com/davecgh/go-spew v1.1.1 // indirect 17 | github.com/pkg/errors v0.9.1 18 | github.com/stretchr/testify v1.7.0 19 | golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 // indirect 20 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 21 | ) 22 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\Masterminds\semver 4 | shallow_clone: true 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | install: 13 | - go version 14 | - go env 15 | - go get -u gopkg.in/alecthomas/gometalinter.v1 16 | - set PATH=%PATH%;%GOPATH%\bin 17 | - gometalinter.v1.exe --install 18 | 19 | build_script: 20 | - go install -v ./... 21 | 22 | test_script: 23 | - "gometalinter.v1 \ 24 | --disable-all \ 25 | --enable deadcode \ 26 | --severity deadcode:error \ 27 | --enable gofmt \ 28 | --enable gosimple \ 29 | --enable ineffassign \ 30 | --enable misspell \ 31 | --enable vet \ 32 | --tests \ 33 | --vendor \ 34 | --deadline 60s \ 35 | ./... || exit_code=1" 36 | - "gometalinter.v1 \ 37 | --disable-all \ 38 | --enable golint \ 39 | --vendor \ 40 | --deadline 60s \ 41 | ./... || :" 42 | - go test -v 43 | 44 | deploy: off 45 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/btcec/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package btcec implements support for the elliptic curves needed for bitcoin. 7 | 8 | Bitcoin uses elliptic curve cryptography using koblitz curves 9 | (specifically secp256k1) for cryptographic functions. See 10 | http://www.secg.org/collateral/sec2_final.pdf for details on the 11 | standard. 12 | 13 | This package provides the data structures and functions implementing the 14 | crypto/elliptic Curve interface in order to permit using these curves 15 | with the standard crypto/ecdsa package provided with go. Helper 16 | functionality is provided to parse signatures and public keys from 17 | standard formats. It was designed for use with btcd, but should be 18 | general enough for other uses of elliptic curve crypto. It was originally based 19 | on some initial work by ThePiachu, but has significantly diverged since then. 20 | */ 21 | package btcec 22 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcec/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package btcec implements support for the elliptic curves needed for bitcoin. 7 | 8 | Bitcoin uses elliptic curve cryptography using koblitz curves 9 | (specifically secp256k1) for cryptographic functions. See 10 | http://www.secg.org/collateral/sec2_final.pdf for details on the 11 | standard. 12 | 13 | This package provides the data structures and functions implementing the 14 | crypto/elliptic Curve interface in order to permit using these curves 15 | with the standard crypto/ecdsa package provided with go. Helper 16 | functionality is provided to parse signatures and public keys from 17 | standard formats. It was designed for use with btcd, but should be 18 | general enough for other uses of elliptic curve crypto. It was originally based 19 | on some initial work by ThePiachu, but has significantly diverged since then. 20 | */ 21 | package btcec 22 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/chaincfg/chainhash/hashfuncs.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Decred developers 2 | // Copyright (c) 2016-2017 The btcsuite developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package chainhash 7 | 8 | import "crypto/sha256" 9 | 10 | // HashB calculates hash(b) and returns the resulting bytes. 11 | func HashB(b []byte) []byte { 12 | hash := sha256.Sum256(b) 13 | return hash[:] 14 | } 15 | 16 | // HashH calculates hash(b) and returns the resulting bytes as a Hash. 17 | func HashH(b []byte) Hash { 18 | return Hash(sha256.Sum256(b)) 19 | } 20 | 21 | // DoubleHashB calculates hash(hash(b)) and returns the resulting bytes. 22 | func DoubleHashB(b []byte) []byte { 23 | first := sha256.Sum256(b) 24 | second := sha256.Sum256(first[:]) 25 | return second[:] 26 | } 27 | 28 | // DoubleHashH calculates hash(hash(b)) and returns the resulting bytes as a 29 | // Hash. 30 | func DoubleHashH(b []byte) Hash { 31 | first := sha256.Sum256(b) 32 | return Hash(sha256.Sum256(first[:])) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/chaincfg/chainhash/hashfuncs.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Decred developers 2 | // Copyright (c) 2016-2017 The btcsuite developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package chainhash 7 | 8 | import "crypto/sha256" 9 | 10 | // HashB calculates hash(b) and returns the resulting bytes. 11 | func HashB(b []byte) []byte { 12 | hash := sha256.Sum256(b) 13 | return hash[:] 14 | } 15 | 16 | // HashH calculates hash(b) and returns the resulting bytes as a Hash. 17 | func HashH(b []byte) Hash { 18 | return Hash(sha256.Sum256(b)) 19 | } 20 | 21 | // DoubleHashB calculates hash(hash(b)) and returns the resulting bytes. 22 | func DoubleHashB(b []byte) []byte { 23 | first := sha256.Sum256(b) 24 | second := sha256.Sum256(first[:]) 25 | return second[:] 26 | } 27 | 28 | // DoubleHashH calculates hash(hash(b)) and returns the resulting bytes as a 29 | // Hash. 30 | func DoubleHashH(b []byte) Hash { 31 | first := sha256.Sum256(b) 32 | return Hash(sha256.Sum256(first[:])) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/completions.go: -------------------------------------------------------------------------------- 1 | package kingpin 2 | 3 | // HintAction is a function type who is expected to return a slice of possible 4 | // command line arguments. 5 | type HintAction func() []string 6 | type completionsMixin struct { 7 | hintActions []HintAction 8 | builtinHintActions []HintAction 9 | } 10 | 11 | func (a *completionsMixin) addHintAction(action HintAction) { 12 | a.hintActions = append(a.hintActions, action) 13 | } 14 | 15 | // Allow adding of HintActions which are added internally, ie, EnumVar 16 | func (a *completionsMixin) addHintActionBuiltin(action HintAction) { 17 | a.builtinHintActions = append(a.builtinHintActions, action) 18 | } 19 | 20 | func (a *completionsMixin) resolveCompletions() []string { 21 | var hints []string 22 | 23 | options := a.builtinHintActions 24 | if len(a.hintActions) > 0 { 25 | // User specified their own hintActions. Use those instead. 26 | options = a.hintActions 27 | } 28 | 29 | for _, hintAction := range options { 30 | hints = append(hints, hintAction()...) 31 | } 32 | return hints 33 | } 34 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/envar.go: -------------------------------------------------------------------------------- 1 | package kingpin 2 | 3 | import ( 4 | "os" 5 | "regexp" 6 | ) 7 | 8 | var ( 9 | envVarValuesSeparator = "\r?\n" 10 | envVarValuesTrimmer = regexp.MustCompile(envVarValuesSeparator + "$") 11 | envVarValuesSplitter = regexp.MustCompile(envVarValuesSeparator) 12 | ) 13 | 14 | type envarMixin struct { 15 | envar string 16 | noEnvar bool 17 | } 18 | 19 | func (e *envarMixin) HasEnvarValue() bool { 20 | return e.GetEnvarValue() != "" 21 | } 22 | 23 | func (e *envarMixin) GetEnvarValue() string { 24 | if e.noEnvar || e.envar == "" { 25 | return "" 26 | } 27 | return os.Getenv(e.envar) 28 | } 29 | 30 | func (e *envarMixin) GetSplitEnvarValue() []string { 31 | values := make([]string, 0) 32 | 33 | envarValue := e.GetEnvarValue() 34 | if envarValue == "" { 35 | return values 36 | } 37 | 38 | // Split by new line to extract multiple values, if any. 39 | trimmed := envVarValuesTrimmer.ReplaceAllString(envarValue, "") 40 | for _, value := range envVarValuesSplitter.Split(trimmed, -1) { 41 | values = append(values, value) 42 | } 43 | 44 | return values 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/units/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Alec Thomas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Alec Thomas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /backend/electrum/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Tristan Rice 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package btclog defines an interface and default implementation for subsystem 7 | logging. 8 | 9 | Log level verbosity may be modified at runtime for each individual subsystem 10 | logger. 11 | 12 | The default implementation in this package must be created by the Backend type. 13 | Backends can write to any io.Writer, including multi-writers created by 14 | io.MultiWriter. Multi-writers allow log output to be written to many writers, 15 | including standard output and log files. 16 | 17 | Optional logging behavior can be specified by using the LOGFLAGS environment 18 | variable and overridden per-Backend by using the WithFlags call option. Multiple 19 | LOGFLAGS options can be specified, separated by commas. The following options 20 | are recognized: 21 | 22 | longfile: Include the full filepath and line number in all log messages 23 | 24 | shortfile: Include the filename and line number in all log messages. 25 | Overrides longfile. 26 | */ 27 | package btclog 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/actions.go: -------------------------------------------------------------------------------- 1 | package kingpin 2 | 3 | // Action callback executed at various stages after all values are populated. 4 | // The application, commands, arguments and flags all have corresponding 5 | // actions. 6 | type Action func(*ParseContext) error 7 | 8 | type actionMixin struct { 9 | actions []Action 10 | preActions []Action 11 | } 12 | 13 | type actionApplier interface { 14 | applyActions(*ParseContext) error 15 | applyPreActions(*ParseContext) error 16 | } 17 | 18 | func (a *actionMixin) addAction(action Action) { 19 | a.actions = append(a.actions, action) 20 | } 21 | 22 | func (a *actionMixin) addPreAction(action Action) { 23 | a.preActions = append(a.preActions, action) 24 | } 25 | 26 | func (a *actionMixin) applyActions(context *ParseContext) error { 27 | for _, action := range a.actions { 28 | if err := action(context); err != nil { 29 | return err 30 | } 31 | } 32 | return nil 33 | } 34 | 35 | func (a *actionMixin) applyPreActions(context *ParseContext) error { 36 | for _, preAction := range a.preActions { 37 | if err := preAction(context); err != nil { 38 | return err 39 | } 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The Masterminds 2 | Copyright (C) 2014-2015, Matt Butcher and Matt Farina 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/bech32/README.md: -------------------------------------------------------------------------------- 1 | bech32 2 | ========== 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcutil.svg)](https://travis-ci.org/btcsuite/btcutil) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://godoc.org/github.com/btcsuite/btcutil/bech32?status.png)](http://godoc.org/github.com/btcsuite/btcutil/bech32) 7 | 8 | Package bech32 provides a Go implementation of the bech32 format specified in 9 | [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). 10 | 11 | Test vectors from BIP 173 are added to ensure compatibility with the BIP. 12 | 13 | ## Installation and Updating 14 | 15 | ```bash 16 | $ go get -u github.com/btcsuite/btcutil/bech32 17 | ``` 18 | 19 | ## Examples 20 | 21 | * [Bech32 decode Example](http://godoc.org/github.com/btcsuite/btcutil/bech32#example-Bech32Decode) 22 | Demonstrates how to decode a bech32 encoded string. 23 | * [Bech32 encode Example](http://godoc.org/github.com/btcsuite/btcutil/bech32#example-BechEncode) 24 | Demonstrates how to encode data into a bech32 string. 25 | 26 | ## License 27 | 28 | Package bech32 is licensed under the [copyfree](http://copyfree.org) ISC 29 | License. 30 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/error.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | ) 10 | 11 | // MessageError describes an issue with a message. 12 | // An example of some potential issues are messages from the wrong bitcoin 13 | // network, invalid commands, mismatched checksums, and exceeding max payloads. 14 | // 15 | // This provides a mechanism for the caller to type assert the error to 16 | // differentiate between general io errors such as io.EOF and issues that 17 | // resulted from malformed messages. 18 | type MessageError struct { 19 | Func string // Function name 20 | Description string // Human readable description of the issue 21 | } 22 | 23 | // Error satisfies the error interface and prints human-readable errors. 24 | func (e *MessageError) Error() string { 25 | if e.Func != "" { 26 | return fmt.Sprintf("%v: %v", e.Func, e.Description) 27 | } 28 | return e.Description 29 | } 30 | 31 | // messageError creates an error for the given function and description. 32 | func messageError(f string, desc string) *MessageError { 33 | return &MessageError{Func: f, Description: desc} 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/error.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | ) 10 | 11 | // MessageError describes an issue with a message. 12 | // An example of some potential issues are messages from the wrong bitcoin 13 | // network, invalid commands, mismatched checksums, and exceeding max payloads. 14 | // 15 | // This provides a mechanism for the caller to type assert the error to 16 | // differentiate between general io errors such as io.EOF and issues that 17 | // resulted from malformed messages. 18 | type MessageError struct { 19 | Func string // Function name 20 | Description string // Human readable description of the issue 21 | } 22 | 23 | // Error satisfies the error interface and prints human-readable errors. 24 | func (e *MessageError) Error() string { 25 | if e.Func != "" { 26 | return fmt.Sprintf("%v: %v", e.Func, e.Description) 27 | } 28 | return e.Description 29 | } 30 | 31 | // messageError creates an error for the given function and description. 32 | func messageError(f string, desc string) *MessageError { 33 | return &MessageError{Func: f, Description: desc} 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "crypto/rand" 9 | "crypto/sha1" 10 | "encoding/base64" 11 | "io" 12 | "net/http" 13 | "strings" 14 | ) 15 | 16 | // tokenListContainsValue returns true if the 1#token header with the given 17 | // name contains token. 18 | func tokenListContainsValue(header http.Header, name string, value string) bool { 19 | for _, v := range header[name] { 20 | for _, s := range strings.Split(v, ",") { 21 | if strings.EqualFold(value, strings.TrimSpace(s)) { 22 | return true 23 | } 24 | } 25 | } 26 | return false 27 | } 28 | 29 | var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11") 30 | 31 | func computeAcceptKey(challengeKey string) string { 32 | h := sha1.New() 33 | h.Write([]byte(challengeKey)) 34 | h.Write(keyGUID) 35 | return base64.StdEncoding.EncodeToString(h.Sum(nil)) 36 | } 37 | 38 | func generateChallengeKey() (string, error) { 39 | p := make([]byte, 16) 40 | if _, err := io.ReadFull(rand.Reader, p); err != nil { 41 | return "", err 42 | } 43 | return base64.StdEncoding.EncodeToString(p), nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/txscript/log.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package txscript 6 | 7 | import ( 8 | "github.com/btcsuite/btclog" 9 | ) 10 | 11 | // log is a logger that is initialized with no output filters. This 12 | // means the package will not perform any logging by default until the caller 13 | // requests it. 14 | var log btclog.Logger 15 | 16 | // The default amount of logging is none. 17 | func init() { 18 | DisableLog() 19 | } 20 | 21 | // DisableLog disables all library log output. Logging output is disabled 22 | // by default until UseLogger is called. 23 | func DisableLog() { 24 | log = btclog.Disabled 25 | } 26 | 27 | // UseLogger uses a specified Logger to output package logging info. 28 | func UseLogger(logger btclog.Logger) { 29 | log = logger 30 | } 31 | 32 | // LogClosure is a closure that can be printed with %v to be used to 33 | // generate expensive-to-create data for a detailed log level and avoid doing 34 | // the work if the data isn't printed. 35 | type logClosure func() string 36 | 37 | func (c logClosure) String() string { 38 | return c() 39 | } 40 | 41 | func newLogClosure(c func() string) logClosure { 42 | return logClosure(c) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/go-socks/socks/conn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Samuel Stauffer. All rights reserved. 2 | // Use of this source code is governed by a 3-clause BSD 3 | // license that can be found in the LICENSE file. 4 | 5 | package socks 6 | 7 | import ( 8 | "net" 9 | "time" 10 | ) 11 | 12 | type proxiedConn struct { 13 | conn net.Conn 14 | remoteAddr *ProxiedAddr 15 | boundAddr *ProxiedAddr 16 | } 17 | 18 | func (c *proxiedConn) Read(b []byte) (int, error) { 19 | return c.conn.Read(b) 20 | } 21 | 22 | func (c *proxiedConn) Write(b []byte) (int, error) { 23 | return c.conn.Write(b) 24 | } 25 | 26 | func (c *proxiedConn) Close() error { 27 | return c.conn.Close() 28 | } 29 | 30 | func (c *proxiedConn) LocalAddr() net.Addr { 31 | if c.boundAddr != nil { 32 | return c.boundAddr 33 | } 34 | return c.conn.LocalAddr() 35 | } 36 | 37 | func (c *proxiedConn) RemoteAddr() net.Addr { 38 | if c.remoteAddr != nil { 39 | return c.remoteAddr 40 | } 41 | return c.conn.RemoteAddr() 42 | } 43 | 44 | func (c *proxiedConn) SetDeadline(t time.Time) error { 45 | return c.conn.SetDeadline(t) 46 | } 47 | 48 | func (c *proxiedConn) SetReadDeadline(t time.Time) error { 49 | return c.conn.SetReadDeadline(t) 50 | } 51 | 52 | func (c *proxiedConn) SetWriteDeadline(t time.Time) error { 53 | return c.conn.SetWriteDeadline(t) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package base58 provides an API for working with modified base58 and Base58Check 7 | encodings. 8 | 9 | Modified Base58 Encoding 10 | 11 | Standard base58 encoding is similar to standard base64 encoding except, as the 12 | name implies, it uses a 58 character alphabet which results in an alphanumeric 13 | string and allows some characters which are problematic for humans to be 14 | excluded. Due to this, there can be various base58 alphabets. 15 | 16 | The modified base58 alphabet used by Bitcoin, and hence this package, omits the 17 | 0, O, I, and l characters that look the same in many fonts and are therefore 18 | hard to humans to distinguish. 19 | 20 | Base58Check Encoding Scheme 21 | 22 | The Base58Check encoding scheme is primarily used for Bitcoin addresses at the 23 | time of this writing, however it can be used to generically encode arbitrary 24 | byte arrays into human-readable strings along with a version byte that can be 25 | used to differentiate the same payload. For Bitcoin addresses, the extra 26 | version is used to differentiate the network of otherwise identical public keys 27 | which helps prevent using an address intended for one network on another. 28 | */ 29 | package base58 30 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package base58 provides an API for working with modified base58 and Base58Check 7 | encodings. 8 | 9 | Modified Base58 Encoding 10 | 11 | Standard base58 encoding is similar to standard base64 encoding except, as the 12 | name implies, it uses a 58 character alphabet which results in an alphanumeric 13 | string and allows some characters which are problematic for humans to be 14 | excluded. Due to this, there can be various base58 alphabets. 15 | 16 | The modified base58 alphabet used by Bitcoin, and hence this package, omits the 17 | 0, O, I, and l characters that look the same in many fonts and are therefore 18 | hard to humans to distinguish. 19 | 20 | Base58Check Encoding Scheme 21 | 22 | The Base58Check encoding scheme is primarily used for Bitcoin addresses at the 23 | time of this writing, however it can be used to generically encode arbitrary 24 | byte arrays into human-readable strings along with a version byte that can be 25 | used to differentiate the same payload. For Bitcoin addresses, the extra 26 | version is used to differentiate the network of otherwise identical public keys 27 | which helps prevent using an address intended for one network on another. 28 | */ 29 | package base58 30 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/README.md: -------------------------------------------------------------------------------- 1 | btclog 2 | ====== 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btclog.svg)](https://travis-ci.org/btcsuite/btclog) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btclog) 7 | 8 | Package btclog defines a logger interface and provides a default implementation 9 | of a subsystem-aware leveled logger implementing the same interface. 10 | 11 | ## Installation 12 | 13 | ```bash 14 | $ go get github.com/btcsuite/btclog 15 | ``` 16 | 17 | ## GPG Verification Key 18 | 19 | All official release tags are signed by Conformal so users can ensure the code 20 | has not been tampered with and is coming from the btcsuite developers. To 21 | verify the signature perform the following: 22 | 23 | - Download the public key from the Conformal website at 24 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 25 | 26 | - Import the public key into your GPG keyring: 27 | ```bash 28 | gpg --import GIT-GPG-KEY-conformal.txt 29 | ``` 30 | 31 | - Verify the release tag with the following command where `TAG_NAME` is a 32 | placeholder for the specific tag: 33 | ```bash 34 | git tag -v TAG_NAME 35 | ``` 36 | 37 | ## License 38 | 39 | Package btclog is licensed under the [copyfree](http://copyfree.org) ISC 40 | License. 41 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/chaincfg/chainhash/README.md: -------------------------------------------------------------------------------- 1 | chainhash 2 | ========= 3 | 4 | [![Build Status](http://img.shields.io/travis/bcext/gcash.svg)](https://travis-ci.org/bcext/gcash) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/bcext/gcash/chaincfg/chainhash) 7 | ======= 8 | 9 | chainhash provides a generic hash type and associated functions that allows the 10 | specific hash algorithm to be abstracted. 11 | 12 | ## Installation and Updating 13 | 14 | ```bash 15 | $ go get -u github.com/bcext/gcash/chaincfg/chainhash 16 | ``` 17 | 18 | ## GPG Verification Key 19 | 20 | All official release tags are signed by Conformal so users can ensure the code 21 | has not been tampered with and is coming from the btcsuite developers. To 22 | verify the signature perform the following: 23 | 24 | - Download the public key from the Conformal website at 25 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 26 | 27 | - Import the public key into your GPG keyring: 28 | ```bash 29 | gpg --import GIT-GPG-KEY-conformal.txt 30 | ``` 31 | 32 | - Verify the release tag with the following command where `TAG_NAME` is a 33 | placeholder for the specific tag: 34 | ```bash 35 | git tag -v TAG_NAME 36 | ``` 37 | 38 | ## License 39 | 40 | Package chainhash is licensed under the [copyfree](http://copyfree.org) ISC 41 | License. 42 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/goclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The script does automatic checking on a Go package and its sub-packages, including: 3 | # 1. gofmt (http://golang.org/cmd/gofmt/) 4 | # 2. goimports (https://github.com/bradfitz/goimports) 5 | # 3. golint (https://github.com/golang/lint) 6 | # 4. go vet (http://golang.org/cmd/vet) 7 | # 5. race detector (http://blog.golang.org/race-detector) 8 | # 6. test coverage (http://blog.golang.org/cover) 9 | 10 | set -e 11 | 12 | # Automatic checks 13 | test -z $(gofmt -l -w . | tee /dev/stderr) 14 | test -z $(goimports -l -w . | tee /dev/stderr) 15 | test -z $(golint ./... | tee /dev/stderr) 16 | go vet ./... 17 | env GORACE="halt_on_error=1" go test -v -race ./... 18 | 19 | # Run test coverage on each subdirectories and merge the coverage profile. 20 | 21 | echo "mode: count" > profile.cov 22 | 23 | # Standard go tooling behavior is to ignore dirs with leading underscores. 24 | for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d) 25 | do 26 | if ls $dir/*.go &> /dev/null; then 27 | go test -covermode=count -coverprofile=$dir/profile.tmp $dir 28 | if [ -f $dir/profile.tmp ]; then 29 | cat $dir/profile.tmp | tail -n +2 >> profile.cov 30 | rm $dir/profile.tmp 31 | fi 32 | fi 33 | done 34 | 35 | # To submit the test coverage result to coveralls.io, 36 | # use goveralls (https://github.com/mattn/goveralls) 37 | # goveralls -coverprofile=profile.cov -service=travis-ci 38 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/chaincfg/chainhash/README.md: -------------------------------------------------------------------------------- 1 | chainhash 2 | ========= 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)](https://travis-ci.org/btcsuite/btcd) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd/chaincfg/chainhash) 7 | ======= 8 | 9 | chainhash provides a generic hash type and associated functions that allows the 10 | specific hash algorithm to be abstracted. 11 | 12 | ## Installation and Updating 13 | 14 | ```bash 15 | $ go get -u github.com/btcsuite/btcd/chaincfg/chainhash 16 | ``` 17 | 18 | ## GPG Verification Key 19 | 20 | All official release tags are signed by Conformal so users can ensure the code 21 | has not been tampered with and is coming from the btcsuite developers. To 22 | verify the signature perform the following: 23 | 24 | - Download the public key from the Conformal website at 25 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 26 | 27 | - Import the public key into your GPG keyring: 28 | ```bash 29 | gpg --import GIT-GPG-KEY-conformal.txt 30 | ``` 31 | 32 | - Verify the release tag with the following command where `TAG_NAME` is a 33 | placeholder for the specific tag: 34 | ```bash 35 | git tag -v TAG_NAME 36 | ``` 37 | 38 | ## License 39 | 40 | Package chainhash is licensed under the [copyfree](http://copyfree.org) ISC 41 | License. 42 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/websocket/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "encoding/json" 9 | ) 10 | 11 | // WriteJSON is deprecated, use c.WriteJSON instead. 12 | func WriteJSON(c *Conn, v interface{}) error { 13 | return c.WriteJSON(v) 14 | } 15 | 16 | // WriteJSON writes the JSON encoding of v to the connection. 17 | // 18 | // See the documentation for encoding/json Marshal for details about the 19 | // conversion of Go values to JSON. 20 | func (c *Conn) WriteJSON(v interface{}) error { 21 | w, err := c.NextWriter(TextMessage) 22 | if err != nil { 23 | return err 24 | } 25 | err1 := json.NewEncoder(w).Encode(v) 26 | err2 := w.Close() 27 | if err1 != nil { 28 | return err1 29 | } 30 | return err2 31 | } 32 | 33 | // ReadJSON is deprecated, use c.ReadJSON instead. 34 | func ReadJSON(c *Conn, v interface{}) error { 35 | return c.ReadJSON(v) 36 | } 37 | 38 | // ReadJSON reads the next JSON-encoded message from the connection and stores 39 | // it in the value pointed to by v. 40 | // 41 | // See the documentation for the encoding/json Unmarshal function for details 42 | // about the conversion of JSON to a Go value. 43 | func (c *Conn) ReadJSON(v interface{}) error { 44 | _, r, err := c.NextReader() 45 | if err != nil { 46 | return err 47 | } 48 | return json.NewDecoder(r).Decode(v) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // import ( 7 | // "testing" 8 | // "github.com/stretchr/testify/assert" 9 | // ) 10 | // 11 | // func TestSomething(t *testing.T) { 12 | // 13 | // var a string = "Hello" 14 | // var b string = "Hello" 15 | // 16 | // assert.Equal(t, a, b, "The two words should be the same.") 17 | // 18 | // } 19 | // 20 | // if you assert many times, use the format below: 21 | // 22 | // import ( 23 | // "testing" 24 | // "github.com/stretchr/testify/assert" 25 | // ) 26 | // 27 | // func TestSomething(t *testing.T) { 28 | // assert := assert.New(t) 29 | // 30 | // var a string = "Hello" 31 | // var b string = "Hello" 32 | // 33 | // assert.Equal(a, b, "The two words should be the same.") 34 | // } 35 | // 36 | // Assertions 37 | // 38 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 39 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 40 | // testing framework. This allows the assertion funcs to write the failings and other details to 41 | // the correct place. 42 | // 43 | // Every assertion function also takes an optional string message as the final argument, 44 | // allowing custom error messages to be appended to the message the assertion method outputs. 45 | package assert 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/go-socks/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Samuel Stauffer 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the author nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/template/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/README.md: -------------------------------------------------------------------------------- 1 | base58 2 | ========== 3 | 4 | [![Build Status](http://img.shields.io/travis/bcext/cashutil.svg)](https://travis-ci.org/bcext/cashutil) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/bcext/cashutil/base58) 7 | 8 | Package base58 provides an API for encoding and decoding to and from the 9 | modified base58 encoding. It also provides an API to do Base58Check encoding, 10 | as described [here](https://en.bitcoin.it/wiki/Base58Check_encoding). 11 | 12 | A comprehensive suite of tests is provided to ensure proper functionality. 13 | 14 | ## Installation and Updating 15 | 16 | ```bash 17 | $ go get -u github.com/bcext/cashutil/base58 18 | ``` 19 | 20 | ## Examples 21 | 22 | * [Decode Example](http://godoc.org/github.com/bcext/cashutil/base58#example-Decode) 23 | Demonstrates how to decode modified base58 encoded data. 24 | * [Encode Example](http://godoc.org/github.com/bcext/cashutil/base58#example-Encode) 25 | Demonstrates how to encode data using the modified base58 encoding scheme. 26 | * [CheckDecode Example](http://godoc.org/github.com/bcext/cashutil/base58#example-CheckDecode) 27 | Demonstrates how to decode Base58Check encoded data. 28 | * [CheckEncode Example](http://godoc.org/github.com/bcext/cashutil/base58#example-CheckEncode) 29 | Demonstrates how to encode data using the Base58Check encoding scheme. 30 | 31 | ## License 32 | 33 | Package base58 is licensed under the [copyfree](http://copyfree.org) ISC 34 | License. 35 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/rpcclient/log.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package rpcclient 6 | 7 | import ( 8 | "github.com/btcsuite/btclog" 9 | ) 10 | 11 | // log is a logger that is initialized with no output filters. This 12 | // means the package will not perform any logging by default until the caller 13 | // requests it. 14 | var log btclog.Logger 15 | 16 | // The default amount of logging is none. 17 | func init() { 18 | DisableLog() 19 | } 20 | 21 | // DisableLog disables all library log output. Logging output is disabled 22 | // by default until UseLogger is called. 23 | func DisableLog() { 24 | log = btclog.Disabled 25 | } 26 | 27 | // UseLogger uses a specified Logger to output package logging info. 28 | func UseLogger(logger btclog.Logger) { 29 | log = logger 30 | } 31 | 32 | // LogClosure is a closure that can be printed with %v to be used to 33 | // generate expensive-to-create data for a detailed log level and avoid doing 34 | // the work if the data isn't printed. 35 | type logClosure func() string 36 | 37 | // String invokes the log closure and returns the results string. 38 | func (c logClosure) String() string { 39 | return c() 40 | } 41 | 42 | // newLogClosure returns a new closure over the passed function which allows 43 | // it to be used as a parameter in a logging function that is only invoked when 44 | // the logging level is such that the message will actually be logged. 45 | func newLogClosure(c func() string) logClosure { 46 | return logClosure(c) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/README.md: -------------------------------------------------------------------------------- 1 | base58 2 | ========== 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcutil.svg)](https://travis-ci.org/btcsuite/btcutil) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcutil/base58) 7 | 8 | Package base58 provides an API for encoding and decoding to and from the 9 | modified base58 encoding. It also provides an API to do Base58Check encoding, 10 | as described [here](https://en.bitcoin.it/wiki/Base58Check_encoding). 11 | 12 | A comprehensive suite of tests is provided to ensure proper functionality. 13 | 14 | ## Installation and Updating 15 | 16 | ```bash 17 | $ go get -u github.com/btcsuite/btcutil/base58 18 | ``` 19 | 20 | ## Examples 21 | 22 | * [Decode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-Decode) 23 | Demonstrates how to decode modified base58 encoded data. 24 | * [Encode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-Encode) 25 | Demonstrates how to encode data using the modified base58 encoding scheme. 26 | * [CheckDecode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-CheckDecode) 27 | Demonstrates how to decode Base58Check encoded data. 28 | * [CheckEncode Example](http://godoc.org/github.com/btcsuite/btcutil/base58#example-CheckEncode) 29 | Demonstrates how to encode data using the Base58Check encoding scheme. 30 | 31 | ## License 32 | 33 | Package base58 is licensed under the [copyfree](http://copyfree.org) ISC 34 | License. 35 | -------------------------------------------------------------------------------- /backend/common.go: -------------------------------------------------------------------------------- 1 | package backend 2 | 3 | import ( 4 | . "github.com/square/beancounter/utils" 5 | "time" 6 | ) 7 | 8 | // index, address and transaction and helper structs used by recorder and fixture 9 | // backends marshal/unmarshal address and transaction data 10 | 11 | type index struct { 12 | Metadata metadata `json:"metadata"` 13 | Addresses []address `json:"addresses"` 14 | Transactions []transaction `json:"transactions"` 15 | Blocks []block `json:"blocks"` 16 | } 17 | 18 | type metadata struct { 19 | Height uint32 `json:"height"` 20 | } 21 | 22 | type address struct { 23 | Address string `json:"address"` 24 | Path string `json:"path"` 25 | Network Network `json:"network"` 26 | Change uint32 `json:"change"` 27 | AddressIndex uint32 `json:"addr_index"` 28 | TxHashes []string `json:"tx_hashes"` 29 | } 30 | 31 | type byAddress []address 32 | 33 | func (a byAddress) Len() int { return len(a) } 34 | func (a byAddress) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 35 | func (a byAddress) Less(i, j int) bool { return a[i].Address < a[j].Address } 36 | 37 | type transaction struct { 38 | Hash string `json:"hash"` 39 | Height int64 `json:"height"` 40 | Hex string `json:"hex"` 41 | } 42 | 43 | type byTransactionID []transaction 44 | 45 | func (a byTransactionID) Len() int { return len(a) } 46 | func (a byTransactionID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 47 | func (a byTransactionID) Less(i, j int) bool { return a[i].Hash < a[j].Hash } 48 | 49 | type block struct { 50 | Height uint32 `json:"height"` 51 | Timestamp time.Time `json:"timestamp"` 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msgverack.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // MsgVerAck defines a bitcoin verack message which is used for a peer to 12 | // acknowledge a version message (MsgVersion) after it has used the information 13 | // to negotiate parameters. It implements the Message interface. 14 | // 15 | // This message has no payload. 16 | type MsgVerAck struct{} 17 | 18 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 19 | // This is part of the Message interface implementation. 20 | func (msg *MsgVerAck) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 21 | return nil 22 | } 23 | 24 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 25 | // This is part of the Message interface implementation. 26 | func (msg *MsgVerAck) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 27 | return nil 28 | } 29 | 30 | // Command returns the protocol command string for the message. This is part 31 | // of the Message interface implementation. 32 | func (msg *MsgVerAck) Command() string { 33 | return CmdVerAck 34 | } 35 | 36 | // MaxPayloadLength returns the maximum length the payload can be for the 37 | // receiver. This is part of the Message interface implementation. 38 | func (msg *MsgVerAck) MaxPayloadLength(pver uint32) uint32 { 39 | return 0 40 | } 41 | 42 | // NewMsgVerAck returns a new bitcoin verack message that conforms to the 43 | // Message interface. 44 | func NewMsgVerAck() *MsgVerAck { 45 | return &MsgVerAck{} 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msgverack.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "io" 10 | ) 11 | 12 | // MsgVerAck defines a bitcoin verack message which is used for a peer to 13 | // acknowledge a version message (MsgVersion) after it has used the information 14 | // to negotiate parameters. It implements the Message interface. 15 | // 16 | // This message has no payload. 17 | type MsgVerAck struct{} 18 | 19 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 20 | // This is part of the Message interface implementation. 21 | func (msg *MsgVerAck) BtcDecode(r io.Reader, pver uint32) error { 22 | return nil 23 | } 24 | 25 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 26 | // This is part of the Message interface implementation. 27 | func (msg *MsgVerAck) BtcEncode(w io.Writer, pver uint32) error { 28 | return nil 29 | } 30 | 31 | // Command returns the protocol command string for the message. This is part 32 | // of the Message interface implementation. 33 | func (msg *MsgVerAck) Command() string { 34 | return CmdVerAck 35 | } 36 | 37 | // MaxPayloadLength returns the maximum length the payload can be for the 38 | // receiver. This is part of the Message interface implementation. 39 | func (msg *MsgVerAck) MaxPayloadLength(pver uint32) uint32 { 40 | return 0 41 | } 42 | 43 | // NewMsgVerAck returns a new bitcoin verack message that conforms to the 44 | // Message interface. 45 | func NewMsgVerAck() *MsgVerAck { 46 | return &MsgVerAck{} 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/hdkeychain/test_coverage.txt: -------------------------------------------------------------------------------- 1 | 2 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.String 100.00% (18/18) 3 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Zero 100.00% (9/9) 4 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.pubKeyBytes 100.00% (7/7) 5 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Neuter 100.00% (6/6) 6 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ECPrivKey 100.00% (4/4) 7 | github.com/conformal/btcutil/hdkeychain/extendedkey.go zero 100.00% (3/3) 8 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.SetNet 100.00% (3/3) 9 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Address 100.00% (2/2) 10 | github.com/conformal/btcutil/hdkeychain/extendedkey.go newExtendedKey 100.00% (1/1) 11 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.IsPrivate 100.00% (1/1) 12 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ParentFingerprint 100.00% (1/1) 13 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.ECPubKey 100.00% (1/1) 14 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.IsForNet 100.00% (1/1) 15 | github.com/conformal/btcutil/hdkeychain/extendedkey.go NewKeyFromString 95.83% (23/24) 16 | github.com/conformal/btcutil/hdkeychain/extendedkey.go ExtendedKey.Child 91.67% (33/36) 17 | github.com/conformal/btcutil/hdkeychain/extendedkey.go NewMaster 91.67% (11/12) 18 | github.com/conformal/btcutil/hdkeychain/extendedkey.go GenerateSeed 85.71% (6/7) 19 | github.com/conformal/btcutil/hdkeychain ----------------------------- 95.59% (130/136) 20 | 21 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/base58check.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package base58 6 | 7 | import ( 8 | "crypto/sha256" 9 | "errors" 10 | ) 11 | 12 | // ErrChecksum indicates that the checksum of a check-encoded string does not verify against 13 | // the checksum. 14 | var ErrChecksum = errors.New("checksum error") 15 | 16 | // ErrInvalidFormat indicates that the check-encoded string has an invalid format. 17 | var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") 18 | 19 | // checksum: first four bytes of sha256^2 20 | func checksum(input []byte) (cksum [4]byte) { 21 | h := sha256.Sum256(input) 22 | h2 := sha256.Sum256(h[:]) 23 | copy(cksum[:], h2[:4]) 24 | return 25 | } 26 | 27 | // CheckEncode prepends a version byte and appends a four byte checksum. 28 | func CheckEncode(input []byte, version byte) string { 29 | b := make([]byte, 0, 1+len(input)+4) 30 | b = append(b, version) 31 | b = append(b, input[:]...) 32 | cksum := checksum(b) 33 | b = append(b, cksum[:]...) 34 | return Encode(b) 35 | } 36 | 37 | // CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum. 38 | func CheckDecode(input string) (result []byte, version byte, err error) { 39 | decoded := Decode(input) 40 | if len(decoded) < 5 { 41 | return nil, 0, ErrInvalidFormat 42 | } 43 | version = decoded[0] 44 | var cksum [4]byte 45 | copy(cksum[:], decoded[len(decoded)-4:]) 46 | if checksum(decoded[:len(decoded)-4]) != cksum { 47 | return nil, 0, ErrChecksum 48 | } 49 | payload := decoded[1 : len(decoded)-4] 50 | result = append(result, payload...) 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/base58check.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package base58 6 | 7 | import ( 8 | "crypto/sha256" 9 | "errors" 10 | ) 11 | 12 | // ErrChecksum indicates that the checksum of a check-encoded string does not verify against 13 | // the checksum. 14 | var ErrChecksum = errors.New("checksum error") 15 | 16 | // ErrInvalidFormat indicates that the check-encoded string has an invalid format. 17 | var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") 18 | 19 | // checksum: first four bytes of sha256^2 20 | func checksum(input []byte) (cksum [4]byte) { 21 | h := sha256.Sum256(input) 22 | h2 := sha256.Sum256(h[:]) 23 | copy(cksum[:], h2[:4]) 24 | return 25 | } 26 | 27 | // CheckEncode prepends a version byte and appends a four byte checksum. 28 | func CheckEncode(input []byte, version byte) string { 29 | b := make([]byte, 0, 1+len(input)+4) 30 | b = append(b, version) 31 | b = append(b, input[:]...) 32 | cksum := checksum(b) 33 | b = append(b, cksum[:]...) 34 | return Encode(b) 35 | } 36 | 37 | // CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum. 38 | func CheckDecode(input string) (result []byte, version byte, err error) { 39 | decoded := Decode(input) 40 | if len(decoded) < 5 { 41 | return nil, 0, ErrInvalidFormat 42 | } 43 | version = decoded[0] 44 | var cksum [4]byte 45 | copy(cksum[:], decoded[len(decoded)-4:]) 46 | if checksum(decoded[:len(decoded)-4]) != cksum { 47 | return nil, 0, ErrChecksum 48 | } 49 | payload := decoded[1 : len(decoded)-4] 50 | result = append(result, payload...) 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /backend/electrum_backend_test.go: -------------------------------------------------------------------------------- 1 | package backend 2 | 3 | import ( 4 | "github.com/square/beancounter/backend/electrum" 5 | "github.com/square/beancounter/deriver" 6 | . "github.com/square/beancounter/utils" 7 | "github.com/stretchr/testify/assert" 8 | "testing" 9 | ) 10 | 11 | func TestTransactionCache(t *testing.T) { 12 | // TODO: refactor ElectrumBackend to make it easier to test 13 | 14 | eb := &ElectrumBackend{ 15 | nodes: make(map[string]*electrum.Node), 16 | blacklistedNodes: make(map[string]struct{}), 17 | network: Testnet, 18 | addrRequests: make(chan *deriver.Address, 2*maxPeers), 19 | addrResponses: make(chan *AddrResponse, 2*maxPeers), 20 | txRequests: make(chan string, 2*maxPeers), 21 | txResponses: make(chan *TxResponse, 2*maxPeers), 22 | 23 | peersRequests: make(chan struct{}), 24 | transactions: make(map[string]int64), 25 | doneCh: make(chan bool), 26 | } 27 | 28 | tx1 := electrum.Transaction{Hash: "aaaaaa", Height: 100} 29 | tx2 := electrum.Transaction{Hash: "bbbbbb", Height: 100} 30 | tx3 := electrum.Transaction{Hash: "cccccc", Height: 101} 31 | badTx := electrum.Transaction{Hash: "aaaaaa", Height: 102} 32 | 33 | eb.cacheTxs([]*electrum.Transaction{&tx1, &tx2}) 34 | 35 | assert.Equal(t, int64(tx1.Height), eb.getTxHeight(tx1.Hash)) 36 | assert.Equal(t, int64(tx2.Height), eb.getTxHeight(tx2.Hash)) 37 | assert.Panics(t, func() { eb.getTxHeight(tx3.Hash) }) 38 | 39 | eb.cacheTxs([]*electrum.Transaction{&tx2, &tx3}) 40 | 41 | assert.Equal(t, int64(tx1.Height), eb.getTxHeight(tx1.Hash)) 42 | assert.Equal(t, int64(tx2.Height), eb.getTxHeight(tx2.Hash)) 43 | assert.Equal(t, int64(tx3.Height), eb.getTxHeight(tx3.Hash)) 44 | 45 | assert.Panics(t, func() { eb.cacheTxs([]*electrum.Transaction{&badTx}) }) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msggetaddr.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // MsgGetAddr implements the Message interface and represents a bitcoin 12 | // getaddr message. It is used to request a list of known active peers on the 13 | // network from a peer to help identify potential nodes. The list is returned 14 | // via one or more addr messages (MsgAddr). 15 | // 16 | // This message has no payload. 17 | type MsgGetAddr struct{} 18 | 19 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 20 | // This is part of the Message interface implementation. 21 | func (msg *MsgGetAddr) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 22 | return nil 23 | } 24 | 25 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 26 | // This is part of the Message interface implementation. 27 | func (msg *MsgGetAddr) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 28 | return nil 29 | } 30 | 31 | // Command returns the protocol command string for the message. This is part 32 | // of the Message interface implementation. 33 | func (msg *MsgGetAddr) Command() string { 34 | return CmdGetAddr 35 | } 36 | 37 | // MaxPayloadLength returns the maximum length the payload can be for the 38 | // receiver. This is part of the Message interface implementation. 39 | func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32 { 40 | return 0 41 | } 42 | 43 | // NewMsgGetAddr returns a new bitcoin getaddr message that conforms to the 44 | // Message interface. See MsgGetAddr for details. 45 | func NewMsgGetAddr() *MsgGetAddr { 46 | return &MsgGetAddr{} 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msggetaddr.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "io" 10 | ) 11 | 12 | // MsgGetAddr implements the Message interface and represents a bitcoin 13 | // getaddr message. It is used to request a list of known active peers on the 14 | // network from a peer to help identify potential nodes. The list is returned 15 | // via one or more addr messages (MsgAddr). 16 | // 17 | // This message has no payload. 18 | type MsgGetAddr struct{} 19 | 20 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 21 | // This is part of the Message interface implementation. 22 | func (msg *MsgGetAddr) BtcDecode(r io.Reader, pver uint32) error { 23 | return nil 24 | } 25 | 26 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 27 | // This is part of the Message interface implementation. 28 | func (msg *MsgGetAddr) BtcEncode(w io.Writer, pver uint32) error { 29 | return nil 30 | } 31 | 32 | // Command returns the protocol command string for the message. This is part 33 | // of the Message interface implementation. 34 | func (msg *MsgGetAddr) Command() string { 35 | return CmdGetAddr 36 | } 37 | 38 | // MaxPayloadLength returns the maximum length the payload can be for the 39 | // receiver. This is part of the Message interface implementation. 40 | func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32 { 41 | return 0 42 | } 43 | 44 | // NewMsgGetAddr returns a new bitcoin getaddr message that conforms to the 45 | // Message interface. See MsgGetAddr for details. 46 | func NewMsgGetAddr() *MsgGetAddr { 47 | return &MsgGetAddr{} 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/goclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The script does automatic checking on a Go package and its sub-packages, including: 3 | # 1. gofmt (http://golang.org/cmd/gofmt/) 4 | # 2. goimports (https://github.com/bradfitz/goimports) 5 | # 3. golint (https://github.com/golang/lint) 6 | # 4. go vet (http://golang.org/cmd/vet) 7 | # 5. gosimple (https://github.com/dominikh/go-simple) 8 | # 6. unconvert (https://github.com/mdempsky/unconvert) 9 | # 7. race detector (http://blog.golang.org/race-detector) 10 | # 8. test coverage (http://blog.golang.org/cover) 11 | # 12 | # gometalint (github.com/alecthomas/gometalinter) is used to run each each 13 | # static checker. 14 | 15 | set -ex 16 | 17 | # Automatic checks 18 | test -z "$(gometalinter --disable-all \ 19 | --enable=gofmt \ 20 | --enable=goimports \ 21 | --enable=golint \ 22 | --enable=vet \ 23 | --enable=gosimple \ 24 | --enable=unconvert \ 25 | --deadline=120s ./... | grep -v 'ExampleNew' 2>&1 | tee /dev/stderr)" 26 | env GORACE="halt_on_error=1" go test -race ./... 27 | 28 | # Run test coverage on each subdirectories and merge the coverage profile. 29 | 30 | echo "mode: count" > profile.cov 31 | 32 | # Standard go tooling behavior is to ignore dirs with leading underscores. 33 | for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); 34 | do 35 | if ls $dir/*.go &> /dev/null; then 36 | go test -covermode=count -coverprofile=$dir/profile.tmp $dir 37 | if [ -f $dir/profile.tmp ]; then 38 | cat $dir/profile.tmp | tail -n +2 >> profile.cov 39 | rm $dir/profile.tmp 40 | fi 41 | fi 42 | done 43 | 44 | go tool cover -func profile.cov 45 | 46 | # To submit the test coverage result to coveralls.io, 47 | # use goveralls (https://github.com/mattn/goveralls) 48 | # goveralls -coverprofile=profile.cov -service=travis-ci 49 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/base58.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package base58 6 | 7 | import ( 8 | "math/big" 9 | ) 10 | 11 | //go:generate go run genalphabet.go 12 | 13 | var bigRadix = big.NewInt(58) 14 | var bigZero = big.NewInt(0) 15 | 16 | // Decode decodes a modified base58 string to a byte slice. 17 | func Decode(b string) []byte { 18 | answer := big.NewInt(0) 19 | j := big.NewInt(1) 20 | 21 | scratch := new(big.Int) 22 | for i := len(b) - 1; i >= 0; i-- { 23 | tmp := b58[b[i]] 24 | if tmp == 255 { 25 | return []byte("") 26 | } 27 | scratch.SetInt64(int64(tmp)) 28 | scratch.Mul(j, scratch) 29 | answer.Add(answer, scratch) 30 | j.Mul(j, bigRadix) 31 | } 32 | 33 | tmpval := answer.Bytes() 34 | 35 | var numZeros int 36 | for numZeros = 0; numZeros < len(b); numZeros++ { 37 | if b[numZeros] != alphabetIdx0 { 38 | break 39 | } 40 | } 41 | flen := numZeros + len(tmpval) 42 | val := make([]byte, flen) 43 | copy(val[numZeros:], tmpval) 44 | 45 | return val 46 | } 47 | 48 | // Encode encodes a byte slice to a modified base58 string. 49 | func Encode(b []byte) string { 50 | x := new(big.Int) 51 | x.SetBytes(b) 52 | 53 | answer := make([]byte, 0, len(b)*136/100) 54 | for x.Cmp(bigZero) > 0 { 55 | mod := new(big.Int) 56 | x.DivMod(x, bigRadix, mod) 57 | answer = append(answer, alphabet[mod.Int64()]) 58 | } 59 | 60 | // leading zero bytes 61 | for _, i := range b { 62 | if i != 0 { 63 | break 64 | } 65 | answer = append(answer, alphabetIdx0) 66 | } 67 | 68 | // reverse 69 | alen := len(answer) 70 | for i := 0; i < alen/2; i++ { 71 | answer[i], answer[alen-1-i] = answer[alen-1-i], answer[i] 72 | } 73 | 74 | return string(answer) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/base58.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package base58 6 | 7 | import ( 8 | "math/big" 9 | ) 10 | 11 | //go:generate go run genalphabet.go 12 | 13 | var bigRadix = big.NewInt(58) 14 | var bigZero = big.NewInt(0) 15 | 16 | // Decode decodes a modified base58 string to a byte slice. 17 | func Decode(b string) []byte { 18 | answer := big.NewInt(0) 19 | j := big.NewInt(1) 20 | 21 | scratch := new(big.Int) 22 | for i := len(b) - 1; i >= 0; i-- { 23 | tmp := b58[b[i]] 24 | if tmp == 255 { 25 | return []byte("") 26 | } 27 | scratch.SetInt64(int64(tmp)) 28 | scratch.Mul(j, scratch) 29 | answer.Add(answer, scratch) 30 | j.Mul(j, bigRadix) 31 | } 32 | 33 | tmpval := answer.Bytes() 34 | 35 | var numZeros int 36 | for numZeros = 0; numZeros < len(b); numZeros++ { 37 | if b[numZeros] != alphabetIdx0 { 38 | break 39 | } 40 | } 41 | flen := numZeros + len(tmpval) 42 | val := make([]byte, flen) 43 | copy(val[numZeros:], tmpval) 44 | 45 | return val 46 | } 47 | 48 | // Encode encodes a byte slice to a modified base58 string. 49 | func Encode(b []byte) string { 50 | x := new(big.Int) 51 | x.SetBytes(b) 52 | 53 | answer := make([]byte, 0, len(b)*136/100) 54 | for x.Cmp(bigZero) > 0 { 55 | mod := new(big.Int) 56 | x.DivMod(x, bigRadix, mod) 57 | answer = append(answer, alphabet[mod.Int64()]) 58 | } 59 | 60 | // leading zero bytes 61 | for _, i := range b { 62 | if i != 0 { 63 | break 64 | } 65 | answer = append(answer, alphabetIdx0) 66 | } 67 | 68 | // reverse 69 | alen := len(answer) 70 | for i := 0; i < alen/2; i++ { 71 | answer[i], answer[alen-1-i] = answer[alen-1-i], answer[i] 72 | } 73 | 74 | return string(answer) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/goclean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # The script does automatic checking on a Go package and its sub-packages, including: 3 | # 1. gofmt (http://golang.org/cmd/gofmt/) 4 | # 2. goimports (https://github.com/bradfitz/goimports) 5 | # 3. golint (https://github.com/golang/lint) 6 | # 4. go vet (http://golang.org/cmd/vet) 7 | # 5. gosimple (https://github.com/dominikh/go-simple) 8 | # 6. unconvert (https://github.com/mdempsky/unconvert) 9 | # 7. race detector (http://blog.golang.org/race-detector) 10 | # 8. test coverage (http://blog.golang.org/cover) 11 | # 12 | # gometalint (github.com/alecthomas/gometalinter) is used to run each each 13 | # static checker. 14 | 15 | set -ex 16 | 17 | # Automatic checks 18 | test -z "$(gometalinter --disable-all \ 19 | --enable=gofmt \ 20 | --enable=goimports \ 21 | --enable=golint \ 22 | --enable=vet \ 23 | --enable=gosimple \ 24 | --enable=unconvert \ 25 | --deadline=120s ./... | grep -v 'ExampleNew' 2>&1 | tee /dev/stderr)" 26 | env GORACE="halt_on_error=1" go test -race ./... 27 | 28 | # Run test coverage on each subdirectories and merge the coverage profile. 29 | 30 | echo "mode: count" > profile.cov 31 | 32 | # Standard go tooling behavior is to ignore dirs with leading underscores. 33 | for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); 34 | do 35 | if ls $dir/*.go &> /dev/null; then 36 | go test -covermode=count -coverprofile=$dir/profile.tmp $dir 37 | if [ -f $dir/profile.tmp ]; then 38 | cat $dir/profile.tmp | tail -n +2 >> profile.cov 39 | rm $dir/profile.tmp 40 | fi 41 | fi 42 | done 43 | 44 | go tool cover -func profile.cov 45 | 46 | # To submit the test coverage result to coveralls.io, 47 | # use goveralls (https://github.com/mattn/goveralls) 48 | # goveralls -coverprofile=profile.cov -service=travis-ci 49 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/genalphabet.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "bytes" 11 | "io" 12 | "log" 13 | "os" 14 | "strconv" 15 | ) 16 | 17 | var ( 18 | start = []byte(`// Copyright (c) 2015 The btcsuite developers 19 | // Use of this source code is governed by an ISC 20 | // license that can be found in the LICENSE file. 21 | 22 | // AUTOGENERATED by genalphabet.go; do not edit. 23 | 24 | package base58 25 | 26 | const ( 27 | // alphabet is the modified base58 alphabet used by Bitcoin. 28 | alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 29 | 30 | alphabetIdx0 = '1' 31 | ) 32 | 33 | var b58 = [256]byte{`) 34 | 35 | end = []byte(`}`) 36 | 37 | alphabet = []byte("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") 38 | tab = []byte("\t") 39 | invalid = []byte("255") 40 | comma = []byte(",") 41 | space = []byte(" ") 42 | nl = []byte("\n") 43 | ) 44 | 45 | func write(w io.Writer, b []byte) { 46 | _, err := w.Write(b) 47 | if err != nil { 48 | log.Fatal(err) 49 | } 50 | } 51 | 52 | func main() { 53 | fi, err := os.Create("alphabet.go") 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | defer fi.Close() 58 | 59 | write(fi, start) 60 | write(fi, nl) 61 | for i := byte(0); i < 32; i++ { 62 | write(fi, tab) 63 | for j := byte(0); j < 8; j++ { 64 | idx := bytes.IndexByte(alphabet, i*8+j) 65 | if idx == -1 { 66 | write(fi, invalid) 67 | } else { 68 | write(fi, strconv.AppendInt(nil, int64(idx), 10)) 69 | } 70 | write(fi, comma) 71 | if j != 7 { 72 | write(fi, space) 73 | } 74 | } 75 | write(fi, nl) 76 | } 77 | write(fi, end) 78 | write(fi, nl) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/genalphabet.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "bytes" 11 | "io" 12 | "log" 13 | "os" 14 | "strconv" 15 | ) 16 | 17 | var ( 18 | start = []byte(`// Copyright (c) 2015 The btcsuite developers 19 | // Use of this source code is governed by an ISC 20 | // license that can be found in the LICENSE file. 21 | 22 | // AUTOGENERATED by genalphabet.go; do not edit. 23 | 24 | package base58 25 | 26 | const ( 27 | // alphabet is the modified base58 alphabet used by Bitcoin. 28 | alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 29 | 30 | alphabetIdx0 = '1' 31 | ) 32 | 33 | var b58 = [256]byte{`) 34 | 35 | end = []byte(`}`) 36 | 37 | alphabet = []byte("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") 38 | tab = []byte("\t") 39 | invalid = []byte("255") 40 | comma = []byte(",") 41 | space = []byte(" ") 42 | nl = []byte("\n") 43 | ) 44 | 45 | func write(w io.Writer, b []byte) { 46 | _, err := w.Write(b) 47 | if err != nil { 48 | log.Fatal(err) 49 | } 50 | } 51 | 52 | func main() { 53 | fi, err := os.Create("alphabet.go") 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | defer fi.Close() 58 | 59 | write(fi, start) 60 | write(fi, nl) 61 | for i := byte(0); i < 32; i++ { 62 | write(fi, tab) 63 | for j := byte(0); j < 8; j++ { 64 | idx := bytes.IndexByte(alphabet, i*8+j) 65 | if idx == -1 { 66 | write(fi, invalid) 67 | } else { 68 | write(fi, strconv.AppendInt(nil, int64(idx), 10)) 69 | } 70 | write(fi, comma) 71 | if j != 7 { 72 | write(fi, space) 73 | } 74 | } 75 | write(fi, nl) 76 | } 77 | write(fi, end) 78 | write(fi, nl) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/values.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"type": "bool", "parser": "strconv.ParseBool(s)"}, 3 | {"type": "string", "parser": "s, error(nil)", "format": "string(*f.v)", "plural": "Strings"}, 4 | {"type": "uint", "parser": "strconv.ParseUint(s, 0, 64)", "plural": "Uints"}, 5 | {"type": "uint8", "parser": "strconv.ParseUint(s, 0, 8)"}, 6 | {"type": "uint16", "parser": "strconv.ParseUint(s, 0, 16)"}, 7 | {"type": "uint32", "parser": "strconv.ParseUint(s, 0, 32)"}, 8 | {"type": "uint64", "parser": "strconv.ParseUint(s, 0, 64)"}, 9 | {"type": "int", "parser": "strconv.ParseFloat(s, 64)", "plural": "Ints"}, 10 | {"type": "int8", "parser": "strconv.ParseInt(s, 0, 8)"}, 11 | {"type": "int16", "parser": "strconv.ParseInt(s, 0, 16)"}, 12 | {"type": "int32", "parser": "strconv.ParseInt(s, 0, 32)"}, 13 | {"type": "int64", "parser": "strconv.ParseInt(s, 0, 64)"}, 14 | {"type": "float64", "parser": "strconv.ParseFloat(s, 64)"}, 15 | {"type": "float32", "parser": "strconv.ParseFloat(s, 32)"}, 16 | {"name": "Duration", "type": "time.Duration", "no_value_parser": true}, 17 | {"name": "IP", "type": "net.IP", "no_value_parser": true}, 18 | {"name": "TCPAddr", "Type": "*net.TCPAddr", "plural": "TCPList", "no_value_parser": true}, 19 | {"name": "ExistingFile", "Type": "string", "plural": "ExistingFiles", "no_value_parser": true}, 20 | {"name": "ExistingDir", "Type": "string", "plural": "ExistingDirs", "no_value_parser": true}, 21 | {"name": "ExistingFileOrDir", "Type": "string", "plural": "ExistingFilesOrDirs", "no_value_parser": true}, 22 | {"name": "Regexp", "Type": "*regexp.Regexp", "parser": "regexp.Compile(s)"}, 23 | {"name": "ResolvedIP", "Type": "net.IP", "parser": "resolveHost(s)", "help": "Resolve a hostname or IP to an IP."}, 24 | {"name": "HexBytes", "Type": "[]byte", "parser": "hex.DecodeString(s)", "help": "Bytes as a hex string."} 25 | ] 26 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/base58/alphabet.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // AUTOGENERATED by genalphabet.go; do not edit. 6 | 7 | package base58 8 | 9 | const ( 10 | // alphabet is the modified base58 alphabet used by Bitcoin. 11 | alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 12 | 13 | alphabetIdx0 = '1' 14 | ) 15 | 16 | var b58 = [256]byte{ 17 | 255, 255, 255, 255, 255, 255, 255, 255, 18 | 255, 255, 255, 255, 255, 255, 255, 255, 19 | 255, 255, 255, 255, 255, 255, 255, 255, 20 | 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 23 | 255, 0, 1, 2, 3, 4, 5, 6, 24 | 7, 8, 255, 255, 255, 255, 255, 255, 25 | 255, 9, 10, 11, 12, 13, 14, 15, 26 | 16, 255, 17, 18, 19, 20, 21, 255, 27 | 22, 23, 24, 25, 26, 27, 28, 29, 28 | 30, 31, 32, 255, 255, 255, 255, 255, 29 | 255, 33, 34, 35, 36, 37, 38, 39, 30 | 40, 41, 42, 43, 255, 44, 45, 46, 31 | 47, 48, 49, 50, 51, 52, 53, 54, 32 | 55, 56, 57, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 36 | 255, 255, 255, 255, 255, 255, 255, 255, 37 | 255, 255, 255, 255, 255, 255, 255, 255, 38 | 255, 255, 255, 255, 255, 255, 255, 255, 39 | 255, 255, 255, 255, 255, 255, 255, 255, 40 | 255, 255, 255, 255, 255, 255, 255, 255, 41 | 255, 255, 255, 255, 255, 255, 255, 255, 42 | 255, 255, 255, 255, 255, 255, 255, 255, 43 | 255, 255, 255, 255, 255, 255, 255, 255, 44 | 255, 255, 255, 255, 255, 255, 255, 255, 45 | 255, 255, 255, 255, 255, 255, 255, 255, 46 | 255, 255, 255, 255, 255, 255, 255, 255, 47 | 255, 255, 255, 255, 255, 255, 255, 255, 48 | 255, 255, 255, 255, 255, 255, 255, 255, 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/base58/alphabet.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // AUTOGENERATED by genalphabet.go; do not edit. 6 | 7 | package base58 8 | 9 | const ( 10 | // alphabet is the modified base58 alphabet used by Bitcoin. 11 | alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 12 | 13 | alphabetIdx0 = '1' 14 | ) 15 | 16 | var b58 = [256]byte{ 17 | 255, 255, 255, 255, 255, 255, 255, 255, 18 | 255, 255, 255, 255, 255, 255, 255, 255, 19 | 255, 255, 255, 255, 255, 255, 255, 255, 20 | 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 23 | 255, 0, 1, 2, 3, 4, 5, 6, 24 | 7, 8, 255, 255, 255, 255, 255, 255, 25 | 255, 9, 10, 11, 12, 13, 14, 15, 26 | 16, 255, 17, 18, 19, 20, 21, 255, 27 | 22, 23, 24, 25, 26, 27, 28, 29, 28 | 30, 31, 32, 255, 255, 255, 255, 255, 29 | 255, 33, 34, 35, 36, 37, 38, 39, 30 | 40, 41, 42, 43, 255, 44, 45, 46, 31 | 47, 48, 49, 50, 51, 52, 53, 54, 32 | 55, 56, 57, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 36 | 255, 255, 255, 255, 255, 255, 255, 255, 37 | 255, 255, 255, 255, 255, 255, 255, 255, 38 | 255, 255, 255, 255, 255, 255, 255, 255, 39 | 255, 255, 255, 255, 255, 255, 255, 255, 40 | 255, 255, 255, 255, 255, 255, 255, 255, 41 | 255, 255, 255, 255, 255, 255, 255, 255, 42 | 255, 255, 255, 255, 255, 255, 255, 255, 43 | 255, 255, 255, 255, 255, 255, 255, 255, 44 | 255, 255, 255, 255, 255, 255, 255, 255, 45 | 255, 255, 255, 255, 255, 255, 255, 255, 46 | 255, 255, 255, 255, 255, 255, 255, 255, 47 | 255, 255, 255, 255, 255, 255, 255, 255, 48 | 255, 255, 255, 255, 255, 255, 255, 255, 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package cashutil provides bitcoin-specific convenience functions and types. 7 | 8 | Block Overview 9 | 10 | A Block defines a bitcoin block that provides easier and more efficient 11 | manipulation of raw wire protocol blocks. It also memoizes hashes for the 12 | block and its transactions on their first access so subsequent accesses don't 13 | have to repeat the relatively expensive hashing operations. 14 | 15 | Tx Overview 16 | 17 | A Tx defines a bitcoin transaction that provides more efficient manipulation of 18 | raw wire protocol transactions. It memoizes the hash for the transaction on its 19 | first access so subsequent accesses don't have to repeat the relatively 20 | expensive hashing operations. 21 | 22 | Address Overview 23 | 24 | The Address interface provides an abstraction for a Bitcoin address. While the 25 | most common type is a pay-to-pubkey-hash, Bitcoin already supports others and 26 | may well support more in the future. This package currently provides 27 | implementations for the pay-to-pubkey, pay-to-pubkey-hash, and 28 | pay-to-script-hash address types. 29 | 30 | To decode/encode an address: 31 | 32 | // NOTE: The default network is only used for address types which do not 33 | // already contain that information. At this time, that is only 34 | // pay-to-pubkey addresses. 35 | addrString := "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962" + 36 | "e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d57" + 37 | "8a4c702b6bf11d5f" 38 | defaultNet := &chaincfg.MainNetParams 39 | addr, err := cashutil.DecodeAddress(addrString, defaultNet) 40 | if err != nil { 41 | fmt.Println(err) 42 | return 43 | } 44 | fmt.Println(addr.EncodeAddress()) 45 | */ 46 | package cashutil 47 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package btcutil provides bitcoin-specific convenience functions and types. 7 | 8 | Block Overview 9 | 10 | A Block defines a bitcoin block that provides easier and more efficient 11 | manipulation of raw wire protocol blocks. It also memoizes hashes for the 12 | block and its transactions on their first access so subsequent accesses don't 13 | have to repeat the relatively expensive hashing operations. 14 | 15 | Tx Overview 16 | 17 | A Tx defines a bitcoin transaction that provides more efficient manipulation of 18 | raw wire protocol transactions. It memoizes the hash for the transaction on its 19 | first access so subsequent accesses don't have to repeat the relatively 20 | expensive hashing operations. 21 | 22 | Address Overview 23 | 24 | The Address interface provides an abstraction for a Bitcoin address. While the 25 | most common type is a pay-to-pubkey-hash, Bitcoin already supports others and 26 | may well support more in the future. This package currently provides 27 | implementations for the pay-to-pubkey, pay-to-pubkey-hash, and 28 | pay-to-script-hash address types. 29 | 30 | To decode/encode an address: 31 | 32 | // NOTE: The default network is only used for address types which do not 33 | // already contain that information. At this time, that is only 34 | // pay-to-pubkey addresses. 35 | addrString := "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962" + 36 | "e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d57" + 37 | "8a4c702b6bf11d5f" 38 | defaultNet := &chaincfg.MainNetParams 39 | addr, err := btcutil.DecodeAddress(addrString, defaultNet) 40 | if err != nil { 41 | fmt.Println(err) 42 | return 43 | } 44 | fmt.Println(addr.EncodeAddress()) 45 | */ 46 | package btcutil 47 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when the code is running on Google App Engine, compiled by GopherJS, or 17 | // "-tags safe" is added to the go build command line. The "disableunsafe" 18 | // tag is deprecated and thus should not be used. 19 | // +build js appengine safe disableunsafe !go1.4 20 | 21 | package spew 22 | 23 | import "reflect" 24 | 25 | const ( 26 | // UnsafeDisabled is a build-time constant which specifies whether or 27 | // not access to the unsafe package is available. 28 | UnsafeDisabled = true 29 | ) 30 | 31 | // unsafeReflectValue typically converts the passed reflect.Value into a one 32 | // that bypasses the typical safety restrictions preventing access to 33 | // unaddressable and unexported data. However, doing this relies on access to 34 | // the unsafe package. This is a stub version which simply returns the passed 35 | // reflect.Value when the unsafe package is not available. 36 | func unsafeReflectValue(v reflect.Value) reflect.Value { 37 | return v 38 | } 39 | -------------------------------------------------------------------------------- /deriver/address_deriver_test.go: -------------------------------------------------------------------------------- 1 | package deriver 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/square/beancounter/utils" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestAddress(t *testing.T) { 11 | deriver := NewAddressDeriver(Mainnet, []string{"xpub6CjzRxucHWJbmtuNTg6EjPax3V75AhsBRnFKn8MEkc8UFFEhrCoWcQN6oUBhfZWoFKqTyQ21iNVK8KMbC44ifW25uyXaMPWkRtpwcbAWXJx"}, 1, "") 12 | addr := deriver.Derive(0, 5) 13 | assert.Equal(t, addr.Path(), "m/.../0/5") 14 | assert.Equal(t, addr.String(), "1N4VBTZqwLkHEKX79kjJ1WaYvX4c3txioz") 15 | assert.Equal(t, addr.Change(), uint32(0)) 16 | assert.Equal(t, addr.Index(), uint32(5)) 17 | assert.Equal(t, addr.Network(), Mainnet) 18 | assert.Equal(t, addr.Script(), "76a914e70369bfda4ba9bdcbb96cfd269a768573d0624c88ac") 19 | } 20 | 21 | func TestDeriveMultiSigSegwit(t *testing.T) { 22 | xpubs := []string{ 23 | "tpubDAiPiLZeUdwo9oJiE9GZnteXj2E2MEMUb4knc4yCD87bL9siDgYcvrZSHZQZcYTyraL3fxVBRCcMiyfr3oQfH1wNo8J5i8aRAN56dDXaZxC", 24 | "tpubDBYBpkSfvt9iVSfdX2ArZq1Q8bVSro3sotbJhdZCG9rgfjdr4aZp7g7AF1P9w95X5fzuJzdZAqYWWU7nb37c594wR22hPY5VpYziXUN2yez", 25 | "tpubDAaTEMnf9SPKJweLaptFdy3Vmyhim5DKQxXRbsCxmAaUp8F84YD5GhdfmABwLddjHTftSVvUPuSru6vJ3b5N2hBveiGmZNE5N5yvB6WZ96c", 26 | "tpubDAXKYCetkje8HRRhAvUbAyuC5iF3SgfFWCVXfmrGCw3H9ExCYZVTEoeg7TjtDhgkS7TNHDRZUQNzGACWVzZCAYXy79vqku5z1geYmnsNLaa", 27 | } 28 | deriver := NewAddressDeriver(Testnet, xpubs, 2, "") 29 | assert.Equal(t, "2N4TmnHspa8wqFEUfxfjzHoSUAgwoUwNWhr", deriver.Derive(0, 0).String()) 30 | } 31 | 32 | func TestDeriveGateway(t *testing.T) { 33 | xpubs := []string{ 34 | "tpubDBrCAXucLxvjC9n9nZGGcYS8pk4X1N97YJmUgdDSwG2p36gbSqeRuytHYCHe2dHxLsV2EchX9ePaFdRwp7cNLrSpnr3PsoPLUQqbvLBDWvh", 35 | } 36 | deriver := NewAddressDeriver(Testnet, xpubs, 1, "") 37 | assert.Equal(t, "mzoeuyGqMudyvKbkNx5dtNBNN59oKEAsPn", deriver.Derive(0, 0).String()) 38 | assert.Equal(t, "moHN13u4RoMxujdaPxvuaTaawgWZ3LaGyo", deriver.Derive(1, 0).String()) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/Masterminds/semver v1.4.2 2 | github.com/Masterminds/semver 3 | # github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc 4 | github.com/alecthomas/template 5 | github.com/alecthomas/template/parse 6 | # github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf 7 | github.com/alecthomas/units 8 | # github.com/bcext/cashutil v0.0.0-20180827115045-9ba6cf292283 9 | github.com/bcext/cashutil 10 | github.com/bcext/cashutil/base58 11 | # github.com/bcext/gcash v0.0.0-20180921133405-3f4b56493047 12 | github.com/bcext/gcash/btcec 13 | github.com/bcext/gcash/chaincfg 14 | github.com/bcext/gcash/chaincfg/chainhash 15 | github.com/bcext/gcash/wire 16 | # github.com/btcsuite/btcd v0.0.0-20180924021209-2a560b2036be 17 | github.com/btcsuite/btcd/btcjson 18 | github.com/btcsuite/btcd/chaincfg/chainhash 19 | github.com/btcsuite/btcd/rpcclient 20 | github.com/btcsuite/btcd/wire 21 | github.com/btcsuite/btcd/txscript 22 | github.com/btcsuite/btcd/chaincfg 23 | github.com/btcsuite/btcd/btcec 24 | # github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f 25 | github.com/btcsuite/btclog 26 | # github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a 27 | github.com/btcsuite/btcutil/hdkeychain 28 | github.com/btcsuite/btcutil 29 | github.com/btcsuite/btcutil/base58 30 | github.com/btcsuite/btcutil/bech32 31 | # github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd 32 | github.com/btcsuite/go-socks/socks 33 | # github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 34 | github.com/btcsuite/websocket 35 | # github.com/davecgh/go-spew v1.1.1 36 | github.com/davecgh/go-spew/spew 37 | # github.com/pkg/errors v0.8.0 38 | github.com/pkg/errors 39 | # github.com/pmezard/go-difflib v1.0.0 40 | github.com/pmezard/go-difflib/difflib 41 | # github.com/stretchr/testify v1.2.2 42 | github.com/stretchr/testify/assert 43 | # golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 44 | golang.org/x/crypto/ripemd160 45 | # gopkg.in/alecthomas/kingpin.v2 v2.2.6 46 | gopkg.in/alecthomas/kingpin.v2 47 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/cashutil/README.md: -------------------------------------------------------------------------------- 1 | cashutil 2 | ======= 3 | 4 | [![Build Status](http://img.shields.io/travis/bcext/cashutil.svg)](https://travis-ci.org/bcext/cashutil) 5 | [![Coverage Status](http://img.shields.io/coveralls/bcext/cashutil.svg)](https://coveralls.io/r/bcext/cashutil?branch=master) 6 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 7 | [![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/bcext/cashutil) 8 | 9 | Package cashutil provides bitcoin-specific convenience functions and types. 10 | A comprehensive suite of tests is provided to ensure proper functionality. See 11 | `test_coverage.txt` for the gocov coverage report. Alternatively, if you are 12 | running a POSIX OS, you can run the `cov_report.sh` script for a real-time 13 | report. 14 | 15 | This package was developed for gcash, an alternative full-node implementation of 16 | bitcoin which is under active development by Conformal. Although it was 17 | primarily written for gcash, this package has intentionally been designed so it 18 | can be used as a standalone package for any projects needing the functionality 19 | provided. 20 | 21 | ## Installation and Updating 22 | 23 | ```bash 24 | $ go get -u github.com/bcext/cashutil 25 | ``` 26 | 27 | ## GPG Verification Key 28 | 29 | All official release tags are signed by Conformal so users can ensure the code 30 | has not been tampered with and is coming from the btcsuite and bcext developers. 31 | To verify the signature perform the following: 32 | 33 | - Download the public key from the Conformal website at 34 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 35 | 36 | - Import the public key into your GPG keyring: 37 | ```bash 38 | gpg --import GIT-GPG-KEY-conformal.txt 39 | ``` 40 | 41 | - Verify the release tag with the following command where `TAG_NAME` is a 42 | placeholder for the specific tag: 43 | ```bash 44 | git tag -v TAG_NAME 45 | ``` 46 | 47 | ## License 48 | 49 | Package cashutil is licensed under the [copyfree](http://copyfree.org) ISC 50 | License. 51 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcutil/README.md: -------------------------------------------------------------------------------- 1 | btcutil 2 | ======= 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcutil.svg)](https://travis-ci.org/btcsuite/btcutil) 5 | [![Coverage Status](http://img.shields.io/coveralls/btcsuite/btcutil.svg)](https://coveralls.io/r/btcsuite/btcutil?branch=master) 6 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 7 | [![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcutil) 8 | 9 | Package btcutil provides bitcoin-specific convenience functions and types. 10 | A comprehensive suite of tests is provided to ensure proper functionality. See 11 | `test_coverage.txt` for the gocov coverage report. Alternatively, if you are 12 | running a POSIX OS, you can run the `cov_report.sh` script for a real-time 13 | report. 14 | 15 | This package was developed for btcd, an alternative full-node implementation of 16 | bitcoin which is under active development by Conformal. Although it was 17 | primarily written for btcd, this package has intentionally been designed so it 18 | can be used as a standalone package for any projects needing the functionality 19 | provided. 20 | 21 | ## Installation and Updating 22 | 23 | ```bash 24 | $ go get -u github.com/btcsuite/btcutil 25 | ``` 26 | 27 | ## GPG Verification Key 28 | 29 | All official release tags are signed by Conformal so users can ensure the code 30 | has not been tampered with and is coming from the btcsuite developers. To 31 | verify the signature perform the following: 32 | 33 | - Download the public key from the Conformal website at 34 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 35 | 36 | - Import the public key into your GPG keyring: 37 | ```bash 38 | gpg --import GIT-GPG-KEY-conformal.txt 39 | ``` 40 | 41 | - Verify the release tag with the following command where `TAG_NAME` is a 42 | placeholder for the specific tag: 43 | ```bash 44 | git tag -v TAG_NAME 45 | ``` 46 | 47 | ## License 48 | 49 | Package btcutil is licensed under the [copyfree](http://copyfree.org) ISC 50 | License. 51 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/btcec/genprecomps.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is ignored during the regular build due to the following build tag. 6 | // It is called by go generate and used to automatically generate pre-computed 7 | // tables used to accelerate operations. 8 | // +build ignore 9 | 10 | package main 11 | 12 | import ( 13 | "bytes" 14 | "compress/zlib" 15 | "encoding/base64" 16 | "fmt" 17 | "log" 18 | "os" 19 | 20 | "github.com/bcext/gcash/btcec" 21 | ) 22 | 23 | func main() { 24 | fi, err := os.Create("secp256k1.go") 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | defer fi.Close() 29 | 30 | // Compress the serialized byte points. 31 | serialized := btcec.S256().SerializedBytePoints() 32 | var compressed bytes.Buffer 33 | w := zlib.NewWriter(&compressed) 34 | if _, err := w.Write(serialized); err != nil { 35 | fmt.Println(err) 36 | os.Exit(1) 37 | } 38 | w.Close() 39 | 40 | // Encode the compressed byte points with base64. 41 | encoded := make([]byte, base64.StdEncoding.EncodedLen(compressed.Len())) 42 | base64.StdEncoding.Encode(encoded, compressed.Bytes()) 43 | 44 | fmt.Fprintln(fi, "// Copyright (c) 2015 The btcsuite developers") 45 | fmt.Fprintln(fi, "// Use of this source code is governed by an ISC") 46 | fmt.Fprintln(fi, "// license that can be found in the LICENSE file.") 47 | fmt.Fprintln(fi) 48 | fmt.Fprintln(fi, "package btcec") 49 | fmt.Fprintln(fi) 50 | fmt.Fprintln(fi, "// Auto-generated file (see genprecomps.go)") 51 | fmt.Fprintln(fi, "// DO NOT EDIT") 52 | fmt.Fprintln(fi) 53 | fmt.Fprintf(fi, "var secp256k1BytePoints = %q\n", string(encoded)) 54 | 55 | a1, b1, a2, b2 := btcec.S256().EndomorphismVectors() 56 | fmt.Println("The following values are the computed linearly " + 57 | "independent vectors needed to make use of the secp256k1 " + 58 | "endomorphism:") 59 | fmt.Printf("a1: %x\n", a1) 60 | fmt.Printf("b1: %x\n", b1) 61 | fmt.Printf("a2: %x\n", a2) 62 | fmt.Printf("b2: %x\n", b2) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/txscript/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | /* 6 | Package txscript implements the bitcoin transaction script language. 7 | 8 | A complete description of the script language used by bitcoin can be found at 9 | https://en.bitcoin.it/wiki/Script. The following only serves as a quick 10 | overview to provide information on how to use the package. 11 | 12 | This package provides data structures and functions to parse and execute 13 | bitcoin transaction scripts. 14 | 15 | Script Overview 16 | 17 | Bitcoin transaction scripts are written in a stack-base, FORTH-like language. 18 | 19 | The bitcoin script language consists of a number of opcodes which fall into 20 | several categories such pushing and popping data to and from the stack, 21 | performing basic and bitwise arithmetic, conditional branching, comparing 22 | hashes, and checking cryptographic signatures. Scripts are processed from left 23 | to right and intentionally do not provide loops. 24 | 25 | The vast majority of Bitcoin scripts at the time of this writing are of several 26 | standard forms which consist of a spender providing a public key and a signature 27 | which proves the spender owns the associated private key. This information 28 | is used to prove the the spender is authorized to perform the transaction. 29 | 30 | One benefit of using a scripting language is added flexibility in specifying 31 | what conditions must be met in order to spend bitcoins. 32 | 33 | Errors 34 | 35 | Errors returned by this package are of type txscript.Error. This allows the 36 | caller to programmatically determine the specific error by examining the 37 | ErrorCode field of the type asserted txscript.Error while still providing rich 38 | error messages with contextual information. A convenience function named 39 | IsErrorCode is also provided to allow callers to easily check for a specific 40 | error code. See ErrorCode in the package documentation for a full list. 41 | */ 42 | package txscript 43 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcec/genprecomps.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | // This file is ignored during the regular build due to the following build tag. 6 | // It is called by go generate and used to automatically generate pre-computed 7 | // tables used to accelerate operations. 8 | // +build ignore 9 | 10 | package main 11 | 12 | import ( 13 | "bytes" 14 | "compress/zlib" 15 | "encoding/base64" 16 | "fmt" 17 | "log" 18 | "os" 19 | 20 | "github.com/btcsuite/btcd/btcec" 21 | ) 22 | 23 | func main() { 24 | fi, err := os.Create("secp256k1.go") 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | defer fi.Close() 29 | 30 | // Compress the serialized byte points. 31 | serialized := btcec.S256().SerializedBytePoints() 32 | var compressed bytes.Buffer 33 | w := zlib.NewWriter(&compressed) 34 | if _, err := w.Write(serialized); err != nil { 35 | fmt.Println(err) 36 | os.Exit(1) 37 | } 38 | w.Close() 39 | 40 | // Encode the compressed byte points with base64. 41 | encoded := make([]byte, base64.StdEncoding.EncodedLen(compressed.Len())) 42 | base64.StdEncoding.Encode(encoded, compressed.Bytes()) 43 | 44 | fmt.Fprintln(fi, "// Copyright (c) 2015 The btcsuite developers") 45 | fmt.Fprintln(fi, "// Use of this source code is governed by an ISC") 46 | fmt.Fprintln(fi, "// license that can be found in the LICENSE file.") 47 | fmt.Fprintln(fi) 48 | fmt.Fprintln(fi, "package btcec") 49 | fmt.Fprintln(fi) 50 | fmt.Fprintln(fi, "// Auto-generated file (see genprecomps.go)") 51 | fmt.Fprintln(fi, "// DO NOT EDIT") 52 | fmt.Fprintln(fi) 53 | fmt.Fprintf(fi, "var secp256k1BytePoints = %q\n", string(encoded)) 54 | 55 | a1, b1, a2, b2 := btcec.S256().EndomorphismVectors() 56 | fmt.Println("The following values are the computed linearly " + 57 | "independent vectors needed to make use of the secp256k1 " + 58 | "endomorphism:") 59 | fmt.Printf("a1: %x\n", a1) 60 | fmt.Printf("b1: %x\n", b1) 61 | fmt.Printf("a2: %x\n", a2) 62 | fmt.Printf("b2: %x\n", b2) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msgmempool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | ) 12 | 13 | // MsgMemPool implements the Message interface and represents a bitcoin mempool 14 | // message. It is used to request a list of transactions still in the active 15 | // memory pool of a relay. 16 | // 17 | // This message has no payload and was not added until protocol versions 18 | // starting with BIP0035Version. 19 | type MsgMemPool struct{} 20 | 21 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 22 | // This is part of the Message interface implementation. 23 | func (msg *MsgMemPool) BtcDecode(r io.Reader, pver uint32) error { 24 | if pver < BIP0035Version { 25 | str := fmt.Sprintf("mempool message invalid for protocol "+ 26 | "version %d", pver) 27 | return messageError("MsgMemPool.BtcDecode", str) 28 | } 29 | 30 | return nil 31 | } 32 | 33 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 34 | // This is part of the Message interface implementation. 35 | func (msg *MsgMemPool) BtcEncode(w io.Writer, pver uint32) error { 36 | if pver < BIP0035Version { 37 | str := fmt.Sprintf("mempool message invalid for protocol "+ 38 | "version %d", pver) 39 | return messageError("MsgMemPool.BtcEncode", str) 40 | } 41 | 42 | return nil 43 | } 44 | 45 | // Command returns the protocol command string for the message. This is part 46 | // of the Message interface implementation. 47 | func (msg *MsgMemPool) Command() string { 48 | return CmdMemPool 49 | } 50 | 51 | // MaxPayloadLength returns the maximum length the payload can be for the 52 | // receiver. This is part of the Message interface implementation. 53 | func (msg *MsgMemPool) MaxPayloadLength(pver uint32) uint32 { 54 | return 0 55 | } 56 | 57 | // NewMsgMemPool returns a new bitcoin pong message that conforms to the Message 58 | // interface. See MsgPong for details. 59 | func NewMsgMemPool() *MsgMemPool { 60 | return &MsgMemPool{} 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msgmempool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | // MsgMemPool implements the Message interface and represents a bitcoin mempool 13 | // message. It is used to request a list of transactions still in the active 14 | // memory pool of a relay. 15 | // 16 | // This message has no payload and was not added until protocol versions 17 | // starting with BIP0035Version. 18 | type MsgMemPool struct{} 19 | 20 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 21 | // This is part of the Message interface implementation. 22 | func (msg *MsgMemPool) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 23 | if pver < BIP0035Version { 24 | str := fmt.Sprintf("mempool message invalid for protocol "+ 25 | "version %d", pver) 26 | return messageError("MsgMemPool.BtcDecode", str) 27 | } 28 | 29 | return nil 30 | } 31 | 32 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 33 | // This is part of the Message interface implementation. 34 | func (msg *MsgMemPool) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 35 | if pver < BIP0035Version { 36 | str := fmt.Sprintf("mempool message invalid for protocol "+ 37 | "version %d", pver) 38 | return messageError("MsgMemPool.BtcEncode", str) 39 | } 40 | 41 | return nil 42 | } 43 | 44 | // Command returns the protocol command string for the message. This is part 45 | // of the Message interface implementation. 46 | func (msg *MsgMemPool) Command() string { 47 | return CmdMemPool 48 | } 49 | 50 | // MaxPayloadLength returns the maximum length the payload can be for the 51 | // receiver. This is part of the Message interface implementation. 52 | func (msg *MsgMemPool) MaxPayloadLength(pver uint32) uint32 { 53 | return 0 54 | } 55 | 56 | // NewMsgMemPool returns a new bitcoin pong message that conforms to the Message 57 | // interface. See MsgPong for details. 58 | func NewMsgMemPool() *MsgMemPool { 59 | return &MsgMemPool{} 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msgfilterclear.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | // MsgFilterClear implements the Message interface and represents a bitcoin 13 | // filterclear message which is used to reset a Bloom filter. 14 | // 15 | // This message was not added until protocol version BIP0037Version and has 16 | // no payload. 17 | type MsgFilterClear struct{} 18 | 19 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 20 | // This is part of the Message interface implementation. 21 | func (msg *MsgFilterClear) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 22 | if pver < BIP0037Version { 23 | str := fmt.Sprintf("filterclear message invalid for protocol "+ 24 | "version %d", pver) 25 | return messageError("MsgFilterClear.BtcDecode", str) 26 | } 27 | 28 | return nil 29 | } 30 | 31 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 32 | // This is part of the Message interface implementation. 33 | func (msg *MsgFilterClear) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 34 | if pver < BIP0037Version { 35 | str := fmt.Sprintf("filterclear message invalid for protocol "+ 36 | "version %d", pver) 37 | return messageError("MsgFilterClear.BtcEncode", str) 38 | } 39 | 40 | return nil 41 | } 42 | 43 | // Command returns the protocol command string for the message. This is part 44 | // of the Message interface implementation. 45 | func (msg *MsgFilterClear) Command() string { 46 | return CmdFilterClear 47 | } 48 | 49 | // MaxPayloadLength returns the maximum length the payload can be for the 50 | // receiver. This is part of the Message interface implementation. 51 | func (msg *MsgFilterClear) MaxPayloadLength(pver uint32) uint32 { 52 | return 0 53 | } 54 | 55 | // NewMsgFilterClear returns a new bitcoin filterclear message that conforms to the Message 56 | // interface. See MsgFilterClear for details. 57 | func NewMsgFilterClear() *MsgFilterClear { 58 | return &MsgFilterClear{} 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msgfilterclear.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2015 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | ) 12 | 13 | // MsgFilterClear implements the Message interface and represents a bitcoin 14 | // filterclear message which is used to reset a Bloom filter. 15 | // 16 | // This message was not added until protocol version BIP0037Version and has 17 | // no payload. 18 | type MsgFilterClear struct{} 19 | 20 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 21 | // This is part of the Message interface implementation. 22 | func (msg *MsgFilterClear) BtcDecode(r io.Reader, pver uint32) error { 23 | if pver < BIP0037Version { 24 | str := fmt.Sprintf("filterclear message invalid for protocol "+ 25 | "version %d", pver) 26 | return messageError("MsgFilterClear.BtcDecode", str) 27 | } 28 | 29 | return nil 30 | } 31 | 32 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 33 | // This is part of the Message interface implementation. 34 | func (msg *MsgFilterClear) BtcEncode(w io.Writer, pver uint32) error { 35 | if pver < BIP0037Version { 36 | str := fmt.Sprintf("filterclear message invalid for protocol "+ 37 | "version %d", pver) 38 | return messageError("MsgFilterClear.BtcEncode", str) 39 | } 40 | 41 | return nil 42 | } 43 | 44 | // Command returns the protocol command string for the message. This is part 45 | // of the Message interface implementation. 46 | func (msg *MsgFilterClear) Command() string { 47 | return CmdFilterClear 48 | } 49 | 50 | // MaxPayloadLength returns the maximum length the payload can be for the 51 | // receiver. This is part of the Message interface implementation. 52 | func (msg *MsgFilterClear) MaxPayloadLength(pver uint32) uint32 { 53 | return 0 54 | } 55 | 56 | // NewMsgFilterClear returns a new bitcoin filterclear message that conforms to the Message 57 | // interface. See MsgFilterClear for details. 58 | func NewMsgFilterClear() *MsgFilterClear { 59 | return &MsgFilterClear{} 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msgsendheaders.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | // MsgSendHeaders implements the Message interface and represents a bitcoin 13 | // sendheaders message. It is used to request the peer send block headers 14 | // rather than inventory vectors. 15 | // 16 | // This message has no payload and was not added until protocol versions 17 | // starting with SendHeadersVersion. 18 | type MsgSendHeaders struct{} 19 | 20 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 21 | // This is part of the Message interface implementation. 22 | func (msg *MsgSendHeaders) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 23 | if pver < SendHeadersVersion { 24 | str := fmt.Sprintf("sendheaders message invalid for protocol "+ 25 | "version %d", pver) 26 | return messageError("MsgSendHeaders.BtcDecode", str) 27 | } 28 | 29 | return nil 30 | } 31 | 32 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 33 | // This is part of the Message interface implementation. 34 | func (msg *MsgSendHeaders) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 35 | if pver < SendHeadersVersion { 36 | str := fmt.Sprintf("sendheaders message invalid for protocol "+ 37 | "version %d", pver) 38 | return messageError("MsgSendHeaders.BtcEncode", str) 39 | } 40 | 41 | return nil 42 | } 43 | 44 | // Command returns the protocol command string for the message. This is part 45 | // of the Message interface implementation. 46 | func (msg *MsgSendHeaders) Command() string { 47 | return CmdSendHeaders 48 | } 49 | 50 | // MaxPayloadLength returns the maximum length the payload can be for the 51 | // receiver. This is part of the Message interface implementation. 52 | func (msg *MsgSendHeaders) MaxPayloadLength(pver uint32) uint32 { 53 | return 0 54 | } 55 | 56 | // NewMsgSendHeaders returns a new bitcoin sendheaders message that conforms to 57 | // the Message interface. See MsgSendHeaders for details. 58 | func NewMsgSendHeaders() *MsgSendHeaders { 59 | return &MsgSendHeaders{} 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msgsendheaders.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | ) 12 | 13 | // MsgSendHeaders implements the Message interface and represents a bitcoin 14 | // sendheaders message. It is used to request the peer send block headers 15 | // rather than inventory vectors. 16 | // 17 | // This message has no payload and was not added until protocol versions 18 | // starting with SendHeadersVersion. 19 | type MsgSendHeaders struct{} 20 | 21 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 22 | // This is part of the Message interface implementation. 23 | func (msg *MsgSendHeaders) BtcDecode(r io.Reader, pver uint32) error { 24 | if pver < SendHeadersVersion { 25 | str := fmt.Sprintf("sendheaders message invalid for protocol "+ 26 | "version %d", pver) 27 | return messageError("MsgSendHeaders.BtcDecode", str) 28 | } 29 | 30 | return nil 31 | } 32 | 33 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 34 | // This is part of the Message interface implementation. 35 | func (msg *MsgSendHeaders) BtcEncode(w io.Writer, pver uint32) error { 36 | if pver < SendHeadersVersion { 37 | str := fmt.Sprintf("sendheaders message invalid for protocol "+ 38 | "version %d", pver) 39 | return messageError("MsgSendHeaders.BtcEncode", str) 40 | } 41 | 42 | return nil 43 | } 44 | 45 | // Command returns the protocol command string for the message. This is part 46 | // of the Message interface implementation. 47 | func (msg *MsgSendHeaders) Command() string { 48 | return CmdSendHeaders 49 | } 50 | 51 | // MaxPayloadLength returns the maximum length the payload can be for the 52 | // receiver. This is part of the Message interface implementation. 53 | func (msg *MsgSendHeaders) MaxPayloadLength(pver uint32) uint32 { 54 | return 0 55 | } 56 | 57 | // NewMsgSendHeaders returns a new bitcoin sendheaders message that conforms to 58 | // the Message interface. See MsgSendHeaders for details. 59 | func NewMsgSendHeaders() *MsgSendHeaders { 60 | return &MsgSendHeaders{} 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/btcec/precompute.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcec 6 | 7 | import ( 8 | "compress/zlib" 9 | "encoding/base64" 10 | "encoding/binary" 11 | "io/ioutil" 12 | "strings" 13 | ) 14 | 15 | //go:generate go run -tags gensecp256k1 genprecomps.go 16 | 17 | // loadS256BytePoints decompresses and deserializes the pre-computed byte points 18 | // used to accelerate scalar base multiplication for the secp256k1 curve. This 19 | // approach is used since it allows the compile to use significantly less ram 20 | // and be performed much faster than it is with hard-coding the final in-memory 21 | // data structure. At the same time, it is quite fast to generate the in-memory 22 | // data structure at init time with this approach versus computing the table. 23 | func loadS256BytePoints() error { 24 | // There will be no byte points to load when generating them. 25 | bp := secp256k1BytePoints 26 | if len(bp) == 0 { 27 | return nil 28 | } 29 | 30 | // Decompress the pre-computed table used to accelerate scalar base 31 | // multiplication. 32 | decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(bp)) 33 | r, err := zlib.NewReader(decoder) 34 | if err != nil { 35 | return err 36 | } 37 | serialized, err := ioutil.ReadAll(r) 38 | if err != nil { 39 | return err 40 | } 41 | 42 | // Deserialize the precomputed byte points and set the curve to them. 43 | offset := 0 44 | var bytePoints [32][256][3]fieldVal 45 | for byteNum := 0; byteNum < 32; byteNum++ { 46 | // All points in this window. 47 | for i := 0; i < 256; i++ { 48 | px := &bytePoints[byteNum][i][0] 49 | py := &bytePoints[byteNum][i][1] 50 | pz := &bytePoints[byteNum][i][2] 51 | for i := 0; i < 10; i++ { 52 | px.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 53 | offset += 4 54 | } 55 | for i := 0; i < 10; i++ { 56 | py.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 57 | offset += 4 58 | } 59 | for i := 0; i < 10; i++ { 60 | pz.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 61 | offset += 4 62 | } 63 | } 64 | } 65 | secp256k1.bytePoints = &bytePoints 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcec/precompute.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcec 6 | 7 | import ( 8 | "compress/zlib" 9 | "encoding/base64" 10 | "encoding/binary" 11 | "io/ioutil" 12 | "strings" 13 | ) 14 | 15 | //go:generate go run -tags gensecp256k1 genprecomps.go 16 | 17 | // loadS256BytePoints decompresses and deserializes the pre-computed byte points 18 | // used to accelerate scalar base multiplication for the secp256k1 curve. This 19 | // approach is used since it allows the compile to use significantly less ram 20 | // and be performed much faster than it is with hard-coding the final in-memory 21 | // data structure. At the same time, it is quite fast to generate the in-memory 22 | // data structure at init time with this approach versus computing the table. 23 | func loadS256BytePoints() error { 24 | // There will be no byte points to load when generating them. 25 | bp := secp256k1BytePoints 26 | if len(bp) == 0 { 27 | return nil 28 | } 29 | 30 | // Decompress the pre-computed table used to accelerate scalar base 31 | // multiplication. 32 | decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(bp)) 33 | r, err := zlib.NewReader(decoder) 34 | if err != nil { 35 | return err 36 | } 37 | serialized, err := ioutil.ReadAll(r) 38 | if err != nil { 39 | return err 40 | } 41 | 42 | // Deserialize the precomputed byte points and set the curve to them. 43 | offset := 0 44 | var bytePoints [32][256][3]fieldVal 45 | for byteNum := 0; byteNum < 32; byteNum++ { 46 | // All points in this window. 47 | for i := 0; i < 256; i++ { 48 | px := &bytePoints[byteNum][i][0] 49 | py := &bytePoints[byteNum][i][1] 50 | pz := &bytePoints[byteNum][i][2] 51 | for i := 0; i < 10; i++ { 52 | px.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 53 | offset += 4 54 | } 55 | for i := 0; i < 10; i++ { 56 | py.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 57 | offset += 4 58 | } 59 | for i := 0; i < 10; i++ { 60 | pz.n[i] = binary.LittleEndian.Uint32(serialized[offset:]) 61 | offset += 4 62 | } 63 | } 64 | } 65 | secp256k1.bytePoints = &bytePoints 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /vendor/gopkg.in/alecthomas/kingpin.v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package kingpin provides command line interfaces like this: 2 | // 3 | // $ chat 4 | // usage: chat [] [] [ ...] 5 | // 6 | // Flags: 7 | // --debug enable debug mode 8 | // --help Show help. 9 | // --server=127.0.0.1 server address 10 | // 11 | // Commands: 12 | // help 13 | // Show help for a command. 14 | // 15 | // post [] 16 | // Post a message to a channel. 17 | // 18 | // register 19 | // Register a new user. 20 | // 21 | // $ chat help post 22 | // usage: chat [] post [] [] 23 | // 24 | // Post a message to a channel. 25 | // 26 | // Flags: 27 | // --image=IMAGE image to post 28 | // 29 | // Args: 30 | // channel to post to 31 | // [] text to post 32 | // $ chat post --image=~/Downloads/owls.jpg pics 33 | // 34 | // From code like this: 35 | // 36 | // package main 37 | // 38 | // import "gopkg.in/alecthomas/kingpin.v2" 39 | // 40 | // var ( 41 | // debug = kingpin.Flag("debug", "enable debug mode").Default("false").Bool() 42 | // serverIP = kingpin.Flag("server", "server address").Default("127.0.0.1").IP() 43 | // 44 | // register = kingpin.Command("register", "Register a new user.") 45 | // registerNick = register.Arg("nick", "nickname for user").Required().String() 46 | // registerName = register.Arg("name", "name of user").Required().String() 47 | // 48 | // post = kingpin.Command("post", "Post a message to a channel.") 49 | // postImage = post.Flag("image", "image to post").ExistingFile() 50 | // postChannel = post.Arg("channel", "channel to post to").Required().String() 51 | // postText = post.Arg("text", "text to post").String() 52 | // ) 53 | // 54 | // func main() { 55 | // switch kingpin.Parse() { 56 | // // Register user 57 | // case "register": 58 | // println(*registerNick) 59 | // 60 | // // Post message 61 | // case "post": 62 | // if *postImage != nil { 63 | // } 64 | // if *postText != "" { 65 | // } 66 | // } 67 | // } 68 | package kingpin 69 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msgfeefilter.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | // MsgFeeFilter implements the Message interface and represents a bitcoin 13 | // feefilter message. It is used to request the receiving peer does not 14 | // announce any transactions below the specified minimum fee rate. 15 | // 16 | // This message was not added until protocol versions starting with 17 | // FeeFilterVersion. 18 | type MsgFeeFilter struct { 19 | MinFee int64 20 | } 21 | 22 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 23 | // This is part of the Message interface implementation. 24 | func (msg *MsgFeeFilter) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error { 25 | if pver < FeeFilterVersion { 26 | str := fmt.Sprintf("feefilter message invalid for protocol "+ 27 | "version %d", pver) 28 | return messageError("MsgFeeFilter.BtcDecode", str) 29 | } 30 | 31 | return readElement(r, &msg.MinFee) 32 | } 33 | 34 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 35 | // This is part of the Message interface implementation. 36 | func (msg *MsgFeeFilter) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error { 37 | if pver < FeeFilterVersion { 38 | str := fmt.Sprintf("feefilter message invalid for protocol "+ 39 | "version %d", pver) 40 | return messageError("MsgFeeFilter.BtcEncode", str) 41 | } 42 | 43 | return writeElement(w, msg.MinFee) 44 | } 45 | 46 | // Command returns the protocol command string for the message. This is part 47 | // of the Message interface implementation. 48 | func (msg *MsgFeeFilter) Command() string { 49 | return CmdFeeFilter 50 | } 51 | 52 | // MaxPayloadLength returns the maximum length the payload can be for the 53 | // receiver. This is part of the Message interface implementation. 54 | func (msg *MsgFeeFilter) MaxPayloadLength(pver uint32) uint32 { 55 | return 8 56 | } 57 | 58 | // NewMsgFeeFilter returns a new bitcoin feefilter message that conforms to 59 | // the Message interface. See MsgFeeFilter for details. 60 | func NewMsgFeeFilter(minfee int64) *MsgFeeFilter { 61 | return &MsgFeeFilter{ 62 | MinFee: minfee, 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msggetcfcheckpt.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "io" 9 | 10 | "github.com/btcsuite/btcd/chaincfg/chainhash" 11 | ) 12 | 13 | // MsgGetCFCheckpt is a request for filter headers at evenly spaced intervals 14 | // throughout the blockchain history. It allows to set the FilterType field to 15 | // get headers in the chain of basic (0x00) or extended (0x01) headers. 16 | type MsgGetCFCheckpt struct { 17 | FilterType FilterType 18 | StopHash chainhash.Hash 19 | } 20 | 21 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 22 | // This is part of the Message interface implementation. 23 | func (msg *MsgGetCFCheckpt) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding) error { 24 | err := readElement(r, &msg.FilterType) 25 | if err != nil { 26 | return err 27 | } 28 | 29 | return readElement(r, &msg.StopHash) 30 | } 31 | 32 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 33 | // This is part of the Message interface implementation. 34 | func (msg *MsgGetCFCheckpt) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding) error { 35 | err := writeElement(w, msg.FilterType) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | return writeElement(w, &msg.StopHash) 41 | } 42 | 43 | // Command returns the protocol command string for the message. This is part 44 | // of the Message interface implementation. 45 | func (msg *MsgGetCFCheckpt) Command() string { 46 | return CmdGetCFCheckpt 47 | } 48 | 49 | // MaxPayloadLength returns the maximum length the payload can be for the 50 | // receiver. This is part of the Message interface implementation. 51 | func (msg *MsgGetCFCheckpt) MaxPayloadLength(pver uint32) uint32 { 52 | // Filter type + uint32 + block hash 53 | return 1 + chainhash.HashSize 54 | } 55 | 56 | // NewMsgGetCFCheckpt returns a new bitcoin getcfcheckpt message that conforms 57 | // to the Message interface using the passed parameters and defaults for the 58 | // remaining fields. 59 | func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash) *MsgGetCFCheckpt { 60 | return &MsgGetCFCheckpt{ 61 | FilterType: filterType, 62 | StopHash: *stopHash, 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msgfeefilter.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | ) 12 | 13 | // MsgFeeFilter implements the Message interface and represents a bitcoin 14 | // feefilter message. It is used to request the receiving peer does not 15 | // announce any transactions below the specified minimum fee rate. 16 | // 17 | // This message was not added until protocol versions starting with 18 | // FeeFilterVersion. 19 | type MsgFeeFilter struct { 20 | MinFee int64 21 | } 22 | 23 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 24 | // This is part of the Message interface implementation. 25 | func (msg *MsgFeeFilter) BtcDecode(r io.Reader, pver uint32) error { 26 | if pver < FeeFilterVersion { 27 | str := fmt.Sprintf("feefilter message invalid for protocol "+ 28 | "version %d", pver) 29 | return messageError("MsgFeeFilter.BtcDecode", str) 30 | } 31 | 32 | return readElement(r, &msg.MinFee) 33 | } 34 | 35 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 36 | // This is part of the Message interface implementation. 37 | func (msg *MsgFeeFilter) BtcEncode(w io.Writer, pver uint32) error { 38 | if pver < FeeFilterVersion { 39 | str := fmt.Sprintf("feefilter message invalid for protocol "+ 40 | "version %d", pver) 41 | return messageError("MsgFeeFilter.BtcEncode", str) 42 | } 43 | 44 | return writeElement(w, msg.MinFee) 45 | } 46 | 47 | // Command returns the protocol command string for the message. This is part 48 | // of the Message interface implementation. 49 | func (msg *MsgFeeFilter) Command() string { 50 | return CmdFeeFilter 51 | } 52 | 53 | // MaxPayloadLength returns the maximum length the payload can be for the 54 | // receiver. This is part of the Message interface implementation. 55 | func (msg *MsgFeeFilter) MaxPayloadLength(pver uint32) uint32 { 56 | return 8 57 | } 58 | 59 | // NewMsgFeeFilter returns a new bitcoin feefilter message that conforms to 60 | // the Message interface. See MsgFeeFilter for details. 61 | func NewMsgFeeFilter(minfee int64) *MsgFeeFilter { 62 | return &MsgFeeFilter{ 63 | MinFee: minfee, 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msggetcfcheckpt.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "io" 10 | 11 | "github.com/bcext/gcash/chaincfg/chainhash" 12 | ) 13 | 14 | // MsgGetCFCheckpt is a request for filter headers at evenly spaced intervals 15 | // throughout the blockchain history. It allows to set the FilterType field to 16 | // get headers in the chain of basic (0x00) or extended (0x01) headers. 17 | type MsgGetCFCheckpt struct { 18 | FilterType FilterType 19 | StopHash chainhash.Hash 20 | } 21 | 22 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 23 | // This is part of the Message interface implementation. 24 | func (msg *MsgGetCFCheckpt) BtcDecode(r io.Reader, pver uint32) error { 25 | err := readElement(r, &msg.FilterType) 26 | if err != nil { 27 | return err 28 | } 29 | 30 | return readElement(r, &msg.StopHash) 31 | } 32 | 33 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 34 | // This is part of the Message interface implementation. 35 | func (msg *MsgGetCFCheckpt) BtcEncode(w io.Writer, pver uint32) error { 36 | err := writeElement(w, msg.FilterType) 37 | if err != nil { 38 | return err 39 | } 40 | 41 | return writeElement(w, &msg.StopHash) 42 | } 43 | 44 | // Command returns the protocol command string for the message. This is part 45 | // of the Message interface implementation. 46 | func (msg *MsgGetCFCheckpt) Command() string { 47 | return CmdGetCFCheckpt 48 | } 49 | 50 | // MaxPayloadLength returns the maximum length the payload can be for the 51 | // receiver. This is part of the Message interface implementation. 52 | func (msg *MsgGetCFCheckpt) MaxPayloadLength(pver uint32) uint32 { 53 | // Filter type + uint32 + block hash 54 | return 1 + chainhash.HashSize 55 | } 56 | 57 | // NewMsgGetCFCheckpt returns a new bitcoin getcfcheckpt message that conforms 58 | // to the Message interface using the passed parameters and defaults for the 59 | // remaining fields. 60 | func NewMsgGetCFCheckpt(filterType FilterType, stopHash *chainhash.Hash) *MsgGetCFCheckpt { 61 | return &MsgGetCFCheckpt{ 62 | FilterType: filterType, 63 | StopHash: *stopHash, 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /backend/backend.go: -------------------------------------------------------------------------------- 1 | package backend 2 | 3 | import ( 4 | "github.com/square/beancounter/deriver" 5 | time "time" 6 | ) 7 | 8 | // Backend is an interface which abstracts different types of backends. 9 | // 10 | // The Backends are responsible for fetching all the transactions related to an address. 11 | // For each transaction, the Backend must grab: 12 | // - the height 13 | // - the raw transaction bytes 14 | // 15 | // In addition, the backend must know the chain height. The backend is allowed to fetch this value 16 | // once (at startup) and cache it. 17 | // 18 | // In general, we tried to keep the backends minimal and move as much (common) logic as possible 19 | // into the accounter. 20 | // 21 | // There are a few differences between Electrum and Btcd (and potentially any other Backend we 22 | // decide to add in the future). For instance, Electrum returns the block height when fetching all 23 | // the transactions for a given address, but Btcd doesn't. On the other hand, Btcd returns the raw 24 | // transaction information right away but Electrum requires additional requests. 25 | // 26 | // Because of these differences, the Backend exposes a Finish() method. This method allows the 27 | // Accounter to wait until the Backend is done with any additional requests. In theory, we could 28 | // forgo the Finish() method and have the Accounter read from the TxResponses channel until it has 29 | // all the data it needs. This would require the Accounter to maintain its own set of transactions. 30 | type Backend interface { 31 | ChainHeight() uint32 32 | 33 | AddrRequest(addr *deriver.Address) 34 | AddrResponses() <-chan *AddrResponse 35 | TxRequest(txHash string) 36 | TxResponses() <-chan *TxResponse 37 | BlockRequest(height uint32) 38 | BlockResponses() <-chan *BlockResponse 39 | 40 | Finish() 41 | } 42 | 43 | // AddrResponse lists transaction hashes for a given address 44 | type AddrResponse struct { 45 | Address *deriver.Address 46 | TxHashes []string 47 | } 48 | 49 | // TxResponse contains raw transaction, transaction hash and a block height in which 50 | // it was confirmed. 51 | type TxResponse struct { 52 | Hash string 53 | Height int64 54 | Hex string 55 | } 56 | 57 | type BlockResponse struct { 58 | Height uint32 59 | Timestamp time.Time 60 | } 61 | 62 | // HasTransactions returns true if the Response contains any transactions 63 | func (r *AddrResponse) HasTransactions() bool { 64 | return len(r.TxHashes) > 0 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | `go get github.com/pkg/errors` 6 | 7 | The traditional error handling idiom in Go is roughly akin to 8 | ```go 9 | if err != nil { 10 | return err 11 | } 12 | ``` 13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 14 | 15 | ## Adding context to an error 16 | 17 | The errors.Wrap function returns a new error that adds context to the original error. For example 18 | ```go 19 | _, err := ioutil.ReadAll(r) 20 | if err != nil { 21 | return errors.Wrap(err, "read failed") 22 | } 23 | ``` 24 | ## Retrieving the cause of an error 25 | 26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 27 | ```go 28 | type causer interface { 29 | Cause() error 30 | } 31 | ``` 32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 33 | ```go 34 | switch err := errors.Cause(err).(type) { 35 | case *MyError: 36 | // handle specifically 37 | default: 38 | // unknown error 39 | } 40 | ``` 41 | 42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 43 | 44 | ## Contributing 45 | 46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 47 | 48 | Before proposing a change, please discuss your change by raising an issue. 49 | 50 | ## Licence 51 | 52 | BSD-2-Clause 53 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btclog/interface.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btclog 6 | 7 | // Logger is an interface which describes a level-based logger. A default 8 | // implementation of Logger is implemented by this package and can be created 9 | // by calling (*Backend).Logger. 10 | type Logger interface { 11 | // Tracef formats message according to format specifier and writes to 12 | // to log with LevelTrace. 13 | Tracef(format string, params ...interface{}) 14 | 15 | // Debugf formats message according to format specifier and writes to 16 | // log with LevelDebug. 17 | Debugf(format string, params ...interface{}) 18 | 19 | // Infof formats message according to format specifier and writes to 20 | // log with LevelInfo. 21 | Infof(format string, params ...interface{}) 22 | 23 | // Warnf formats message according to format specifier and writes to 24 | // to log with LevelWarn. 25 | Warnf(format string, params ...interface{}) 26 | 27 | // Errorf formats message according to format specifier and writes to 28 | // to log with LevelError. 29 | Errorf(format string, params ...interface{}) 30 | 31 | // Criticalf formats message according to format specifier and writes to 32 | // log with LevelCritical. 33 | Criticalf(format string, params ...interface{}) 34 | 35 | // Trace formats message using the default formats for its operands 36 | // and writes to log with LevelTrace. 37 | Trace(v ...interface{}) 38 | 39 | // Debug formats message using the default formats for its operands 40 | // and writes to log with LevelDebug. 41 | Debug(v ...interface{}) 42 | 43 | // Info formats message using the default formats for its operands 44 | // and writes to log with LevelInfo. 45 | Info(v ...interface{}) 46 | 47 | // Warn formats message using the default formats for its operands 48 | // and writes to log with LevelWarn. 49 | Warn(v ...interface{}) 50 | 51 | // Error formats message using the default formats for its operands 52 | // and writes to log with LevelError. 53 | Error(v ...interface{}) 54 | 55 | // Critical formats message using the default formats for its operands 56 | // and writes to log with LevelCritical. 57 | Critical(v ...interface{}) 58 | 59 | // Level returns the current logging level. 60 | Level() Level 61 | 62 | // SetLevel changes the logging level to the passed level. 63 | SetLevel(level Level) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/invvect.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2016 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/bcext/gcash/chaincfg/chainhash" 13 | ) 14 | 15 | const ( 16 | // MaxInvPerMsg is the maximum number of inventory vectors that can be in a 17 | // single bitcoin inv message. 18 | MaxInvPerMsg = 50000 19 | 20 | // Maximum payload size for an inventory vector. 21 | maxInvVectPayload = 4 + chainhash.HashSize 22 | ) 23 | 24 | // InvType represents the allowed types of inventory vectors. See InvVect. 25 | type InvType uint32 26 | 27 | // These constants define the various supported inventory vector types. 28 | const ( 29 | InvTypeError InvType = 0 30 | InvTypeTx InvType = 1 31 | InvTypeBlock InvType = 2 32 | InvTypeFilteredBlock InvType = 3 33 | ) 34 | 35 | // Map of service flags back to their constant names for pretty printing. 36 | var ivStrings = map[InvType]string{ 37 | InvTypeError: "ERROR", 38 | InvTypeTx: "MSG_TX", 39 | InvTypeBlock: "MSG_BLOCK", 40 | InvTypeFilteredBlock: "MSG_FILTERED_BLOCK", 41 | } 42 | 43 | // String returns the InvType in human-readable form. 44 | func (invtype InvType) String() string { 45 | if s, ok := ivStrings[invtype]; ok { 46 | return s 47 | } 48 | 49 | return fmt.Sprintf("Unknown InvType (%d)", uint32(invtype)) 50 | } 51 | 52 | // InvVect defines a bitcoin inventory vector which is used to describe data, 53 | // as specified by the Type field, that a peer wants, has, or does not have to 54 | // another peer. 55 | type InvVect struct { 56 | Type InvType // Type of data 57 | Hash chainhash.Hash // Hash of the data 58 | } 59 | 60 | // NewInvVect returns a new InvVect using the provided type and hash. 61 | func NewInvVect(typ InvType, hash *chainhash.Hash) *InvVect { 62 | return &InvVect{ 63 | Type: typ, 64 | Hash: *hash, 65 | } 66 | } 67 | 68 | // readInvVect reads an encoded InvVect from r depending on the protocol 69 | // version. 70 | func readInvVect(r io.Reader, pver uint32, iv *InvVect) error { 71 | return readElements(r, &iv.Type, &iv.Hash) 72 | } 73 | 74 | // writeInvVect serializes an InvVect to w depending on the protocol version. 75 | func writeInvVect(w io.Writer, pver uint32, iv *InvVect) error { 76 | return writeElements(w, iv.Type, &iv.Hash) 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcjson/helpers.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcjson 6 | 7 | // Bool is a helper routine that allocates a new bool value to store v and 8 | // returns a pointer to it. This is useful when assigning optional parameters. 9 | func Bool(v bool) *bool { 10 | p := new(bool) 11 | *p = v 12 | return p 13 | } 14 | 15 | // Int is a helper routine that allocates a new int value to store v and 16 | // returns a pointer to it. This is useful when assigning optional parameters. 17 | func Int(v int) *int { 18 | p := new(int) 19 | *p = v 20 | return p 21 | } 22 | 23 | // Uint is a helper routine that allocates a new uint value to store v and 24 | // returns a pointer to it. This is useful when assigning optional parameters. 25 | func Uint(v uint) *uint { 26 | p := new(uint) 27 | *p = v 28 | return p 29 | } 30 | 31 | // Int32 is a helper routine that allocates a new int32 value to store v and 32 | // returns a pointer to it. This is useful when assigning optional parameters. 33 | func Int32(v int32) *int32 { 34 | p := new(int32) 35 | *p = v 36 | return p 37 | } 38 | 39 | // Uint32 is a helper routine that allocates a new uint32 value to store v and 40 | // returns a pointer to it. This is useful when assigning optional parameters. 41 | func Uint32(v uint32) *uint32 { 42 | p := new(uint32) 43 | *p = v 44 | return p 45 | } 46 | 47 | // Int64 is a helper routine that allocates a new int64 value to store v and 48 | // returns a pointer to it. This is useful when assigning optional parameters. 49 | func Int64(v int64) *int64 { 50 | p := new(int64) 51 | *p = v 52 | return p 53 | } 54 | 55 | // Uint64 is a helper routine that allocates a new uint64 value to store v and 56 | // returns a pointer to it. This is useful when assigning optional parameters. 57 | func Uint64(v uint64) *uint64 { 58 | p := new(uint64) 59 | *p = v 60 | return p 61 | } 62 | 63 | // Float64 is a helper routine that allocates a new float64 value to store v and 64 | // returns a pointer to it. This is useful when assigning optional parameters. 65 | func Float64(v float64) *float64 { 66 | p := new(float64) 67 | *p = v 68 | return p 69 | } 70 | 71 | // String is a helper routine that allocates a new string value to store v and 72 | // returns a pointer to it. This is useful when assigning optional parameters. 73 | func String(v string) *string { 74 | p := new(string) 75 | *p = v 76 | return p 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/btcec/privkey.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2016 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcec 6 | 7 | import ( 8 | "crypto/ecdsa" 9 | "crypto/elliptic" 10 | "crypto/rand" 11 | "math/big" 12 | ) 13 | 14 | // PrivateKey wraps an ecdsa.PrivateKey as a convenience mainly for signing 15 | // things with the the private key without having to directly import the ecdsa 16 | // package. 17 | type PrivateKey ecdsa.PrivateKey 18 | 19 | // PrivKeyFromBytes returns a private and public key for `curve' based on the 20 | // private key passed as an argument as a byte slice. 21 | func PrivKeyFromBytes(curve elliptic.Curve, pk []byte) (*PrivateKey, 22 | *PublicKey) { 23 | x, y := curve.ScalarBaseMult(pk) 24 | 25 | priv := &ecdsa.PrivateKey{ 26 | PublicKey: ecdsa.PublicKey{ 27 | Curve: curve, 28 | X: x, 29 | Y: y, 30 | }, 31 | D: new(big.Int).SetBytes(pk), 32 | } 33 | 34 | return (*PrivateKey)(priv), (*PublicKey)(&priv.PublicKey) 35 | } 36 | 37 | // NewPrivateKey is a wrapper for ecdsa.GenerateKey that returns a PrivateKey 38 | // instead of the normal ecdsa.PrivateKey. 39 | func NewPrivateKey(curve elliptic.Curve) (*PrivateKey, error) { 40 | key, err := ecdsa.GenerateKey(curve, rand.Reader) 41 | if err != nil { 42 | return nil, err 43 | } 44 | return (*PrivateKey)(key), nil 45 | } 46 | 47 | // PubKey returns the PublicKey corresponding to this private key. 48 | func (p *PrivateKey) PubKey() *PublicKey { 49 | return (*PublicKey)(&p.PublicKey) 50 | } 51 | 52 | // ToECDSA returns the private key as a *ecdsa.PrivateKey. 53 | func (p *PrivateKey) ToECDSA() *ecdsa.PrivateKey { 54 | return (*ecdsa.PrivateKey)(p) 55 | } 56 | 57 | // Sign generates an ECDSA signature for the provided hash (which should be the result 58 | // of hashing a larger message) using the private key. Produced signature 59 | // is deterministic (same message and same key yield the same signature) and canonical 60 | // in accordance with RFC6979 and BIP0062. 61 | func (p *PrivateKey) Sign(hash []byte) (*Signature, error) { 62 | return signRFC6979(p, hash) 63 | } 64 | 65 | // PrivKeyBytesLen defines the length in bytes of a serialized private key. 66 | const PrivKeyBytesLen = 32 67 | 68 | // Serialize returns the private key number d as a big-endian binary-encoded 69 | // number, padded to a length of 32 bytes. 70 | func (p *PrivateKey) Serialize() []byte { 71 | b := make([]byte, 0, PrivKeyBytesLen) 72 | return paddedAppend(PrivKeyBytesLen, b, p.ToECDSA().D.Bytes()) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/btcec/privkey.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2016 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package btcec 6 | 7 | import ( 8 | "crypto/ecdsa" 9 | "crypto/elliptic" 10 | "crypto/rand" 11 | "math/big" 12 | ) 13 | 14 | // PrivateKey wraps an ecdsa.PrivateKey as a convenience mainly for signing 15 | // things with the the private key without having to directly import the ecdsa 16 | // package. 17 | type PrivateKey ecdsa.PrivateKey 18 | 19 | // PrivKeyFromBytes returns a private and public key for `curve' based on the 20 | // private key passed as an argument as a byte slice. 21 | func PrivKeyFromBytes(curve elliptic.Curve, pk []byte) (*PrivateKey, 22 | *PublicKey) { 23 | x, y := curve.ScalarBaseMult(pk) 24 | 25 | priv := &ecdsa.PrivateKey{ 26 | PublicKey: ecdsa.PublicKey{ 27 | Curve: curve, 28 | X: x, 29 | Y: y, 30 | }, 31 | D: new(big.Int).SetBytes(pk), 32 | } 33 | 34 | return (*PrivateKey)(priv), (*PublicKey)(&priv.PublicKey) 35 | } 36 | 37 | // NewPrivateKey is a wrapper for ecdsa.GenerateKey that returns a PrivateKey 38 | // instead of the normal ecdsa.PrivateKey. 39 | func NewPrivateKey(curve elliptic.Curve) (*PrivateKey, error) { 40 | key, err := ecdsa.GenerateKey(curve, rand.Reader) 41 | if err != nil { 42 | return nil, err 43 | } 44 | return (*PrivateKey)(key), nil 45 | } 46 | 47 | // PubKey returns the PublicKey corresponding to this private key. 48 | func (p *PrivateKey) PubKey() *PublicKey { 49 | return (*PublicKey)(&p.PublicKey) 50 | } 51 | 52 | // ToECDSA returns the private key as a *ecdsa.PrivateKey. 53 | func (p *PrivateKey) ToECDSA() *ecdsa.PrivateKey { 54 | return (*ecdsa.PrivateKey)(p) 55 | } 56 | 57 | // Sign generates an ECDSA signature for the provided hash (which should be the result 58 | // of hashing a larger message) using the private key. Produced signature 59 | // is deterministic (same message and same key yield the same signature) and canonical 60 | // in accordance with RFC6979 and BIP0062. 61 | func (p *PrivateKey) Sign(hash []byte) (*Signature, error) { 62 | return signRFC6979(p, hash) 63 | } 64 | 65 | // PrivKeyBytesLen defines the length in bytes of a serialized private key. 66 | const PrivKeyBytesLen = 32 67 | 68 | // Serialize returns the private key number d as a big-endian binary-encoded 69 | // number, padded to a length of 32 bytes. 70 | func (p *PrivateKey) Serialize() []byte { 71 | b := make([]byte, 0, PrivKeyBytesLen) 72 | return paddedAppend(PrivKeyBytesLen, b, p.ToECDSA().D.Bytes()) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msggetcfheaders.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "io" 9 | 10 | "github.com/btcsuite/btcd/chaincfg/chainhash" 11 | ) 12 | 13 | // MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed 14 | // filter headers. It allows to set the FilterType field to get headers in the 15 | // chain of basic (0x00) or extended (0x01) headers. 16 | type MsgGetCFHeaders struct { 17 | FilterType FilterType 18 | StartHeight uint32 19 | StopHash chainhash.Hash 20 | } 21 | 22 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 23 | // This is part of the Message interface implementation. 24 | func (msg *MsgGetCFHeaders) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding) error { 25 | err := readElement(r, &msg.FilterType) 26 | if err != nil { 27 | return err 28 | } 29 | 30 | err = readElement(r, &msg.StartHeight) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | return readElement(r, &msg.StopHash) 36 | } 37 | 38 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 39 | // This is part of the Message interface implementation. 40 | func (msg *MsgGetCFHeaders) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding) error { 41 | err := writeElement(w, msg.FilterType) 42 | if err != nil { 43 | return err 44 | } 45 | 46 | err = writeElement(w, &msg.StartHeight) 47 | if err != nil { 48 | return err 49 | } 50 | 51 | return writeElement(w, &msg.StopHash) 52 | } 53 | 54 | // Command returns the protocol command string for the message. This is part 55 | // of the Message interface implementation. 56 | func (msg *MsgGetCFHeaders) Command() string { 57 | return CmdGetCFHeaders 58 | } 59 | 60 | // MaxPayloadLength returns the maximum length the payload can be for the 61 | // receiver. This is part of the Message interface implementation. 62 | func (msg *MsgGetCFHeaders) MaxPayloadLength(pver uint32) uint32 { 63 | // Filter type + uint32 + block hash 64 | return 1 + 4 + chainhash.HashSize 65 | } 66 | 67 | // NewMsgGetCFHeaders returns a new bitcoin getcfheader message that conforms to 68 | // the Message interface using the passed parameters and defaults for the 69 | // remaining fields. 70 | func NewMsgGetCFHeaders(filterType FilterType, startHeight uint32, 71 | stopHash *chainhash.Hash) *MsgGetCFHeaders { 72 | return &MsgGetCFHeaders{ 73 | FilterType: filterType, 74 | StartHeight: startHeight, 75 | StopHash: *stopHash, 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msggetcfheaders.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "io" 10 | 11 | "github.com/bcext/gcash/chaincfg/chainhash" 12 | ) 13 | 14 | // MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed 15 | // filter headers. It allows to set the FilterType field to get headers in the 16 | // chain of basic (0x00) or extended (0x01) headers. 17 | type MsgGetCFHeaders struct { 18 | FilterType FilterType 19 | StartHeight uint32 20 | StopHash chainhash.Hash 21 | } 22 | 23 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 24 | // This is part of the Message interface implementation. 25 | func (msg *MsgGetCFHeaders) BtcDecode(r io.Reader, pver uint32) error { 26 | err := readElement(r, &msg.FilterType) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | err = readElement(r, &msg.StartHeight) 32 | if err != nil { 33 | return err 34 | } 35 | 36 | return readElement(r, &msg.StopHash) 37 | } 38 | 39 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 40 | // This is part of the Message interface implementation. 41 | func (msg *MsgGetCFHeaders) BtcEncode(w io.Writer, pver uint32) error { 42 | err := writeElement(w, msg.FilterType) 43 | if err != nil { 44 | return err 45 | } 46 | 47 | err = writeElement(w, &msg.StartHeight) 48 | if err != nil { 49 | return err 50 | } 51 | 52 | return writeElement(w, &msg.StopHash) 53 | } 54 | 55 | // Command returns the protocol command string for the message. This is part 56 | // of the Message interface implementation. 57 | func (msg *MsgGetCFHeaders) Command() string { 58 | return CmdGetCFHeaders 59 | } 60 | 61 | // MaxPayloadLength returns the maximum length the payload can be for the 62 | // receiver. This is part of the Message interface implementation. 63 | func (msg *MsgGetCFHeaders) MaxPayloadLength(pver uint32) uint32 { 64 | // Filter type + uint32 + block hash 65 | return 1 + 4 + chainhash.HashSize 66 | } 67 | 68 | // NewMsgGetCFHeaders returns a new bitcoin getcfheader message that conforms to 69 | // the Message interface using the passed parameters and defaults for the 70 | // remaining fields. 71 | func NewMsgGetCFHeaders(filterType FilterType, startHeight uint32, 72 | stopHash *chainhash.Hash) *MsgGetCFHeaders { 73 | return &MsgGetCFHeaders{ 74 | FilterType: filterType, 75 | StartHeight: startHeight, 76 | StopHash: *stopHash, 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/alecthomas/units/bytes.go: -------------------------------------------------------------------------------- 1 | package units 2 | 3 | // Base2Bytes is the old non-SI power-of-2 byte scale (1024 bytes in a kilobyte, 4 | // etc.). 5 | type Base2Bytes int64 6 | 7 | // Base-2 byte units. 8 | const ( 9 | Kibibyte Base2Bytes = 1024 10 | KiB = Kibibyte 11 | Mebibyte = Kibibyte * 1024 12 | MiB = Mebibyte 13 | Gibibyte = Mebibyte * 1024 14 | GiB = Gibibyte 15 | Tebibyte = Gibibyte * 1024 16 | TiB = Tebibyte 17 | Pebibyte = Tebibyte * 1024 18 | PiB = Pebibyte 19 | Exbibyte = Pebibyte * 1024 20 | EiB = Exbibyte 21 | ) 22 | 23 | var ( 24 | bytesUnitMap = MakeUnitMap("iB", "B", 1024) 25 | oldBytesUnitMap = MakeUnitMap("B", "B", 1024) 26 | ) 27 | 28 | // ParseBase2Bytes supports both iB and B in base-2 multipliers. That is, KB 29 | // and KiB are both 1024. 30 | func ParseBase2Bytes(s string) (Base2Bytes, error) { 31 | n, err := ParseUnit(s, bytesUnitMap) 32 | if err != nil { 33 | n, err = ParseUnit(s, oldBytesUnitMap) 34 | } 35 | return Base2Bytes(n), err 36 | } 37 | 38 | func (b Base2Bytes) String() string { 39 | return ToString(int64(b), 1024, "iB", "B") 40 | } 41 | 42 | var ( 43 | metricBytesUnitMap = MakeUnitMap("B", "B", 1000) 44 | ) 45 | 46 | // MetricBytes are SI byte units (1000 bytes in a kilobyte). 47 | type MetricBytes SI 48 | 49 | // SI base-10 byte units. 50 | const ( 51 | Kilobyte MetricBytes = 1000 52 | KB = Kilobyte 53 | Megabyte = Kilobyte * 1000 54 | MB = Megabyte 55 | Gigabyte = Megabyte * 1000 56 | GB = Gigabyte 57 | Terabyte = Gigabyte * 1000 58 | TB = Terabyte 59 | Petabyte = Terabyte * 1000 60 | PB = Petabyte 61 | Exabyte = Petabyte * 1000 62 | EB = Exabyte 63 | ) 64 | 65 | // ParseMetricBytes parses base-10 metric byte units. That is, KB is 1000 bytes. 66 | func ParseMetricBytes(s string) (MetricBytes, error) { 67 | n, err := ParseUnit(s, metricBytesUnitMap) 68 | return MetricBytes(n), err 69 | } 70 | 71 | func (m MetricBytes) String() string { 72 | return ToString(int64(m), 1000, "B", "B") 73 | } 74 | 75 | // ParseStrictBytes supports both iB and B suffixes for base 2 and metric, 76 | // respectively. That is, KiB represents 1024 and KB represents 1000. 77 | func ParseStrictBytes(s string) (int64, error) { 78 | n, err := ParseUnit(s, bytesUnitMap) 79 | if err != nil { 80 | n, err = ParseUnit(s, metricBytesUnitMap) 81 | } 82 | return int64(n), err 83 | } 84 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/chaincfg/README.md: -------------------------------------------------------------------------------- 1 | chaincfg 2 | ======== 3 | 4 | [![Build Status](http://img.shields.io/travis/bcext/gcash.svg)](https://travis-ci.org/bcext/gcash) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/bcext/gcash/chaincfg) 7 | 8 | Package chaincfg defines chain configuration parameters for the three standard 9 | Bitcoin networks and provides the ability for callers to define their own custom 10 | Bitcoin networks. 11 | 12 | Although this package was primarily written for gcash, it has intentionally been 13 | designed so it can be used as a standalone package for any projects needing to 14 | use parameters for the standard Bitcoin networks or for projects needing to 15 | define their own network. 16 | 17 | ## Sample Use 18 | 19 | ```Go 20 | package main 21 | 22 | import ( 23 | "flag" 24 | "fmt" 25 | "log" 26 | 27 | "github.com/bcext/cashutil" 28 | "github.com/bcext/gcash/chaincfg" 29 | ) 30 | 31 | var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network") 32 | 33 | // By default (without -testnet), use mainnet. 34 | var chainParams = &chaincfg.MainNetParams 35 | 36 | func main() { 37 | flag.Parse() 38 | 39 | // Modify active network parameters if operating on testnet. 40 | if *testnet { 41 | chainParams = &chaincfg.TestNet3Params 42 | } 43 | 44 | // later... 45 | 46 | // Create and print new payment address, specific to the active network. 47 | pubKeyHash := make([]byte, 20) 48 | addr, err := cashutil.NewAddressPubKeyHash(pubKeyHash, chainParams) 49 | if err != nil { 50 | log.Fatal(err) 51 | } 52 | fmt.Println(addr) 53 | } 54 | ``` 55 | 56 | ## Installation and Updating 57 | 58 | ```bash 59 | $ go get -u github.com/bcext/gcash/chaincfg 60 | ``` 61 | 62 | ## GPG Verification Key 63 | 64 | All official release tags are signed by Conformal so users can ensure the code 65 | has not been tampered with and is coming from the btcsuite developers. To 66 | verify the signature perform the following: 67 | 68 | - Download the public key from the Conformal website at 69 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 70 | 71 | - Import the public key into your GPG keyring: 72 | ```bash 73 | gpg --import GIT-GPG-KEY-conformal.txt 74 | ``` 75 | 76 | - Verify the release tag with the following command where `TAG_NAME` is a 77 | placeholder for the specific tag: 78 | ```bash 79 | git tag -v TAG_NAME 80 | ``` 81 | 82 | ## License 83 | 84 | Package chaincfg is licensed under the [copyfree](http://copyfree.org) ISC 85 | License. 86 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/txscript/README.md: -------------------------------------------------------------------------------- 1 | txscript 2 | ======== 3 | 4 | [![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)](https://travis-ci.org/btcsuite/btcd) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://godoc.org/github.com/btcsuite/btcd/txscript?status.png)](http://godoc.org/github.com/btcsuite/btcd/txscript) 7 | 8 | Package txscript implements the bitcoin transaction script language. There is 9 | a comprehensive test suite. 10 | 11 | This package has intentionally been designed so it can be used as a standalone 12 | package for any projects needing to use or validate bitcoin transaction scripts. 13 | 14 | ## Bitcoin Scripts 15 | 16 | Bitcoin provides a stack-based, FORTH-like language for the scripts in 17 | the bitcoin transactions. This language is not turing complete 18 | although it is still fairly powerful. A description of the language 19 | can be found at https://en.bitcoin.it/wiki/Script 20 | 21 | ## Installation and Updating 22 | 23 | ```bash 24 | $ go get -u github.com/btcsuite/btcd/txscript 25 | ``` 26 | 27 | ## Examples 28 | 29 | * [Standard Pay-to-pubkey-hash Script](http://godoc.org/github.com/btcsuite/btcd/txscript#example-PayToAddrScript) 30 | Demonstrates creating a script which pays to a bitcoin address. It also 31 | prints the created script hex and uses the DisasmString function to display 32 | the disassembled script. 33 | 34 | * [Extracting Details from Standard Scripts](http://godoc.org/github.com/btcsuite/btcd/txscript#example-ExtractPkScriptAddrs) 35 | Demonstrates extracting information from a standard public key script. 36 | 37 | * [Manually Signing a Transaction Output](http://godoc.org/github.com/btcsuite/btcd/txscript#example-SignTxOutput) 38 | Demonstrates manually creating and signing a redeem transaction. 39 | 40 | ## GPG Verification Key 41 | 42 | All official release tags are signed by Conformal so users can ensure the code 43 | has not been tampered with and is coming from the btcsuite developers. To 44 | verify the signature perform the following: 45 | 46 | - Download the public key from the Conformal website at 47 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 48 | 49 | - Import the public key into your GPG keyring: 50 | ```bash 51 | gpg --import GIT-GPG-KEY-conformal.txt 52 | ``` 53 | 54 | - Verify the release tag with the following command where `TAG_NAME` is a 55 | placeholder for the specific tag: 56 | ```bash 57 | git tag -v TAG_NAME 58 | ``` 59 | 60 | ## License 61 | 62 | Package txscript is licensed under the [copyfree](http://copyfree.org) ISC 63 | License. 64 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/chaincfg/README.md: -------------------------------------------------------------------------------- 1 | chaincfg 2 | ======== 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)](https://travis-ci.org/btcsuite/btcd) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd/chaincfg) 7 | 8 | Package chaincfg defines chain configuration parameters for the three standard 9 | Bitcoin networks and provides the ability for callers to define their own custom 10 | Bitcoin networks. 11 | 12 | Although this package was primarily written for btcd, it has intentionally been 13 | designed so it can be used as a standalone package for any projects needing to 14 | use parameters for the standard Bitcoin networks or for projects needing to 15 | define their own network. 16 | 17 | ## Sample Use 18 | 19 | ```Go 20 | package main 21 | 22 | import ( 23 | "flag" 24 | "fmt" 25 | "log" 26 | 27 | "github.com/btcsuite/btcutil" 28 | "github.com/btcsuite/btcd/chaincfg" 29 | ) 30 | 31 | var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network") 32 | 33 | // By default (without -testnet), use mainnet. 34 | var chainParams = &chaincfg.MainNetParams 35 | 36 | func main() { 37 | flag.Parse() 38 | 39 | // Modify active network parameters if operating on testnet. 40 | if *testnet { 41 | chainParams = &chaincfg.TestNet3Params 42 | } 43 | 44 | // later... 45 | 46 | // Create and print new payment address, specific to the active network. 47 | pubKeyHash := make([]byte, 20) 48 | addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, chainParams) 49 | if err != nil { 50 | log.Fatal(err) 51 | } 52 | fmt.Println(addr) 53 | } 54 | ``` 55 | 56 | ## Installation and Updating 57 | 58 | ```bash 59 | $ go get -u github.com/btcsuite/btcd/chaincfg 60 | ``` 61 | 62 | ## GPG Verification Key 63 | 64 | All official release tags are signed by Conformal so users can ensure the code 65 | has not been tampered with and is coming from the btcsuite developers. To 66 | verify the signature perform the following: 67 | 68 | - Download the public key from the Conformal website at 69 | https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt 70 | 71 | - Import the public key into your GPG keyring: 72 | ```bash 73 | gpg --import GIT-GPG-KEY-conformal.txt 74 | ``` 75 | 76 | - Verify the release tag with the following command where `TAG_NAME` is a 77 | placeholder for the specific tag: 78 | ```bash 79 | git tag -v TAG_NAME 80 | ``` 81 | 82 | ## License 83 | 84 | Package chaincfg is licensed under the [copyfree](http://copyfree.org) ISC 85 | License. 86 | -------------------------------------------------------------------------------- /vendor/github.com/Masterminds/semver/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.4.2 (2018-04-10) 2 | 3 | ## Changed 4 | - #72: Updated the docs to point to vert for a console appliaction 5 | - #71: Update the docs on pre-release comparator handling 6 | 7 | ## Fixed 8 | - #70: Fix the handling of pre-releases and the 0.0.0 release edge case 9 | 10 | # 1.4.1 (2018-04-02) 11 | 12 | ## Fixed 13 | - Fixed #64: Fix pre-release precedence issue (thanks @uudashr) 14 | 15 | # 1.4.0 (2017-10-04) 16 | 17 | ## Changed 18 | - #61: Update NewVersion to parse ints with a 64bit int size (thanks @zknill) 19 | 20 | # 1.3.1 (2017-07-10) 21 | 22 | ## Fixed 23 | - Fixed #57: number comparisons in prerelease sometimes inaccurate 24 | 25 | # 1.3.0 (2017-05-02) 26 | 27 | ## Added 28 | - #45: Added json (un)marshaling support (thanks @mh-cbon) 29 | - Stability marker. See https://masterminds.github.io/stability/ 30 | 31 | ## Fixed 32 | - #51: Fix handling of single digit tilde constraint (thanks @dgodd) 33 | 34 | ## Changed 35 | - #55: The godoc icon moved from png to svg 36 | 37 | # 1.2.3 (2017-04-03) 38 | 39 | ## Fixed 40 | - #46: Fixed 0.x.x and 0.0.x in constraints being treated as * 41 | 42 | # Release 1.2.2 (2016-12-13) 43 | 44 | ## Fixed 45 | - #34: Fixed issue where hyphen range was not working with pre-release parsing. 46 | 47 | # Release 1.2.1 (2016-11-28) 48 | 49 | ## Fixed 50 | - #24: Fixed edge case issue where constraint "> 0" does not handle "0.0.1-alpha" 51 | properly. 52 | 53 | # Release 1.2.0 (2016-11-04) 54 | 55 | ## Added 56 | - #20: Added MustParse function for versions (thanks @adamreese) 57 | - #15: Added increment methods on versions (thanks @mh-cbon) 58 | 59 | ## Fixed 60 | - Issue #21: Per the SemVer spec (section 9) a pre-release is unstable and 61 | might not satisfy the intended compatibility. The change here ignores pre-releases 62 | on constraint checks (e.g., ~ or ^) when a pre-release is not part of the 63 | constraint. For example, `^1.2.3` will ignore pre-releases while 64 | `^1.2.3-alpha` will include them. 65 | 66 | # Release 1.1.1 (2016-06-30) 67 | 68 | ## Changed 69 | - Issue #9: Speed up version comparison performance (thanks @sdboyer) 70 | - Issue #8: Added benchmarks (thanks @sdboyer) 71 | - Updated Go Report Card URL to new location 72 | - Updated Readme to add code snippet formatting (thanks @mh-cbon) 73 | - Updating tagging to v[SemVer] structure for compatibility with other tools. 74 | 75 | # Release 1.1.0 (2016-03-11) 76 | 77 | - Issue #2: Implemented validation to provide reasons a versions failed a 78 | constraint. 79 | 80 | # Release 1.0.1 (2015-12-31) 81 | 82 | - Fixed #1: * constraint failing on valid versions. 83 | 84 | # Release 1.0.0 (2015-10-20) 85 | 86 | - Initial release 87 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/rpcclient/README.md: -------------------------------------------------------------------------------- 1 | rpcclient 2 | ========= 3 | 4 | [![Build Status](http://img.shields.io/travis/btcsuite/btcd.svg)](https://travis-ci.org/btcsuite/btcd) 5 | [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 | [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd/rpcclient) 7 | 8 | rpcclient implements a Websocket-enabled Bitcoin JSON-RPC client package written 9 | in [Go](http://golang.org/). It provides a robust and easy to use client for 10 | interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core compatible 11 | Bitcoin JSON-RPC API. 12 | 13 | ## Status 14 | 15 | This package is currently under active development. It is already stable and 16 | the infrastructure is complete. However, there are still several RPCs left to 17 | implement and the API is not stable yet. 18 | 19 | ## Documentation 20 | 21 | * [API Reference](http://godoc.org/github.com/btcsuite/btcd/rpcclient) 22 | * [btcd Websockets Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/btcdwebsockets) 23 | Connects to a btcd RPC server using TLS-secured websockets, registers for 24 | block connected and block disconnected notifications, and gets the current 25 | block count 26 | * [btcwallet Websockets Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/btcwalletwebsockets) 27 | Connects to a btcwallet RPC server using TLS-secured websockets, registers for 28 | notifications about changes to account balances, and gets a list of unspent 29 | transaction outputs (utxos) the wallet can sign 30 | * [Bitcoin Core HTTP POST Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/bitcoincorehttp) 31 | Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled 32 | and gets the current block count 33 | 34 | ## Major Features 35 | 36 | * Supports Websockets (btcd/btcwallet) and HTTP POST mode (bitcoin core) 37 | * Provides callback and registration functions for btcd/btcwallet notifications 38 | * Supports btcd extensions 39 | * Translates to and from higher-level and easier to use Go types 40 | * Offers a synchronous (blocking) and asynchronous API 41 | * When running in Websockets mode (the default): 42 | * Automatic reconnect handling (can be disabled) 43 | * Outstanding commands are automatically reissued 44 | * Registered notifications are automatically reregistered 45 | * Back-off support on reconnect attempts 46 | 47 | ## Installation 48 | 49 | ```bash 50 | $ go get -u github.com/btcsuite/btcd/rpcclient 51 | ``` 52 | 53 | ## License 54 | 55 | Package rpcclient is licensed under the [copyfree](http://copyfree.org) ISC 56 | License. 57 | -------------------------------------------------------------------------------- /vendor/github.com/btcsuite/btcd/wire/msggetcfilters.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The btcsuite developers 2 | // Use of this source code is governed by an ISC 3 | // license that can be found in the LICENSE file. 4 | 5 | package wire 6 | 7 | import ( 8 | "io" 9 | 10 | "github.com/btcsuite/btcd/chaincfg/chainhash" 11 | ) 12 | 13 | // MaxGetCFiltersReqRange the maximum number of filters that may be requested in 14 | // a getcfheaders message. 15 | const MaxGetCFiltersReqRange = 1000 16 | 17 | // MsgGetCFilters implements the Message interface and represents a bitcoin 18 | // getcfilters message. It is used to request committed filters for a range of 19 | // blocks. 20 | type MsgGetCFilters struct { 21 | FilterType FilterType 22 | StartHeight uint32 23 | StopHash chainhash.Hash 24 | } 25 | 26 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 27 | // This is part of the Message interface implementation. 28 | func (msg *MsgGetCFilters) BtcDecode(r io.Reader, pver uint32, _ MessageEncoding) error { 29 | err := readElement(r, &msg.FilterType) 30 | if err != nil { 31 | return err 32 | } 33 | 34 | err = readElement(r, &msg.StartHeight) 35 | if err != nil { 36 | return err 37 | } 38 | 39 | return readElement(r, &msg.StopHash) 40 | } 41 | 42 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 43 | // This is part of the Message interface implementation. 44 | func (msg *MsgGetCFilters) BtcEncode(w io.Writer, pver uint32, _ MessageEncoding) error { 45 | err := writeElement(w, msg.FilterType) 46 | if err != nil { 47 | return err 48 | } 49 | 50 | err = writeElement(w, &msg.StartHeight) 51 | if err != nil { 52 | return err 53 | } 54 | 55 | return writeElement(w, &msg.StopHash) 56 | } 57 | 58 | // Command returns the protocol command string for the message. This is part 59 | // of the Message interface implementation. 60 | func (msg *MsgGetCFilters) Command() string { 61 | return CmdGetCFilters 62 | } 63 | 64 | // MaxPayloadLength returns the maximum length the payload can be for the 65 | // receiver. This is part of the Message interface implementation. 66 | func (msg *MsgGetCFilters) MaxPayloadLength(pver uint32) uint32 { 67 | // Filter type + uint32 + block hash 68 | return 1 + 4 + chainhash.HashSize 69 | } 70 | 71 | // NewMsgGetCFilters returns a new bitcoin getcfilters message that conforms to 72 | // the Message interface using the passed parameters and defaults for the 73 | // remaining fields. 74 | func NewMsgGetCFilters(filterType FilterType, startHeight uint32, 75 | stopHash *chainhash.Hash) *MsgGetCFilters { 76 | return &MsgGetCFilters{ 77 | FilterType: filterType, 78 | StartHeight: startHeight, 79 | StopHash: *stopHash, 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/bcext/gcash/wire/msggetcfilters.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The btcsuite developers 2 | // Copyright (c) 2018 The bcext developers 3 | // Use of this source code is governed by an ISC 4 | // license that can be found in the LICENSE file. 5 | 6 | package wire 7 | 8 | import ( 9 | "io" 10 | 11 | "github.com/bcext/gcash/chaincfg/chainhash" 12 | ) 13 | 14 | // MaxGetCFiltersReqRange the maximum number of filters that may be requested in 15 | // a getcfheaders message. 16 | const MaxGetCFiltersReqRange = 1000 17 | 18 | // MsgGetCFilters implements the Message interface and represents a bitcoin 19 | // getcfilters message. It is used to request committed filters for a range of 20 | // blocks. 21 | type MsgGetCFilters struct { 22 | FilterType FilterType 23 | StartHeight uint32 24 | StopHash chainhash.Hash 25 | } 26 | 27 | // BtcDecode decodes r using the bitcoin protocol encoding into the receiver. 28 | // This is part of the Message interface implementation. 29 | func (msg *MsgGetCFilters) BtcDecode(r io.Reader, pver uint32) error { 30 | err := readElement(r, &msg.FilterType) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | err = readElement(r, &msg.StartHeight) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | return readElement(r, &msg.StopHash) 41 | } 42 | 43 | // BtcEncode encodes the receiver to w using the bitcoin protocol encoding. 44 | // This is part of the Message interface implementation. 45 | func (msg *MsgGetCFilters) BtcEncode(w io.Writer, pver uint32) error { 46 | err := writeElement(w, msg.FilterType) 47 | if err != nil { 48 | return err 49 | } 50 | 51 | err = writeElement(w, &msg.StartHeight) 52 | if err != nil { 53 | return err 54 | } 55 | 56 | return writeElement(w, &msg.StopHash) 57 | } 58 | 59 | // Command returns the protocol command string for the message. This is part 60 | // of the Message interface implementation. 61 | func (msg *MsgGetCFilters) Command() string { 62 | return CmdGetCFilters 63 | } 64 | 65 | // MaxPayloadLength returns the maximum length the payload can be for the 66 | // receiver. This is part of the Message interface implementation. 67 | func (msg *MsgGetCFilters) MaxPayloadLength(pver uint32) uint32 { 68 | // Filter type + uint32 + block hash 69 | return 1 + 4 + chainhash.HashSize 70 | } 71 | 72 | // NewMsgGetCFilters returns a new bitcoin getcfilters message that conforms to 73 | // the Message interface using the passed parameters and defaults for the 74 | // remaining fields. 75 | func NewMsgGetCFilters(filterType FilterType, startHeight uint32, 76 | stopHash *chainhash.Hash) *MsgGetCFilters { 77 | return &MsgGetCFilters{ 78 | FilterType: filterType, 79 | StartHeight: startHeight, 80 | StopHash: *stopHash, 81 | } 82 | } 83 | --------------------------------------------------------------------------------