Giter Club home page Giter Club logo

dcrwallet's Introduction

dcrwallet

dcrwallet is a daemon handling Decred wallet functionality. All interaction with the wallet is performed over RPC.

Public and private keys are derived using the hierarchical deterministic format described by BIP0032. Unencrypted private keys are not supported and are never written to disk. dcrwallet uses the m/44'/<coin type>'/<account>'/<branch>/<address index> HD path for all derived addresses, as described by BIP0044.

dcrwallet provides two modes of operation to connect to the Decred network. The first (and default) is to communicate with a single trusted dcrd instance using JSON-RPC. The second is a privacy-preserving Simplified Payment Verification (SPV) mode (enabled with the --spv flag) where the wallet connects either to specified peers (with --spvconnect) or peers discovered from seeders and other peers. Both modes can be switched between with just a restart of the wallet. It is advised to avoid SPV mode for heavily-used wallets which require downloading most blocks regardless.

Not all functionality is available when running in SPV mode. Some of these features may become available in future versions, but only if a consensus vote passes to activate the required changes. Currently, the following features are disabled or unavailable to SPV wallets:

  • Voting

  • Revoking tickets before expiry

  • Determining exact number of live and missed tickets (as opposed to simply unspent).

Wallet clients interact with the wallet using one of two RPC servers:

  1. A JSON-RPC server inspired by the Bitcoin Core rpc server

    The JSON-RPC server exists to ease the migration of wallet applications from Core, but complete compatibility is not guaranteed. Some portions of the API (and especially accounts) have to work differently due to other design decisions (mostly due to BIP0044). However, if you find a compatibility issue and feel that it could be reasonably supported, please report an issue. This server is enabled by default as long as a username and password are provided.

  2. A gRPC server

    The gRPC server uses a new API built for dcrwallet, but the API is not stabilized. This server is enabled by default and may be disabled with the config option --nogrpc. If you don't mind applications breaking due to API changes, don't want to deal with issues of the JSON-RPC API, or need notifications for changes to the wallet, this is the RPC server to use. The gRPC server is documented here.

Installing and updating

Binaries (Windows/Linux/macOS)

Binary releases are provided for common operating systems and architectures. Please note that dcrwallet is CLI only. It is included in the CLI app suite. If you would prefer a graphical user interface (GUI) instead, consider downloading the GUI wallet Decrediton.

https://decred.org/downloads/

Build from source (all platforms)

  • Install Go 1.21 or 1.22

    Installation instructions can be found here: https://golang.org/doc/install. Ensure Go was installed properly and is a supported version:

    $ go version
    $ go env GOROOT GOPATH

    NOTE: GOROOT and GOPATH must not be on the same path. It is recommended to add $GOPATH/bin to your PATH according to the Golang.org instructions.

  • Build or Update dcrwallet

    Since dcrwallet is a single Go module, it's possible to use a single command to download, build, and install without needing to clone the repo. Run:

    $ go install decred.org/dcrwallet/v4@master

    to build the latest master branch, or:

    $ go install decred.org/dcrwallet/v3@latest

    for the latest released version.

    Any version, branch, or tag may be appended following a @ character after the package name. The implicit default is to build @latest, which is the latest semantic version tag. Building @master will build the latest development version. The module name, including any /vN suffix, must match the module line in the go.mod at that version. See go help install for more details.

    The dcrwallet executable will be installed to $GOPATH/bin. GOPATH defaults to $HOME/go (or %USERPROFILE%\go on Windows).

Getting Started

dcrwallet can connect to the Decred blockchain using either dcrd or by running in Simple Payment Verification (SPV) mode. Commands should be run in cmd.exe or PowerShell on Windows, or any terminal emulator on *nix.

  • Run the following command to create a wallet:
dcrwallet --create
  • To use dcrwallet in SPV mode:
dcrwallet --spv

