19 |
20 | {{end}}
21 |
--------------------------------------------------------------------------------
/public/images/symbol-5-1-1.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/public/images/symbol-9-1.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/backend/stakepoold/semver.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 The Decred 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 main
6 |
7 | import "fmt"
8 |
9 | type semver struct {
10 | major, minor, patch uint32
11 | }
12 |
13 | func semverCompatible(required, actual semver) bool {
14 | switch {
15 | case required.major != actual.major:
16 | return false
17 | case required.minor > actual.minor:
18 | return false
19 | case required.minor == actual.minor && required.patch > actual.patch:
20 | return false
21 | default:
22 | return true
23 | }
24 | }
25 |
26 | func (s semver) String() string {
27 | return fmt.Sprintf("%d.%d.%d", s.major, s.minor, s.patch)
28 | }
29 |
--------------------------------------------------------------------------------
/stakepooldclient/semver.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 The Decred 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 stakepooldclient
6 |
7 | import "fmt"
8 |
9 | type semver struct {
10 | major, minor, patch uint32
11 | }
12 |
13 | func semverCompatible(required, actual semver) bool {
14 | switch {
15 | case required.major != actual.major:
16 | return false
17 | case required.minor > actual.minor:
18 | return false
19 | case required.minor == actual.minor && required.patch > actual.patch:
20 | return false
21 | default:
22 | return true
23 | }
24 | }
25 |
26 | func (s semver) String() string {
27 | return fmt.Sprintf("%d.%d.%d", s.major, s.minor, s.patch)
28 | }
29 |
--------------------------------------------------------------------------------
/public/images/notifications/Ticket-failed.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/public/images/indicator-in-progress.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/public/images/notifications/Ticket-success.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/public/images/indicator-failed.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
--------------------------------------------------------------------------------
/.github/workflows/go.yml:
--------------------------------------------------------------------------------
1 | name: Build and Test
2 | on: [push, pull_request]
3 | jobs:
4 | build:
5 | name: Go CI
6 | runs-on: ubuntu-latest
7 | strategy:
8 | matrix:
9 | go: [1.14, 1.15]
10 | steps:
11 | - name: Set up Go
12 | uses: actions/setup-go@v2
13 | with:
14 | go-version: ${{ matrix.go }}
15 | - name: Check out source
16 | uses: actions/checkout@v2
17 | - name: Install Linters
18 | run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0"
19 | - name: Build
20 | env:
21 | GO111MODULE: "on"
22 | run: go build ./...
23 | - name: Test
24 | env:
25 | GO111MODULE: "on"
26 | run: |
27 | ./goclean.sh
28 |
--------------------------------------------------------------------------------
/internal/version/README.md:
--------------------------------------------------------------------------------
1 | version
2 | =======
3 |
4 | [](https://github.com/decred/dcrstakepool/actions)
5 | [](http://copyfree.org)
6 | [](https://pkg.go.dev/github.com/decred/dcrstakepool/internal/version)
7 |
8 | Package version provides a single location to house the version information for
9 | dcrstakepool and other utilities provided in the same repository.
10 |
11 | ## Installation and Updating
12 |
13 | This package is internal and therefore is neither directly installed nor needs
14 | to be manually updated.
15 |
16 | ## License
17 |
18 | Package version is licensed under the [copyfree](http://copyfree.org) ISC
19 | License.
20 |
--------------------------------------------------------------------------------
/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. go vet (http://golang.org/cmd/vet)
5 | # 3. gosimple (https://github.com/dominikh/go-simple)
6 | # 4. unconvert (https://github.com/mdempsky/unconvert)
7 | # 5. ineffassign (https://github.com/gordonklaus/ineffassign)
8 | # 6. race detector (http://blog.golang.org/race-detector)
9 | # 7. test coverage (http://blog.golang.org/cover)
10 |
11 | set -ex
12 |
13 | # run tests
14 | env GORACE="halt_on_error=1" go test -race ./...
15 |
16 | # golangci-lint (github.com/golangci/golangci-lint) is used to run each each
17 | # static checker.
18 |
19 | # check linters
20 | golangci-lint run --disable-all --deadline=10m \
21 | --enable=gofmt \
22 | --enable=vet \
23 | --enable=gosimple \
24 | --enable=unconvert \
25 | --enable=ineffassign
26 |
--------------------------------------------------------------------------------
/models/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 models
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/signal/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 signal
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/system/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 system
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/controllers/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 controllers
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/stakepooldclient/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 stakepooldclient
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/backend/stakepoold/rpc/server/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 server
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/backend/stakepoold/stakepool/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 stakepool
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/backend/stakepoold/userdata/log.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013-2015 The btcsuite developers
2 | // Copyright (c) 2018 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 userdata
7 |
8 | import "github.com/decred/slog"
9 |
10 | // log is a logger that is initialized with no output filters. This
11 | // means the package will not perform any logging by default until the caller
12 | // requests it.
13 | var log = slog.Disabled
14 |
15 | // DisableLog disables all library log output. Logging output is disabled
16 | // by default until either UseLogger or SetLogWriter are called.
17 | func DisableLog() {
18 | log = slog.Disabled
19 | }
20 |
21 | // UseLogger uses a specified Logger to output package logging info.
22 | // This should be used in preference to SetLogWriter if the caller is also
23 | // using slog.
24 | func UseLogger(logger slog.Logger) {
25 | log = logger
26 | }
27 |
--------------------------------------------------------------------------------
/views/error.html:
--------------------------------------------------------------------------------
1 | {{define "error"}}
2 |
3 |
11 | {{if .RateLimited}}
12 | Your request has been rate limited to lighten the load on the servers. Please retry your request.
13 | {{else}}
14 | An error occurred. Please retry your request or contact the VSP admin if the error continues. Wallets are still online and voting.
15 | {{end}}
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | {{end}}
24 |
--------------------------------------------------------------------------------
/sample-dcrwallet.conf:
--------------------------------------------------------------------------------
1 | ; Derive 10000 addresses from the specified extended public key for use
2 | ; as user's payment addresses to the cold wallet/fee collecting wallet.
3 | ; xpub portion needs to match coldwalletextpub from dcrstakepool configuration.
4 | ; The amount of addresses MUST be set to 10000. This limitation will be removed
5 | ; in a future release.
6 | ;stakepoolcoldextkey=xpub:10000
7 |
8 | ; Fees as a percentage. 7.5 = 7.5%. Precision of 2, 7.99 = 7.99%.
9 | ; Needs to match dcrstakepool's configuration.
10 | ;poolfees=7.5
11 |
12 | ; Probably need this but depends on your setup.
13 | ;rpclisten=0.0.0.0
14 |
15 | ; Debug is very useful to see more activity.
16 | debuglevel=debug
17 |
18 | ; stakepoold will do the voting, dcrwallet should not vote.
19 | enablevoting=0
20 |
21 | ; Useful to make sure the wallet is unlocked at startup.
22 | promptpass=1
23 |
24 | ; Stay on testnet until everything is well tested.
25 | testnet=1
26 |
27 | ; RPC auth stuff.
28 | ;username=user
29 | ;password=pass
30 | ;dcrdusername=user
31 | ;dcrdpassword=pass
32 |
--------------------------------------------------------------------------------
/public/images/notifications/ticketVoted-1.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/public/images/notifications/ticketVoted.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/backend/stakepoold/README.md:
--------------------------------------------------------------------------------
1 | stakepoold
2 | ====
3 |
4 | The goal of stakepoold is to communicate with dcrd/dcrwallet/dcrstakepool via client/server gRPC in order to handle all stakepool functions that are currently in dcrwallet or are undefined/unhandled.
5 |
6 | ## First:
7 |
8 | Receive, store, and act on (vote) per-user voting policy from dcrstakepool.
9 |
10 | #### Steps
11 |
12 | 1. stakepoold skeleton code with testnet/mainnet flags with per-network vote version
13 | 2. wire up stakepoold to get notified of winners, set votebits according to prefs/vote version, ask wallet to sign, send
14 | 3. add user voting policy interface to dcrstakepool
15 | 4. send dcrstakepool user voting policy config to stakepoold and store it
16 |
17 | ## Second:
18 |
19 | Rip out all stakepool-related configuration from the wallet. (ticket adding, multisig scripts, fee checking, votebits modification RPCs)
20 |
21 | #### Steps
22 |
23 | 1. Migrate the rest of the stakepool-related functionality from wallet to stakepoold.
24 | 2. Modify dcrstakepool to cope with changes. dcrstakepool should not need to talk to dcrwallet directly anymore.
--------------------------------------------------------------------------------
/public/images/group-1079.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/public/images/favicon/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Decred",
3 | "icons": [
4 | {
5 | "src": "/assets/images/favicon/ic_launcher_mdpi.png?v=vMddPLeYWy",
6 | "sizes": "48x48",
7 | "type": "image/png"
8 | },
9 | {
10 | "src": "/assets/images/favicon/ic_launcher_hdpi.png?v=vMddPLeYWy",
11 | "sizes": "72x72",
12 | "type": "image/png"
13 | },
14 | {
15 | "src": "/assets/images/favicon/ic_launcher_xhdpi.png?v=vMddPLeYWy",
16 | "sizes": "96x96",
17 | "type": "image/png"
18 | },
19 | {
20 | "src": "/assets/images/favicon/ic_launcher_xxhdpi.png?v=vMddPLeYWy",
21 | "sizes": "144x144",
22 | "type": "image/png"
23 | },
24 | {
25 | "src": "/assets/images/favicon/ic_launcher_xxxhdpi.png?v=vMddPLeYWy",
26 | "sizes": "192x192",
27 | "type": "image/png"
28 | }
29 | ],
30 | "theme_color": "#091440",
31 | "background_color": "#091440",
32 | "start_url": "/",
33 | "display": "browser"
34 | }
35 |
--------------------------------------------------------------------------------
/public/images/group-511.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/public/images/symbol-5-1.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/helpers/address.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 The Decred 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 helpers
6 |
7 | import (
8 | "github.com/decred/dcrd/chaincfg/v3"
9 | "github.com/decred/dcrd/dcrec"
10 | "github.com/decred/dcrd/dcrutil/v3"
11 | "github.com/decred/dcrd/hdkeychain/v3"
12 | )
13 |
14 | const (
15 | // ExternalBranch is a helper value that needs to
16 | // match dcrwallet's udb.ExternalBranch
17 | ExternalBranch uint32 = 0
18 | )
19 |
20 | // DCRUtilAddressFromExtendedKey parses the public address of a hd extended key
21 | // using a secp256k1 elliptic curve into a ECDSA public key, compresses it using
22 | // ripemd160, and wraps it in a dcrutil AddressPubKeyHash in order to easily
23 | // obtain its human readable formats. Returns an error upon a parsing error or
24 | // if key is for the wrong network.
25 | func DCRUtilAddressFromExtendedKey(key *hdkeychain.ExtendedKey, params *chaincfg.Params) (*dcrutil.AddressPubKeyHash, error) {
26 | return dcrutil.NewAddressPubKeyHash(dcrutil.Hash160(key.SerializedPubKey()), params, dcrec.STEcdsaSecp256k1)
27 | }
28 |
--------------------------------------------------------------------------------
/public/images/group-1120.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/public/images/wallet-icon.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/zipassets.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # This script helps prepare pre-zipped static assets for use with reverse proxy
4 | # features like nginx's gzip_static.
5 |
6 | echo "Gzipping assets for use with gzip_static..."
7 | find ./public -type f -name "*.gz" -execdir rm {} \;
8 | # Use GNU parallel if it is installed.
9 | if [ -x "$(command -v parallel)" ]; then
10 | if [ -x "$(command -v 7za)" ]; then
11 | find ./public -type f -not -name "*.gz" | parallel --will-cite --bar 7za a -tgzip -mx=9 -mpass=13 {}.gz {} > /dev/null
12 | else
13 | find ./public -type f -not -name "*.gz" | parallel --will-cite --bar gzip -k9f {} > /dev/null
14 | fi
15 | elif [ -x "$(command -v 7za)" ]; then
16 | find ./public -type f -not -name "*.gz" -execdir 7za a -tgzip -mx=9 -mpass=13 {}.gz {} \; > /dev/null
17 | else
18 | find ./public -type f -not -name "*.gz" -execdir gzip -k9f {} \; > /dev/null
19 | fi
20 |
21 | # Clean up incompressible files.
22 | find ./public -type f -name "*.png.gz" -execdir rm {} \;
23 | find ./public -type f -name "*.eot.gz" -execdir rm {} \;
24 | find ./public -type f -name "*.gz.gz" -execdir rm {} \;
25 | find ./public -type f -name "*.woff*.gz" -execdir rm {} \;
26 |
--------------------------------------------------------------------------------
/views/passwordreset.html:
--------------------------------------------------------------------------------
1 | {{define "passwordreset"}}
2 |
3 |