diff --git a/cmd/genseed/README.md b/cmd/genseed/README.md new file mode 100644 index 000000000..7dd937f0c --- /dev/null +++ b/cmd/genseed/README.md @@ -0,0 +1 @@ +generateseed returns a cryptographically secure random seed in either mnemonic or its hexadecimal form. diff --git a/cmd/genseed/generateseed.go b/cmd/genseed/generateseed.go new file mode 100755 index 000000000..ccf1f915b --- /dev/null +++ b/cmd/genseed/generateseed.go @@ -0,0 +1,39 @@ +package main + +import ( + "encoding/hex" + "flag" + "fmt" + "github.com/decred/dcrwallet/walletseed" + "os" +) + +var ( + s = flag.Bool("mne", false, "Optional command line argument to print as seed as a mnemonic phrase rather then its hexadecimal form") +<<<<<<< HEAD + b = flag.Uint("size", 32, "Optional command line argument to print a seed as a certian size. The default size is 32 and recommended size is between 16 and 64. Anything under 16 or 64 will cause the program to crash") + m = flag.Bool("master", false, "Optional command line argument to print master key of the created seed.") +======= + b = flag.Uint("size", 32, "Optional command line argument to print a seed as a certain size. The default size is 32 and recommended size is between 16 and 64. Anything under 16 or 64 will cause the program to crash") +>>>>>>> 18c275e... genseed: add tool to cmd that generates a seed +) + +func main() { + flag.Parse() + + sb, err := walletseed.GenerateRandomSeed(*b) + if err != nil { + fmt.Print(err) + os.Exit(1) + } + + var seedString string + if *s { + seedString = walletseed.EncodeMnemonic(sb) + fmt.Printf("%v\n", seedString) + os.Exit(1) + } + + seedString = hex.EncodeToString(sb) + fmt.Printf("%v\n", seedString) +} diff --git a/cmd/genseed/generateseedtest.sh b/cmd/genseed/generateseedtest.sh new file mode 100755 index 000000000..c1c712643 --- /dev/null +++ b/cmd/genseed/generateseedtest.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +<<<<<<< HEAD +======= +# ./genseed creates a seed in either mnemonic or its hexadecimal form. +# by default a hexidecimal seed is created +# form of the seed can be changed by setting --mne=true +# size of the seed can be changed by setting --size= + +FILE="genseed" +if [[ ! -f "$FILE" ]]; then + go build +fi +>>>>>>> 18c275e... genseed: add tool to cmd that generates a seed + +# Test 1: generateseed with no options +SEED=$(./genseed) +if [[ ${#SEED} -gt 64 || ${#SEED} -lt 16 ]]; then + echo "test 1 failed" + exit 1 +fi +<<<<<<< HEAD +======= +echo test 1 outcome "$SEED" +>>>>>>> 18c275e... genseed: add tool to cmd that generates a seed + +# Test 2: generateseed with option --mne set as true, and --size as 64 +PARAMS=$(echo \ + "--mne=true" \ + "--size=64" +) + +SEED2=$(./genseed $PARAMS) +if [[ $(echo ${#SEED2} | wc -c) -gt 500 ]]; then + echo "test 2 failed" + exit 1 +fi +<<<<<<< HEAD +======= +echo "test 2 outcome: $SEED2" +>>>>>>> 18c275e... genseed: add tool to cmd that generates a seed diff --git a/cmd/genseed/genseed b/cmd/genseed/genseed new file mode 100755 index 000000000..6c9ba50a8 Binary files /dev/null and b/cmd/genseed/genseed differ diff --git a/dcrwallet.log b/dcrwallet.log new file mode 100644 index 000000000..7ed83734b --- /dev/null +++ b/dcrwallet.log @@ -0,0 +1,220 @@ +Sending build context to Docker daemon 125.4MB +Step 1/11 : FROM golang:1.13-alpine as builder + ---> 3024b4e742b0 +Step 2/11 : WORKDIR /go/src/github.com/decred/dcrwallet + ---> Using cache + ---> d46b40396d01 +Step 3/11 : COPY . . + ---> fca7fb3f4849 +Step 4/11 : RUN apk add --no-cache --update alpine-sdk && mkdir -p go/bin && go install + ---> Running in d2e681a9b021 +fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz +fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz +(1/37) Installing fakeroot (1.23-r0) +(2/37) Installing sudo (1.8.27-r0) +(3/37) Installing libcap (2.27-r0) +(4/37) Installing pax-utils (1.2.3-r0) +(5/37) Installing openssl (1.1.1d-r0) +(6/37) Installing libattr (2.4.48-r0) +(7/37) Installing attr (2.4.48-r0) +(8/37) Installing tar (1.32-r0) +(9/37) Installing pkgconf (1.6.1-r1) +(10/37) Installing patch (2.7.6-r6) +(11/37) Installing libgcc (8.3.0-r0) +(12/37) Installing libstdc++ (8.3.0-r0) +(13/37) Installing lzip (1.21-r0) +(14/37) Installing nghttp2-libs (1.39.2-r0) +(15/37) Installing libcurl (7.66.0-r0) +(16/37) Installing curl (7.66.0-r0) +(17/37) Installing abuild (3.4.0-r0) +Executing abuild-3.4.0-r0.pre-install +(18/37) Installing binutils (2.32-r0) +(19/37) Installing libmagic (5.37-r1) +(20/37) Installing file (5.37-r1) +(21/37) Installing gmp (6.1.2-r1) +(22/37) Installing isl (0.18-r0) +(23/37) Installing libgomp (8.3.0-r0) +(24/37) Installing libatomic (8.3.0-r0) +(25/37) Installing mpfr3 (3.1.5-r1) +(26/37) Installing mpc1 (1.1.0-r0) +(27/37) Installing gcc (8.3.0-r0) +(28/37) Installing musl-dev (1.1.22-r3) +(29/37) Installing libc-dev (0.7.1-r0) +(30/37) Installing g++ (8.3.0-r0) +(31/37) Installing make (4.2.1-r2) +(32/37) Installing fortify-headers (1.1-r0) +(33/37) Installing build-base (0.5-r1) +(34/37) Installing expat (2.2.8-r0) +(35/37) Installing pcre2 (10.33-r0) +(36/37) Installing git (2.22.0-r0) +(37/37) Installing alpine-sdk (1.0-r0) +Executing busybox-1.30.1-r2.trigger +OK: 182 MiB in 52 packages +go: downloading github.com/decred/dcrd/dcrec v1.0.0 +go: downloading github.com/decred/dcrd/wire v1.3.0 +go: downloading google.golang.org/grpc v1.22.0 +go: downloading github.com/decred/dcrd/blockchain/standalone v1.1.0 +go: downloading github.com/decred/dcrd/connmgr v1.0.2 +go: downloading github.com/decred/go-socks v1.0.1-0.20191001171050-775b73941e73 +go: downloading github.com/jrick/logrotate v1.0.0 +go: downloading decred.org/cspp v0.1.3 +go: downloading github.com/decred/dcrd/addrmgr v1.0.2 +go: extracting github.com/decred/dcrd/dcrec v1.0.0 +go: downloading github.com/decred/dcrd/chaincfg v1.5.2 +go: extracting github.com/decred/dcrd/wire v1.3.0 +go: extracting github.com/decred/dcrd/addrmgr v1.0.2 +go: downloading github.com/decred/dcrd/txscript v1.1.0 +go: downloading github.com/decred/dcrd/gcs v1.1.0 +go: extracting github.com/jrick/logrotate v1.0.0 +go: extracting github.com/decred/dcrd/connmgr v1.0.2 +go: extracting decred.org/cspp v0.1.3 +go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58 +go: extracting github.com/decred/dcrd/blockchain/standalone v1.1.0 +go: extracting github.com/decred/go-socks v1.0.1-0.20191001171050-775b73941e73 +go: downloading github.com/decred/dcrd/rpc/jsonrpc/types v1.0.1 +go: extracting github.com/decred/dcrd/chaincfg v1.5.2 +go: downloading github.com/decred/dcrd/chaincfg/chainhash v1.0.2 +go: downloading github.com/decred/dcrd/chaincfg/v2 v2.3.0 +go: downloading github.com/decred/dcrd/blockchain/stake v1.2.1 +go: extracting github.com/decred/dcrd/gcs v1.1.0 +go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58 +go: downloading github.com/decred/dcrd/connmgr/v2 v2.0.0 +go: downloading github.com/decred/dcrd/hdkeychain/v2 v2.1.0 +go: extracting github.com/decred/dcrd/chaincfg/chainhash v1.0.2 +go: extracting github.com/decred/dcrd/rpc/jsonrpc/types v1.0.1 +go: downloading github.com/decred/dcrd/dcrec/secp256k1 v1.0.2 +go: downloading golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 +go: extracting github.com/decred/dcrd/txscript v1.1.0 +go: downloading github.com/decred/dcrd/txscript/v2 v2.1.0 +go: extracting github.com/decred/dcrd/chaincfg/v2 v2.3.0 +go: extracting google.golang.org/grpc v1.22.0 +go: downloading github.com/decred/dcrd/certgen v1.1.0 +go: downloading github.com/jessevdk/go-flags v1.4.0 +go: extracting github.com/decred/dcrd/connmgr/v2 v2.0.0 +go: downloading github.com/gorilla/websocket v1.4.1 +go: downloading github.com/decred/dcrd/crypto/blake256 v1.0.0 +go: downloading github.com/dchest/blake256 v1.0.0 +go: extracting github.com/decred/dcrd/hdkeychain/v2 v2.1.0 +go: downloading go.etcd.io/bbolt v1.3.3 +go: extracting github.com/decred/dcrd/blockchain/stake v1.2.1 +go: extracting github.com/decred/dcrd/dcrec/secp256k1 v1.0.2 +go: downloading github.com/decred/dcrd/blockchain/stake/v2 v2.0.2 +go: extracting github.com/decred/dcrd/txscript/v2 v2.1.0 +go: extracting github.com/decred/dcrd/certgen v1.1.0 +go: downloading github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0 +go: downloading github.com/dchest/siphash v1.2.1 +go: extracting github.com/jessevdk/go-flags v1.4.0 +go: downloading github.com/jrick/wsrpc/v2 v2.1.5 +go: extracting github.com/decred/dcrd/crypto/blake256 v1.0.0 +go: extracting github.com/dchest/blake256 v1.0.0 +go: downloading github.com/decred/base58 v1.0.1 +go: downloading github.com/decred/dcrd/dcrjson/v3 v3.0.1 +go: extracting github.com/gorilla/websocket v1.4.1 +go: extracting go.etcd.io/bbolt v1.3.3 +go: downloading github.com/decred/dcrd/dcrec/edwards v1.0.0 +go: downloading github.com/jrick/bitset v1.0.0 +go: extracting golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 +go: extracting github.com/decred/dcrd/blockchain/stake/v2 v2.0.2 +go: downloading github.com/decred/slog v1.0.0 +go: extracting github.com/dchest/siphash v1.2.1 +go: downloading github.com/decred/dcrd/database v1.1.0 +go: extracting github.com/jrick/wsrpc/v2 v2.1.5 +go: downloading github.com/decred/dcrd/dcrutil v1.4.0 +go: downloading github.com/golang/protobuf v1.3.2 +go: extracting github.com/decred/base58 v1.0.1 +go: extracting github.com/decred/slog v1.0.0 +go: extracting github.com/decred/dcrd/dcrutil v1.4.0 +go: downloading golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 +go: extracting github.com/decred/dcrd/dcrjson/v3 v3.0.1 +go: extracting github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0 +go: extracting github.com/jrick/bitset v1.0.0 +go: downloading github.com/decred/dcrd/dcrutil/v2 v2.0.1 +go: extracting github.com/decred/dcrd/dcrec/edwards v1.0.0 +go: downloading golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 +go: downloading google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 +go: downloading github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 +go: extracting github.com/decred/dcrd/database v1.1.0 +go: downloading github.com/decred/dcrd/database/v2 v2.0.1 +go: downloading github.com/decred/dcrd/crypto/ripemd160 v1.0.0 +go: extracting golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 +go: extracting github.com/decred/dcrd/dcrutil/v2 v2.0.1 +go: extracting github.com/golang/protobuf v1.3.2 +go: downloading golang.org/x/sys v0.0.0-20191010194322-b09406accb47 +go: extracting github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 +go: extracting github.com/decred/dcrd/crypto/ripemd160 v1.0.0 +go: downloading github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 +go: extracting github.com/decred/dcrd/database/v2 v2.0.1 +go: extracting github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 +go: extracting google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 +go: extracting golang.org/x/sys v0.0.0-20191010194322-b09406accb47 +go: extracting golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 +go: downloading golang.org/x/text v0.3.2 +go: extracting golang.org/x/text v0.3.2 +go: finding github.com/decred/dcrd/certgen v1.1.0 +go: finding github.com/decred/dcrd/chaincfg/v2 v2.3.0 +go: finding github.com/decred/dcrd/dcrutil/v2 v2.0.1 +go: finding github.com/decred/dcrd/chaincfg/chainhash v1.0.2 +go: finding golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 +go: finding github.com/decred/dcrd/addrmgr v1.0.2 +go: finding github.com/decred/dcrd/hdkeychain/v2 v2.1.0 +go: finding github.com/decred/slog v1.0.0 +go: finding github.com/decred/dcrd/wire v1.3.0 +go: finding github.com/decred/base58 v1.0.1 +go: finding github.com/decred/dcrd/connmgr v1.0.2 +go: finding github.com/decred/dcrd/crypto/blake256 v1.0.0 +go: finding github.com/decred/dcrd/connmgr/v2 v2.0.0 +go: finding golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 +go: finding github.com/decred/dcrd/crypto/ripemd160 v1.0.0 +go: finding github.com/decred/dcrd/dcrec v1.0.0 +go: finding go.etcd.io/bbolt v1.3.3 +go: finding decred.org/cspp v0.1.3 +go: finding github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0 +go: finding golang.org/x/sys v0.0.0-20191010194322-b09406accb47 +go: finding github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.0 +go: finding github.com/decred/dcrd/chaincfg v1.5.2 +go: finding github.com/decred/dcrd/blockchain/stake/v2 v2.0.2 +go: finding github.com/decred/dcrd/blockchain/standalone v1.1.0 +go: finding github.com/decred/dcrd/dcrjson/v3 v3.0.1 +go: finding github.com/decred/dcrd/txscript/v2 v2.1.0 +go: finding github.com/decred/dcrd/rpc/jsonrpc/types v1.0.1 +go: finding github.com/decred/dcrd/gcs v1.1.0 +go: finding github.com/decred/dcrd/database/v2 v2.0.1 +go: finding github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 +go: finding github.com/decred/go-socks v1.0.1-0.20191001171050-775b73941e73 +go: finding github.com/dchest/blake256 v1.0.0 +go: finding github.com/jrick/wsrpc/v2 v2.1.5 +go: finding github.com/dchest/siphash v1.2.1 +go: finding github.com/jessevdk/go-flags v1.4.0 +go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58 +go: finding github.com/jrick/logrotate v1.0.0 +go: finding github.com/golang/protobuf v1.3.2 +go: finding google.golang.org/grpc v1.22.0 +go: finding github.com/gorilla/websocket v1.4.1 +go: finding github.com/jrick/bitset v1.0.0 +go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 +go: finding golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 +go: finding golang.org/x/text v0.3.2 +Removing intermediate container d2e681a9b021 + ---> 6e51e003b75b +Step 5/11 : FROM alpine as final + ---> 965ea09ff2eb +Step 6/11 : VOLUME /root/.dcrwallet + ---> Using cache + ---> f12d959d3206 +Step 7/11 : COPY --from=builder /go/src/github.com/decred/dcrwallet/start-dcrwallet.sh /bin/ + ---> Using cache + ---> d34e7c3d71ef +Step 8/11 : COPY --from=builder /go/bin/dcrwallet /bin/ + ---> Using cache + ---> 8e56e25816c3 +Step 9/11 : EXPOSE 9735 10009 + ---> Using cache + ---> e8f8f5f5e7c1 +Step 10/11 : RUN cd bin + ---> Using cache + ---> c0d6498d0c5a +Step 11/11 : ENTRYPOINT [./dcrwallet] + ---> Using cache + ---> 48e812d23c1e +Successfully built 48e812d23c1e +Successfully tagged dcrwallet:latest diff --git a/go.mod b/go.mod index d10141eeb..c845e2e7d 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,13 @@ require ( github.com/decred/dcrd/rpc/jsonrpc/types v1.0.1 github.com/decred/dcrd/txscript/v3 v3.0.0-20200311044114-143c1884e4c8 github.com/decred/dcrd/wire v1.3.0 + github.com/decred/dcrwallet/errors/v2 v2.0.0 + github.com/decred/dcrwallet/p2p/v2 v2.0.0 + github.com/decred/dcrwallet/rpc/client/dcrd v1.0.0 + github.com/decred/dcrwallet/rpc/jsonrpc/types v1.4.0 + github.com/decred/dcrwallet/version v1.0.5 + github.com/decred/dcrwallet/wallet/v3 v3.2.1 + github.com/decred/dcrwallet/walletseed v1.0.3 github.com/decred/go-socks v1.1.0 github.com/decred/slog v1.0.0 github.com/golang/protobuf v1.3.2 @@ -32,9 +39,7 @@ require ( github.com/jrick/wsrpc/v2 v2.3.2 go.etcd.io/bbolt v1.3.4 golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6 - golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e - golang.org/x/text v0.3.2 // indirect golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 google.golang.org/grpc v1.25.1 ) diff --git a/internal/rpc/jsonrpc/methods.go b/internal/rpc/jsonrpc/methods.go index 92354fe67..f4675a677 100644 --- a/internal/rpc/jsonrpc/methods.go +++ b/internal/rpc/jsonrpc/methods.go @@ -27,6 +27,7 @@ import ( "decred.org/dcrwallet/wallet/txauthor" "decred.org/dcrwallet/wallet/txrules" "decred.org/dcrwallet/wallet/udb" + "decred.org/dcrwallet/walletseed" "github.com/decred/dcrd/blockchain/stake/v3" blockchain "github.com/decred/dcrd/blockchain/standalone" "github.com/decred/dcrd/chaincfg/chainhash" @@ -132,6 +133,7 @@ var handlers = map[string]handler{ "validateaddress": {fn: (*Server).validateAddress}, "validatepredcp0005cf": {fn: (*Server).validatePreDCP0005CF}, "verifymessage": {fn: (*Server).verifyMessage}, + "verifyseed": {fn: (*Server).verifySeed}, "version": {fn: (*Server).version}, "walletinfo": {fn: (*Server).walletInfo}, "walletlock": {fn: (*Server).walletLock}, @@ -3763,6 +3765,95 @@ WrongAddrKind: return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter, "address must be secp256k1 P2PK or P2PKH") } +func deriveCoinTypeKey(seed []byte, coinType uint32, params *chaincfg.Params) (*hdkeychain.ExtendedKey, error) { + // Create new root from the inputted seed and the current net + root, err := hdkeychain.NewMaster(seed[:], params) + if err != nil { + return nil, err + } + + // BIP0032 hierarchy: m/'/ + // Where purpose = 44 and the ' indicates hardening with the HardenedKeyStart 0x80000000 + purpose, err := root.Child(44 + hdkeychain.HardenedKeyStart) + if err != nil { + return nil, err + } + defer purpose.Zero() + + // BIP0044 hierarchy: m/'/' + // Where coin type is either the legacy coin type, 20, or the coin type described in SLIP0044, 44. Note these parameters + // are only appropraite for main net. + coinTypePrivKey, err := purpose.Child(coinType + hdkeychain.HardenedKeyStart) + if err != nil { + return nil, err + } + + return coinTypePrivKey, nil +} + +// verifySeed checks if a user inputted seed is equivalent to the running wallets. +func (s *Server) verifySeed(ctx context.Context, icmd interface{}) (interface{}, error) { + cmd := icmd.(*types.VerifySeedCmd) + w, ok := s.walletLoader.LoadedWallet() + if !ok { + return nil, errUnloadedWallet + } + + // obtain the wallet public key to check against the wallet derived seed + account := 0 + if cmd.Account != nil { + account = int(*cmd.Account) + } + + // snag the coin type from the running wallet + coinType, err := w.CoinType(ctx) + if err != nil { + return nil, err + } + + decodedSeed, err := walletseed.DecodeUserInput(cmd.Seed) + if err != nil { + return nil, err + } + + // derive the coin type using the user inputted seed, the wallets coin type, and the current chains parameters. + coinTypePrivKey, err := deriveCoinTypeKey(decodedSeed, coinType, w.ChainParams()) + if err != nil { + return nil, err + } + defer coinTypePrivKey.Zero() + + // both derivedAccountKey and walletDerivedAccountKey use the BIP044 hierachy: m/44'/'/' + accountKey, err := coinTypePrivKey.Child(uint32(account) + hdkeychain.HardenedKeyStart) + if err != nil { + return nil, err + } + defer accountKey.Zero() + + // to be matched with walletxPubKey + seedPubKey := accountKey.Neuter() + + // get the wallet coin type key from the wallet and take the account # if non 0 to get the wallet's public key + + // TODO: get the cointype key instead + walletCoinTypePrivKey, err := w.CoinTypePrivKey(ctx) + if err != nil { + return nil, err + } + + walletPubKey, err := walletCoinTypePrivKey.Child(uint32(account) + hdkeychain.HardenedKeyStart) + if err != nil { + return nil, err + } + defer accountKey.Zero() + + // compare the wallets public key to the inputted seeds public key, and return the results + return &types.VerifySeedResult{ + Result: walletPubKey.String() == seedPubKey.String(), + CoinType: coinType, + }, nil +} + // version handles the version command by returning the RPC API versions of the // wallet and, optionally, the consensus RPC server as well if it is associated // with the server. The chainClient is optional, and this is simply a helper diff --git a/internal/rpc/jsonrpc/rpcserverhelp.go b/internal/rpc/jsonrpc/rpcserverhelp.go index 94b995d64..9e4d66646 100644 --- a/internal/rpc/jsonrpc/rpcserverhelp.go +++ b/internal/rpc/jsonrpc/rpcserverhelp.go @@ -78,6 +78,7 @@ func helpDescsEnUS() map[string]string { "validateaddress": "validateaddress \"address\"\n\nVerify that an address is valid.\nExtra details are returned if the address is controlled by this wallet.\nThe following fields are valid only when the address is controlled by this wallet (ismine=true): isscript, pubkey, iscompressed, account, addresses, hex, script, and sigsrequired.\nThe following fields are only valid when address has an associated public key: pubkey, iscompressed.\nThe following fields are only valid when address is a pay-to-script-hash address: addresses, hex, and script.\nIf the address is a multisig address controlled by this wallet, the multisig fields will be left unset if the wallet is locked since the redeem script cannot be decrypted.\n\nArguments:\n1. address (string, required) Address to validate\n\nResult:\n{\n \"isvalid\": true|false, (boolean) Whether or not the address is valid\n \"address\": \"value\", (string) The payment address (only when isvalid is true)\n \"ismine\": true|false, (boolean) Whether this address is controlled by the wallet (only when isvalid is true)\n \"iswatchonly\": true|false, (boolean) Unset\n \"isscript\": true|false, (boolean) Whether the payment address is a pay-to-script-hash address (only when isvalid is true)\n \"pubkeyaddr\": \"value\", (string) The pubkey for this payment address (only when isvalid is true)\n \"pubkey\": \"value\", (string) The associated public key of the payment address, if any (only when isvalid is true)\n \"iscompressed\": true|false, (boolean) Whether the address was created by hashing a compressed public key, if any (only when isvalid is true)\n \"account\": \"value\", (string) The account this payment address belongs to (only when isvalid is true)\n \"addresses\": [\"value\",...], (array of string) All associated payment addresses of the script if address is a multisig address (only when isvalid is true)\n \"hex\": \"value\", (string) The redeem script \n \"script\": \"value\", (string) The class of redeem script for a multisig address\n \"sigsrequired\": n, (numeric) The number of required signatures to redeem outputs to the multisig address\n} \n", "validatepredcp0005cf": "validatepredcp0005cf\n\nValidate whether all stored cfilters from before DCP0005 activation are correct according to the expected hardcoded hash\n\nArguments:\nNone\n\nResult:\ntrue|false (boolean) Whether the cfilters are valid\n", "verifymessage": "verifymessage \"address\" \"signature\" \"message\"\n\nVerify a message was signed with the associated private key of some address.\n\nArguments:\n1. address (string, required) Address used to sign message\n2. signature (string, required) The signature to verify\n3. message (string, required) The message to verify\n\nResult:\ntrue|false (boolean) Whether the message was signed with the private key of 'address'\n", + "verifyseed": "verifyseed \"seed\" (account)\n\nVerifies if the wallets seed matches the inputted seed\n\nArguments:\n1. seed (string, required) The seed to check against the running wallet\n2. account (numeric, optional) The account to check the wallet account derived seed with\nthe accounts master public key. See BIP32: hierarchical deterministic wallets for more info.\n\nResult:\n{\n \"keyresult\": true|false, (boolean) The result of whether or not if the inputted seed matches the wallet\n \"cointype\": n, (numeric) The coin type to be used in the hierarchical wallet derivation process.\nSee BIP32: hierarchical deterministic wallets for more info\n} \n", "version": "version\n\nReturns application and API versions (semver) keyed by their names\n\nArguments:\nNone\n\nResult:\n{\n \"Program or API name\": Object containing the semantic version, (object) Version objects keyed by the program or API name\n ...\n}\n", "walletinfo": "walletinfo\n\nReturns global information about the wallet\n\nArguments:\nNone\n\nResult:\n{\n \"daemonconnected\": true|false, (boolean) Whether or not the wallet is currently connected to the daemon RPC\n \"unlocked\": true|false, (boolean) Whether or not the wallet is unlocked\n \"cointype\": n, (numeric) Active coin type. Not available for watching-only wallets.\n \"txfee\": n.nnn, (numeric) Transaction fee per kB of the serialized tx size in coins\n \"ticketpurchasing\": true|false, (boolean) Whether or not the wallet is currently purchasing tickets\n \"votebits\": n, (numeric) Vote bits setting\n \"votebitsextended\": \"value\", (string) Extended vote bits setting\n \"voteversion\": n, (numeric) Version of votes that will be generated\n \"voting\": true|false, (boolean) Whether or not the wallet is currently voting tickets\n} \n", "walletislocked": "walletislocked\n\nReturns whether or not the wallet is locked.\n\nArguments:\nNone\n\nResult:\ntrue|false (boolean) Whether the wallet is locked\n", diff --git a/internal/rpchelp/helpdescs_en_US.go b/internal/rpchelp/helpdescs_en_US.go index ab8e3701b..d587afaba 100644 --- a/internal/rpchelp/helpdescs_en_US.go +++ b/internal/rpchelp/helpdescs_en_US.go @@ -602,6 +602,17 @@ var helpDescsEnUS = map[string]string{ "verifymessage-message": "The message to verify", "verifymessage--result0": "Whether the message was signed with the private key of 'address'", + // VerifySeedCmd help. + "verifyseed--synopsis": "Verifies if the wallets seed matches the inputted seed", + "verifyseed-seed": "The seed to check against the running wallet", + "verifyseed-account": "The account to check the wallet account derived seed with\n" + + "the accounts master public key. See BIP32: hierarchical deterministic wallets for more info.", + + // VerifySeedResult help. + "verifyseedresult-cointype": "The coin type to be used in the hierarchical wallet derivation process.\n" + + "See BIP32: hierarchical deterministic wallets for more info", + "verifyseedresult-keyresult": "The result of whether or not if the inputted seed matches the wallet", + // Version help "version--synopsis": "Returns application and API versions (semver) keyed by their names", "version--result0--desc": "Version objects keyed by the program or API name", diff --git a/internal/rpchelp/methods.go b/internal/rpchelp/methods.go index 78f9fe429..41f6b983c 100644 --- a/internal/rpchelp/methods.go +++ b/internal/rpchelp/methods.go @@ -101,6 +101,7 @@ var Methods = []struct { {"validateaddress", []interface{}{(*types.ValidateAddressWalletResult)(nil)}}, {"validatepredcp0005cf", returnsBool}, {"verifymessage", returnsBool}, + {"verifyseed", []interface{}{(*types.VerifySeedResult)(nil)}}, {"version", []interface{}{(*map[string]dcrdtypes.VersionResult)(nil)}}, {"walletinfo", []interface{}{(*types.WalletInfoResult)(nil)}}, {"walletislocked", returnsBool},