dcrwallet will find external full node peers. It will take a few minutes to download the blockchain headers and filters, but it will not download full blocks.

  • To use dcrwallet using a localhost dcrd:

You will need to install both dcrd and dcrctl. dcrctl is the client that controls dcrd and dcrwallet via remote procedure call (RPC).

Please follow the instructions in the documentation, beginning with Startup Basics

Running Tests

All tests may be run using the script run_tests.sh. Generally, Decred only supports the current and previous major versions of Go.

./run_tests.sh

Contact

If you have any further questions you can find us at:

https://decred.org/community/

Issue Tracker

The integrated github issue tracker is used for this project.

Documentation

The documentation for dcrwallet is a work-in-progress. It is located in the docs folder.

Additional documentation can be found on docs.decred.org.

License

dcrwallet is licensed under the liberal ISC License.

dcrwallet's People

Contributors

aerth avatar alexlyp avatar beansgum avatar bgptr avatar buck54321 avatar chappjc avatar cjepson avatar dajohi avatar davecgh avatar dnldd avatar githubsands avatar gsalgado avatar itswisdomagain avatar jcvernaleo avatar jholdstock avatar jimmysong avatar joegruffins avatar jolan avatar jrick avatar jyap808 avatar kifen avatar klka avatar manan19 avatar marcopeereboom avatar matheusd avatar owainga avatar peterzen avatar raedah avatar tuxcanfly avatar vctt94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcrwallet's Issues

Sstxfee

After changing sstxfee wallet is not inserting sstx . Its been 10hours no luck . Now even after i changed it default vaule 0.05 its not inserting sstx transaction

Attempting to create wallet when it already exists should display path.

When attempting to create a new wallet with the --create when a wallet already exists, the application prints The wallet already exists. This is obviously correct behavior, but I'd suggest this is changed to include the path since otherwise it can be difficult to know where the wallet lives.

So, for example:

A wallet already exists at '/path/to/existing/wallet'.

There is no fees calculation for revocations

There is currently no fees calculation for revocations. The size of the revocation is known before hand, so this should be patched to correctly calculate the correct amount of fees.

dcrwallet displays the wrong balance during stake mining

dcrwallet does not use the balancetomaintain option from the config file or the command line completely correctly. This has been an issue for some time but has gone unreported. The ticketmaxprice works as expected, but as soon as that condition is met the wallet grabs the entire balance to buy tickets, but doesn't buy them.

getinfo - keypoolsize returns static 0

query dcrcoin keypoolrefill 100
query dcrcoin getinfo
{
"version": 100,
"protocolversion": 1,
"walletversion": 4,
"balance": 0,
"blocks": 4306,
"timeoffset": 0,
"connections": 3,
"proxy": "",
"difficulty": 199771.58352835,
"testnet": true,
"keypoololdest": 1454271842,
"keypoolsize": 0,
"unlocked_until": 0,
"paytxfee": 0.01,
"relayfee": 1e-05,
"errors": ""
}

If keypoolsize is deprecated, can we use a static 100 or something large so people dont think the keypool is empty

Scientific notation

There are a few places where the rpc server returns scientific notation that should probably be decimal to be consistent with everything else. This was pointed out by Emilio Mann on the forum:

fee in listtransactions

paytxfee and relayfee in getinfo

RPC ports listed in help are for Bitcoin instead of Decred

Reported by simple on IRC.

I confirmed it as well:

$  dcrwallet -h
...
  /c, /rpcconnect:          Hostname/IP and port of dcrd RPC server to connect
                            to (default localhost:18334, mainnet:
                            localhost:8334, simnet: localhost:18556)
...
      /rpclisten:           Listen for RPC/websocket connections on this
                            interface/port (default port: 18332, mainnet: 8332,
                            simnet: 18554)
...

The correct ports should be as follows:

dcrd:
mainnet: 9109
testnet: 19109
simnet: 18556

