Rename to vspd. (#75)
This commit is contained in:
parent
d5c949b9ad
commit
67dece7041
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
dcrvsp
|
||||
vspd
|
||||
/database/test.db
|
||||
|
||||
28
README.md
28
README.md
@ -1,20 +1,20 @@
|
||||
# dcrvsp
|
||||
# vspd
|
||||
|
||||
[](https://github.com/jholdstock/dcrvsp/actions)
|
||||
[](https://github.com/jholdstock/vspd/actions)
|
||||
[](http://copyfree.org)
|
||||
[](https://goreportcard.com/report/github.com/jholdstock/dcrvsp)
|
||||
[](https://goreportcard.com/report/github.com/jholdstock/vspd)
|
||||
|
||||
## Overview
|
||||
|
||||
dcrvsp is a from scratch implementation of a Voting Service Provider (VSP) for
|
||||
vspd is a from scratch implementation of a Voting Service Provider (VSP) for
|
||||
the Decred network.
|
||||
|
||||
A VSP running dcrvsp can be used to vote on any ticket - tickets do not need to
|
||||
A VSP running vspd can be used to vote on any ticket - tickets do not need to
|
||||
be purchased with any special conditions such as dedicated outputs for paying
|
||||
VSP fees. Fees are paid directly to the VSP with an independent on-chain
|
||||
transaction.
|
||||
|
||||
To use dcrvsp, ticket holders must prove ownership of their ticket with a
|
||||
To use vspd, ticket holders must prove ownership of their ticket with a
|
||||
cryptographic signature, pay the fee requested by the VSP, and submit a private
|
||||
key which enables the VSP to vote the ticket. Once this process is complete the
|
||||
VSP will add the ticket to a pool of always-online voting wallets.
|
||||
@ -26,8 +26,8 @@ VSP will add the ticket to a pool of always-online voting wallets.
|
||||
|
||||
- **Web front-end** - A minimal, static, website providing pool stats.
|
||||
|
||||
- **Two-way accountability** - All dcrvsp requests must be signed with a private
|
||||
key corresponding to the relevant ticket, and all dcrvsp responses are signed
|
||||
- **Two-way accountability** - All vspd requests must be signed with a private
|
||||
key corresponding to the relevant ticket, and all vspd responses are signed
|
||||
by with a private key known only by the server. This enables both the client
|
||||
and the server to prove to outside observers if their counterparty is
|
||||
misbehaving. For more detail, and examples, read
|
||||
@ -40,7 +40,7 @@ VSP will add the ticket to a pool of always-online voting wallets.
|
||||
|
||||
## Implementation
|
||||
|
||||
dcrvsp is built and tested on go 1.13 and 1.14, making use of the following
|
||||
vspd is built and tested on go 1.13 and 1.14, making use of the following
|
||||
libraries:
|
||||
|
||||
- [gin-gonic/gin](https://github.com/gin-gonic/gin) webserver.
|
||||
@ -52,14 +52,14 @@ libraries:
|
||||
|
||||
## Deployment
|
||||
|
||||
- Single server running dcrvsp and dcrd. dcrd on this server is used for fishing
|
||||
- Single server running vspd and dcrd. dcrd on this server is used for fishing
|
||||
ticket details out of the chain, and for broadcasting and checking the status
|
||||
of fee transactions. `--txindex` is required so `getrawtransaction` can be
|
||||
used.
|
||||
|
||||
- A xpub key is provided to dcrvsp via config. dcrvsp will use this key to
|
||||
- A xpub key is provided to vspd via config. vspd will use this key to
|
||||
derive a new addresses for each fee payments. It is recommended to export an
|
||||
xpub from a cold wallet which is not a part of the dcrvsp deployment.
|
||||
xpub from a cold wallet which is not a part of the vspd deployment.
|
||||
|
||||
- Multiple remote voting servers, each running dcrwallet and dcrd. dcrwallet on
|
||||
these servers should be constantly unlocked and have voting enabled. Three
|
||||
@ -71,9 +71,9 @@ libraries:
|
||||
|
||||
## Issue Tracker
|
||||
|
||||
The [integrated github issue tracker](https://github.com/jholdstock/dcrvsp/issues)
|
||||
The [integrated github issue tracker](https://github.com/jholdstock/vspd/issues)
|
||||
is used for this project.
|
||||
|
||||
## License
|
||||
|
||||
dcrvsp is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
vspd is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
|
||||
"decred.org/dcrwallet/rpc/client/dcrd"
|
||||
"github.com/decred/dcrd/chaincfg/v3"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
)
|
||||
|
||||
type NotificationHandler struct {
|
||||
@ -195,7 +195,7 @@ func (n *NotificationHandler) connect(dcrdConnect rpc.Connect) error {
|
||||
|
||||
log.Info("Subscribed for dcrd block notifications")
|
||||
|
||||
// Wait until context is done (dcrvsp is shutting down), or until the
|
||||
// Wait until context is done (vspd is shutting down), or until the
|
||||
// notifier is closed.
|
||||
select {
|
||||
case <-n.Ctx.Done():
|
||||
@ -216,7 +216,7 @@ func Start(n *NotificationHandler, dcrdConnect rpc.Connect) {
|
||||
if err != nil {
|
||||
log.Errorf("dcrd connect error: %v", err)
|
||||
|
||||
// If context is done (dcrvsp is shutting down), return,
|
||||
// If context is done (vspd is shutting down), return,
|
||||
// otherwise wait 15 seconds and to reconnect.
|
||||
select {
|
||||
case <-n.Ctx.Done():
|
||||
|
||||
10
config.go
10
config.go
@ -21,8 +21,8 @@ var (
|
||||
defaultLogLevel = "debug"
|
||||
defaultVSPFee = 0.05
|
||||
defaultNetwork = "testnet"
|
||||
defaultHomeDir = dcrutil.AppDataDir("dcrvsp", false)
|
||||
defaultConfigFilename = "dcrvsp.conf"
|
||||
defaultHomeDir = dcrutil.AppDataDir("vspd", false)
|
||||
defaultConfigFilename = "vspd.conf"
|
||||
defaultConfigFile = filepath.Join(defaultHomeDir, defaultConfigFilename)
|
||||
defaultDcrdHost = "127.0.0.1"
|
||||
defaultWalletHost = "127.0.0.1"
|
||||
@ -38,7 +38,7 @@ type config struct {
|
||||
VSPFee float64 `long:"vspfee" ini-name:"vspfee" description:"Fee percentage charged for VSP use. eg. 0.01 (1%), 0.05 (5%)."`
|
||||
HomeDir string `long:"homedir" ini-name:"homedir" no-ini:"true" description:"Path to application home directory. Used for storing VSP database and logs."`
|
||||
ConfigFile string `long:"configfile" ini-name:"configfile" no-ini:"true" description:"Path to configuration file."`
|
||||
DcrdHost string `long:"dcrdhost" ini-name:"dcrdhost" description:"The ip:port to establish a JSON-RPC connection with dcrd. Should be the same host where dcrvsp is running."`
|
||||
DcrdHost string `long:"dcrdhost" ini-name:"dcrdhost" description:"The ip:port to establish a JSON-RPC connection with dcrd. Should be the same host where vspd is running."`
|
||||
DcrdUser string `long:"dcrduser" ini-name:"dcrduser" description:"Username for dcrd RPC connections."`
|
||||
DcrdPass string `long:"dcrdpass" ini-name:"dcrdpass" description:"Password for dcrd RPC connections."`
|
||||
DcrdCert string `long:"dcrdcert" ini-name:"dcrdcert" description:"The dcrd RPC certificate file."`
|
||||
@ -136,7 +136,7 @@ func normalizeAddress(addr, defaultPort string) string {
|
||||
// 3) Load configuration file overwriting defaults with any specified options
|
||||
// 4) Parse CLI options and overwrite/add any specified options
|
||||
//
|
||||
// The above results in dcrvsp functioning properly without any config settings
|
||||
// The above results in vspd functioning properly without any config settings
|
||||
// while still allowing the user to override settings with config files and
|
||||
// command line options. Command line options always take precedence.
|
||||
func loadConfig() (*config, error) {
|
||||
@ -303,7 +303,7 @@ func loadConfig() (*config, error) {
|
||||
|
||||
// Initialize loggers and log rotation.
|
||||
logDir := filepath.Join(cfg.HomeDir, "logs", cfg.netParams.Name)
|
||||
initLogRotator(filepath.Join(logDir, "dcrvsp.log"))
|
||||
initLogRotator(filepath.Join(logDir, "vspd.log"))
|
||||
setLogLevels(cfg.LogLevel)
|
||||
|
||||
// Set the database path
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
of truth:
|
||||
- bbolt does not have the sys admin overhead associated with maintaining a
|
||||
MySQL database. The database will be automatically created and maintained
|
||||
by dcrvsp.
|
||||
- The bbolt database is only accessed by dcrvsp. There is no need to open
|
||||
by vspd.
|
||||
- The bbolt database is only accessed by vspd. There is no need to open
|
||||
additional ports on your front-end server for the voting wallets to access
|
||||
the database.
|
||||
- Voting wallet servers require only dcrwallet and dcrd. There is no longer a
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Two-way Accountability
|
||||
|
||||
- When dcrvsp is started for the first time, it generates a ed25519 keypair and
|
||||
- When vspd is started for the first time, it generates a ed25519 keypair and
|
||||
stores it in the database. This key is used to sign all API responses, and the
|
||||
signature is included in the response header `VSP-Server-Signature`.
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/jholdstock/dcrvsp
|
||||
module github.com/jholdstock/vspd
|
||||
|
||||
go 1.13
|
||||
|
||||
|
||||
8
log.go
8
log.go
@ -8,10 +8,10 @@ import (
|
||||
"github.com/decred/slog"
|
||||
"github.com/jrick/logrotate/rotator"
|
||||
|
||||
"github.com/jholdstock/dcrvsp/background"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/dcrvsp/webapi"
|
||||
"github.com/jholdstock/vspd/background"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
"github.com/jholdstock/vspd/webapi"
|
||||
)
|
||||
|
||||
// logWriter implements an io.Writer that outputs to both standard output and
|
||||
|
||||
8
main.go
8
main.go
@ -8,10 +8,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/jholdstock/dcrvsp/background"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/dcrvsp/webapi"
|
||||
"github.com/jholdstock/vspd/background"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
"github.com/jholdstock/vspd/webapi"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"github.com/decred/dcrd/dcrutil/v3"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
)
|
||||
|
||||
// addrMtx protects getNewFeeAddress.
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
)
|
||||
|
||||
type ticketHashRequest struct {
|
||||
|
||||
@ -11,8 +11,8 @@ import (
|
||||
"github.com/decred/dcrd/wire"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
)
|
||||
|
||||
// payFee is the handler for "POST /payfee".
|
||||
|
||||
@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
)
|
||||
|
||||
// setVoteChoices is the handler for "POST /setvotechoices".
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<title>dcrwages</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/public/css/fonts.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/public/css/dcrvsp.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/public/css/vspd.css" />
|
||||
|
||||
<!-- Custom favicon -->
|
||||
<!-- Apple PWA -->
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
)
|
||||
|
||||
// ticketStatus is the handler for "GET /ticketstatus".
|
||||
|
||||
@ -11,8 +11,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/jholdstock/dcrvsp/database"
|
||||
"github.com/jholdstock/dcrvsp/rpc"
|
||||
"github.com/jholdstock/vspd/database"
|
||||
"github.com/jholdstock/vspd/rpc"
|
||||
|
||||
"github.com/decred/dcrd/chaincfg/v3"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -118,7 +118,7 @@ func Start(ctx context.Context, requestShutdownChan chan struct{}, shutdownWg *s
|
||||
go func() {
|
||||
err = srv.Serve(listener)
|
||||
// If the server dies for any reason other than ErrServerClosed (from
|
||||
// graceful server.Shutdown), log the error and request dcrvsp be
|
||||
// graceful server.Shutdown), log the error and request vspd be
|
||||
// shutdown.
|
||||
if err != nil && err != http.ErrServerClosed {
|
||||
log.Errorf("Unexpected webserver error: %v", err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user