From 67dece70411b9c82ddecacb261b43e0e102f6909 Mon Sep 17 00:00:00 2001 From: Jamie Holdstock Date: Wed, 27 May 2020 15:59:30 +0100 Subject: [PATCH] Rename to vspd. (#75) --- .gitignore | 2 +- README.md | 28 +++++++++++----------- background/background.go | 8 +++---- config.go | 10 ++++---- docs/ANN.md | 4 ++-- docs/two-way-accountability.md | 2 +- go.mod | 2 +- log.go | 8 +++---- main.go | 8 +++---- webapi/getfeeaddress.go | 4 ++-- webapi/middleware.go | 2 +- webapi/payfee.go | 4 ++-- webapi/public/css/{dcrvsp.css => vspd.css} | 0 webapi/setvotechoices.go | 4 ++-- webapi/templates/homepage.html | 2 +- webapi/ticketstatus.go | 2 +- webapi/webapi.go | 6 ++--- 17 files changed, 48 insertions(+), 48 deletions(-) rename webapi/public/css/{dcrvsp.css => vspd.css} (100%) diff --git a/.gitignore b/.gitignore index 963d265..6cef2bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -dcrvsp +vspd /database/test.db diff --git a/README.md b/README.md index 92edbd9..47943d7 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -# dcrvsp +# vspd -[![Build Status](https://github.com/jholdstock/dcrvsp/workflows/Build%20and%20Test/badge.svg)](https://github.com/jholdstock/dcrvsp/actions) +[![Build Status](https://github.com/jholdstock/vspd/workflows/Build%20and%20Test/badge.svg)](https://github.com/jholdstock/vspd/actions) [![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -[![Go Report Card](https://goreportcard.com/badge/github.com/jholdstock/dcrvsp)](https://goreportcard.com/report/github.com/jholdstock/dcrvsp) +[![Go Report Card](https://goreportcard.com/badge/github.com/jholdstock/vspd)](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. diff --git a/background/background.go b/background/background.go index 83714a8..41ded76 100644 --- a/background/background.go +++ b/background/background.go @@ -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(): diff --git a/config.go b/config.go index 7c6e429..e8f9e42 100644 --- a/config.go +++ b/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 diff --git a/docs/ANN.md b/docs/ANN.md index eec32dd..eefac43 100644 --- a/docs/ANN.md +++ b/docs/ANN.md @@ -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 diff --git a/docs/two-way-accountability.md b/docs/two-way-accountability.md index d09be4f..1f94e6c 100644 --- a/docs/two-way-accountability.md +++ b/docs/two-way-accountability.md @@ -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`. diff --git a/go.mod b/go.mod index 8beb692..b14a3c1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/jholdstock/dcrvsp +module github.com/jholdstock/vspd go 1.13 diff --git a/log.go b/log.go index ed3fd97..3a9f017 100644 --- a/log.go +++ b/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 diff --git a/main.go b/main.go index 540e69d..4d333a1 100644 --- a/main.go +++ b/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 ( diff --git a/webapi/getfeeaddress.go b/webapi/getfeeaddress.go index 6edc04e..abc13f9 100644 --- a/webapi/getfeeaddress.go +++ b/webapi/getfeeaddress.go @@ -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. diff --git a/webapi/middleware.go b/webapi/middleware.go index 26db2dd..0d53095 100644 --- a/webapi/middleware.go +++ b/webapi/middleware.go @@ -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 { diff --git a/webapi/payfee.go b/webapi/payfee.go index 5fc3347..d5b7cf3 100644 --- a/webapi/payfee.go +++ b/webapi/payfee.go @@ -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". diff --git a/webapi/public/css/dcrvsp.css b/webapi/public/css/vspd.css similarity index 100% rename from webapi/public/css/dcrvsp.css rename to webapi/public/css/vspd.css diff --git a/webapi/setvotechoices.go b/webapi/setvotechoices.go index 044ade8..e04dc71 100644 --- a/webapi/setvotechoices.go +++ b/webapi/setvotechoices.go @@ -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". diff --git a/webapi/templates/homepage.html b/webapi/templates/homepage.html index be2054d..37d46a8 100644 --- a/webapi/templates/homepage.html +++ b/webapi/templates/homepage.html @@ -7,7 +7,7 @@ dcrwages - + diff --git a/webapi/ticketstatus.go b/webapi/ticketstatus.go index 7bd049d..803d0cb 100644 --- a/webapi/ticketstatus.go +++ b/webapi/ticketstatus.go @@ -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". diff --git a/webapi/webapi.go b/webapi/webapi.go index 9dc6dc3..dd1c863 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -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)