dcrwallet:
mainnet: 9110
testnet: 19110
simnet: 18557

Also, the dcrd simnet port looks to be the same as it is for btcd. I think it should be changed to something unique for decred as well.

listtransactions show in double the sent coins

One for real sent amount and another one with the input bloc time, seems to be "spent transactions"

I was unable to filter them easily except for mined/generated coins. "category": "send" and "generated": true

txToPairs uses FeeIncrement differently in a few spots

needed += feeForSize(feeIncrement...)

but then:

return w.createTx(eligible, pairs, bs, w.FeeIncrement...)

This should be looked into to ensure that correct functionality is achieved.

Also should fix/remove all with FeeIncrement switch/cases that are throughout

Incorrect fees calculations in listtransactions

Fees appear to be calculated incorrectly in listtransactions/getransaction.

{ "amount": 0, "fee": 23.99999, "confirmations": 0, "blockhash": "", "blockindex": 0, "blocktime": 0, "txid": "f8ffa009d4e9618c5250288718c8ce342bd8859a6d7c553b6c60acb009265136", "walletconflicts": [], "time": 1454058589, "timereceived": 1454058589, "details": [ { "account": "", "amount": -12, "category": "send", "fee": 23.99999, "vout": 0 } ], }

listtransactions need to populate "account" label

We assign GUIDs to address to make sure not only the address matches, but the guid matches as extra security. listtransactions doesn't properly populate the field.

query dcrcoin validateaddress "TsXfyM6SLS1JhqXDds58YGoMEQuuyMdQj7X"
{
"isvalid": true,
"address": "TsXfyM6SLS1JhqXDds58YGoMEQuuyMdQj7X",
"ismine": true,
"pubkeyaddr": "TkKmN6PYmKy6Q7qMhJmqtFUc5Yrnx2CRMAdd2KFwhrJL4WDEohWBG",
"pubkey": "026b1bc6c1c7068f09771ffcad32b3b53da33e0f9545c760d970c4ce49ba2661d7",
"iscompressed": true,
"account": "d25f76a6-da7b-456c-b615-dee68d859362"
}

query dcrcoin listtransactions
[
{
"account": "",
"address": "TsXfyM6SLS1JhqXDds58YGoMEQuuyMdQj7X",
"amount": -50,
"category": "send",
"confirmations": 0,
"fee": -0.01,
"time": 1454270237,
"timereceived": 1454270237,
"txid": "647a664a1b8c01d27ba7b9bbe619c1413b83abd4928ff798d40dfa3a353e6bdb",
"vout": 1,
"walletconflicts": []
},
{
"account": "",
"address": "TsXfyM6SLS1JhqXDds58YGoMEQuuyMdQj7X",
"amount": 50,
"category": "receive",
"confirmations": 0,
"time": 1454270237,
"timereceived": 1454270237,
"txid": "647a664a1b8c01d27ba7b9bbe619c1413b83abd4928ff798d40dfa3a353e6bdb",
"vout": 1,
"walletconflicts": []
},

getnewaddress returns previously issued address

I have no repro but we have seen dcrd return previously used addresses when calling getnewaddress multiple times.

in this case, the counter looked to be rolled back 4 addresses (ie, i called getnewaddress 4 times before getting an address that wasn't previously used).

Source code missing

According to decred.org:

Free and Open-Source Software

Where is the source code for dcrwallet?

Proper isDust checking for created tx outputs

When transactions are created there is no checking as to whether any outputs would be considered dust by dcrd. Instead of just sending them to subsequently get an err (output 0 of 100000 is considered dust) back from dcrd, we should check outputs are above isDust threshold. If not return an error (without sending along tx), and a note to suggest using the soon to be available consolidate RPC. But again, if the output value is too small, no consolidation would help that. Dust is still dust.

Purchase ticket <account> <amount> ignores account

Sorry this is a better place for this issue than dcrd maybe. Delete issue in dcrd if need be.

Many people cannot purchase PoS tickets because it ignores the account you specify and tries to use default. Also looks like the move command is broken.

C:\Program Files\Decred>dcrctl -u -P --wallet purchaseticket CodyF86 2
-4: not enough to purchase sstx

C:\Program Files\Decred>dcrctl -u -P --wallet listaccounts
{
"CodyF86": 30.50512524,
"default": 0,
"imported": 0
}

C:\Program Files\Decred>dcrctl -u -P --wallet move CodyF86 default 10
-1: Request unsupported by dcrwallet

Create wallet from single command line command

It would be great if GUIs could create wallet's from a simple command line command. At this moment it is almost impossible to create wallets from anything but the command line, because stdio emulation won't work when asked for passwords.

listreceivedbyaddress returns incorrect data

query dcrcoin listreceivedbyaddress 0 true
-4: no transaction details could be found

This should list every address in the wallet... include minconf = 0 and includeempty=true

getaddressesbyaccount returns unused addresses from the address pool

The cursor for new addresses from the default account is correctly incremented for the getnewaddress function, but it is possible to get a list of used and unused addresses from the getaddressesbyaccount. The getaddressesbyaccount call should also take into account the current cursor of the address pool and not return unused addresses. Without this, the user becomes in danger of reusing their addresses.

A balancetype of "all" for getbalance does not work correctly.

When issuing a getbalance RPC call with the balancetype set to all, the balance does not include unconfirmed coins in the balance as it should.

$ dcrctl --testnet --wallet getbalance "default" 0
1080.99029897
$ dcrctl --testnet --wallet getbalance "default" 0 all
1076.13881383

redundant wallet not picking up transactions

I have a wallet from which I did a few ticket purchases. when I do dcrctl ... --wallet gettickets 1, I can see the list of all my immature tickets.

In order to avoid the risk of missing a vote I started 2 other instance of dcrwallet on other systems. using the same seed. On creation, dcrd and the wallets will sync up to the most recent block and I can see the same tickets and transactions.

However if I make new ticket purchase from my first system (only that one is used for purchase). The 2 other wallets will randomly or not see the new ticket even 6 hours later.

When I check the dcrd and dcrwallet window on all system they all have processed the most recent block (624 at this time). If I take the transaction id from my main wallet I can verify that it was successfully received with the mainnet web block explorer. Restarting dcrwallet on the 2 redundant systems will sometime add one or 2 new transaction but most of the time not.

If I use the transaction id and do a search on all systems, the one on which the purchase was made will see the transaction, and the others will find no record of that transaction even if they have processed the corresponding block recently or a while back.

The only way I have found to force a wallet to sync up is to delete it and recreate it. On creation it will sync everything and then it will report all the tickets and transactions.

Also, I am not sure this issue is only affecting redundant wallets because after 350 blocks were created yesterday, the wallet I created at launch with my previous seed still couldn't see my airdrop even though the transactions was listed in the block explorer and all daemons were telling me they were up to date with the latest block. It's only after I deleted my wallet and recreated it that I was able to see the transaction and correct balance.

All systems use v0.0.4, are on windows system and on different networks

listtransactions "*" <limit>

To show a custom number of entries i had to use the wallet --terminal to be able to use the "*"

on the linux command line * means all files, tried to quote and use backslashes without success

I suggest to allow the empty string "" as account to list all, like its explained in help (* or unset)

Automatically remove expired transactions from wallet

Stake tickets that don't get accepted before the difficulty rises get "stuck" in the wallet and a restoration from seed is required to remove them. The correct behaviour would be tickets purchased having an expiry and being removed from the wallet after their expiration.

The RPC calls also need to be updated so that adding an expiry is possible. Pruning of other transactions that are expired should happen in addition to the above change.

getnewaddress should createnewaccount if it doesn't exist

query dcrcoin getnewaddress a1c021f5-17ea-46a6-b08e-4ca7a6f0a1e6
-4: account name 'a1c021f5-17ea-46a6-b08e-4ca7a6f0a1e6' not found

I understand that i can call 'createnewaccount' first, but to keep things closer to btc (and to not disrupt current btc workflows) getnewaddress should just check if the account exists... if it doesn't, it should createnewaccount and then getnewaddress.

no 'help' results for getstakeinfo

Not sure why this is happening. The GetStakeInfoCmd type is registered by dcrjson, and the help texts are included in the rpchelp package (helpdescs_en_US.go) but no help texts are created for the command when the help descriptions map is generated (by running go generate in rpc/legacyrpc package). go generate -x does show the generators being run.

gettransaction does not populate the account field properly

dcrcoin gettransaction 60fbd3092222d26c887188358436d5158c3d7d7ab695782d35dadc66a0f72f71
{
"amount": 0.95,
"confirmations": 24,
"blockhash": "0000000000005843ea1b5122d75d0f6415c9b37ebb9258dd5b5ba7b67f856315",
"blockindex": 0,
"blocktime": 1454981933,
"txid": "60fbd3092222d26c887188358436d5158c3d7d7ab695782d35dadc66a0f72f71",
"walletconflicts": [],
"time": 1454981888,
"timereceived": 1454981888,
"details": [
{
"account": "",
"address": "DsYrr6HAiyceXwvfzhYk1WCHxLctokGjEUM",
"amount": 0.95,
"category": "receive",
"vout": 0
}
],
"hex": "01000000010855c1022575bc9608b929d79d599a8dcecd3b71a3374ebb52857561af42fb1d0100000000ffffffff02c095a9050000000000001976a914569bac4b9c765c5aa2ace4d56f75e38a3c61896a88ac222305010000000000001976a914786d11b73005815d283c6d1e6ce0e28b8586eb1788ac000000000000000001ffffffffffffffff00000000ffffffff6b4830450221009c53bcb55bf79aac1744176e4f9cd1364e87f551c1e5d11edf14cb1aba88e0f402201e64684a2c7ee343b7e737069777c2350031965b6da001648b2b4f7ac168029d012103b0c45f1190b0b6309b134e57b5ca6a10dd0bf76e66e4f72418c522e2fdc2266c"
}

the same transaction using listtransactions
{
"account": "3ed3b1bd-c1aa-4a49-ac3e-d60bb7a1ef01",
"address": "DsYrr6HAiyceXwvfzhYk1WCHxLctokGjEUM",
"amount": 0.95,
"blockhash": "0000000000005843ea1b5122d75d0f6415c9b37ebb9258dd5b5ba7b67f856315",
"blocktime": 1454981933,
"category": "receive",
"confirmations": 25,
"time": 1454981888,
"timereceived": 1454981888,
"txid": "60fbd3092222d26c887188358436d5158c3d7d7ab695782d35dadc66a0f72f71",
"vout": 0,
"walletconflicts": []
},

getstakeinfo broken

After updating dcrwallet today, getstakeinfo is broken:

decred@ubuntu1604:~$ dcrctl --wallet getstakeinfo
-32602: wrong number of params (expected between 0 and 1, received 2)

Feature Request: Specify wallet location

To me it feels very weird that I can only have a single wallet on my machine in a fixed place. Is it possible to have the option for me to specify the wallet location so I can have multiple wallets on one machine in the location I prefer? I can imagine that some households have multiple users using the same account both wanting to have their own wallet.

tx insufficient priority

sometimes when trying to send coins I got this message:

E0078: RPC method did not return 200 OK: Address: xxxxxxxxxxxxxxxxxxx ERROR: Response error or empty: -22: TX rejected: transaction def2d3bea20f8928e359c218c64cd210f967a434d7a5d5d9a5edc9c1e500a232 has insufficient priority (2.529764803846154e+07 <= 5.76e+07)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.