bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 7쪽
de’s Prerequisites to determine the right command for your OS/Shell application):
dcrwallet
Your
dcrwallet
will now connect to the network via
dcrd
. It will begin to scan the network for your active addresses which can take a few minutes on slow computers. Eventually it will start showing lines like:
[INF] WLLT: Connecting block 0000000000002004ea8fa74af334cb291a22832642b5be603995683534bbb97b, height 9990
This means your wallet is successfully connected to the network
through your daemon.
To learn how to use
dcrd
and
dcrwallet
, visit the
dcrctl Basics
guide. You’ll learn how to unlock your wallet, send and receive DCR using
dcrctl
, check your balance, and check various network stats.
## /wallets/cli/dcrctl-basics
dcrctl
Basics
Prerequisites:
Use the latest
dcrinstall
to install the command line tools.
Setup dcrd
and have it running in the background.
Setup dcrwallet
and have it running in the background.
dcrctl
is the client that controls
dcrd
and
dcrwallet
via remote procedure call (RPC). You can use
dcrctl
for many things such as checking your balance, buying tickets, creating transactions, and viewing network information.
dcrctl
is not a daemon - it does not run permanently in the background - it calls the requested RPC method, prints the response, and then terminates immediately.
Usage
To call
dcrd
RPC methods:
dcrctl <options> <rpc method> <rpc method args>
To call
dcrwallet
RPC methods:
dcrctl <options> --wallet <rpc method> <rpc method args>
To list available options:
dcrctl --help
To list available RPC methods:
dcrctl -l
Unlocking Your Wallet
Some functionality of
dcrwallet
requires the wallet to be unlocked.
The command to unlock your wallet follows:
promptsecret | dcrctl --wallet walletpassphrase - 0
Here, we are specifying for
dcrctl
to send the command to
dcrwallet
by using the
--wallet
flag. The actual command is
walletpassphrase
which accepts two parameters, your private passphrase and a time limit. Specifying
0
for a time limit unlocks
dcrwallet
without a time limit. Note, however, that this only unlocks the wallet for the current session. If you close the window the wallet is running in, or stop/restart the
dcrwallet
, you will need to unlock it again the next time you start it.
If the command was successful, you will not get a confirmation from
dcrctl
, but if you look at your
dcrwallet
session, it will say:
[INF] RPCS: The wallet has been unlocked without a time limit.
NOTE: Because unlocking the wallet is required for many functions of
dcrwallet
,
dcrwallet
can be started with the
--promptpass
flag or setting
promptpass=true
in
dcrwallet.conf
.
Checking Your Balance
To send the
getbalance
command to
dcrwallet
using
dcrctl
, enter the following in your shell:
dcrctl --wallet getbalance
This will return all of the balances for all of your accounts.
Getting a New Receiving Address
To send the
getnewaddress
command to
dcrwallet
using
dcrctl
, enter the following in your shell:
dcrctl --wallet getnewaddress
This will generate and return a new payment address. To minimize address reuse, use this command to get a new address for each transaction you wish to receive.
Sending DCR
To send DCR to an address, issue the
sendtoaddress
command to
dcrwallet
using
dcrctl
. Enter the following in your shell, filling in the receiving address and amount to send:
dcrctl --wallet sendtoaddress <address> <amount>
If successful,
dcrctl
will return a transaction hash that can be used to watch the transaction on the official
Decred Block Explorer
.
Check Network Stats
There are many different commands to check different network stats. Here we will cover sending
getinfo
to
dcrd
and
getstakeinfo
to
dcrwallet
.
To get information about your local
dcrd
node, issue the
getinfo
command to
dcrd
using
dcrctl
. Enter the following in your shell:
dcrctl getinfo
To get staking information about the Proof-of-Stake network, issue the
getstakeinfo
command to
dcrwallet
using
dcrctl
. Enter the following in your shell:
dcrctl --wallet getstakeinfo
Additional Commands
More commands can also be found on the
dcrctl RPC Commands
page.
## /wallets/cli/dcrwallet-tickets
Buying Tickets With dcrwallet
Last updated for CLI release v1.8.0.
This guide is intended to walk through ticket buying using
dcrwallet
.
Before proceeding it is recommended to decide if you want to solo vote or use a
Voting Service Provider (VSP).
The
How to Stake
page covers the pros
and cons of each approach.
Prerequisites:
Use the latest
dcrinstall
to install
dcrd
,
dcrwallet,
and
dcrctl
. Additional steps will be required if another installation method was used.
Review how the launch commands for the Command Prompt (Windows) and Bash (macOS/Linux) shells differ
here
.
Setup dcrd
and have it running in the background.
Setup dcrwallet
and have it running in the background.
Familiarize yourself with the
basics of using dcrctl
.
Familiarize yourself with the
staking process
and the
ticket lifecycle
This guide assumes you have set up
dcrd
and
dcrwallet
using configuration files. If you used
dcrinstall
, you have configuration files already. Using configuration files is highly recommended - it makes for an easier time issuing commands to
dcrwallet
and
dcrd
through
dcrctl
. A guide for minimum configuration (saving your RPC username and RPC password) can be found
here
.
Step 1. Enable Voting
Solo-voting
Warning
Solo-voting with a voting wallet that doesn’t stay online 24/7 may result in missed votes and forfeited stake rewards.
To solo-vote, you simply set the
enablevoting
option when starting
dcrwallet
, unlock the wallet with your private passphrase, and buy tickets. With
enablevoting
enabled and
dcrwallet
unlocked, your wallet will automatically handle voting.
To set up your
dcrwallet
for solo-staking, add the following line to your
dcrwallet.conf
config file:
enablevoting
=
1
Once
dcrwallet
is restarted with that line in
dcrwallet.conf
, your wallet will be configured for solo-voting and you can start
purchasing tickets
.
VSP Voting
You can find a list of VSPs
here
.
Once you have decided on a VSP, delegating voting to a VSP for purchased tickets is accomplished with the following configuration options set in your dcrwallet.conf file.
vsp.url
vsp.pubkey
; ------------------------------------------------------------------------------
; VSP settings
; ------------------------------------------------------------------------------
; The URL of the VSP.
vsp.url
=
https://teststakepool.decred.org
; The base64 encoded public key of the VSP server. This can be found on the
; VSP website in the footer.
vsp.pubkey
=
ia9Ra2Drb+OHLqRyBsJnRKBd7TUG1IvrseC6robKzGo=
Step 2. Purchase Tickets
Tickets can be purchased in two different ways, manual or automatic. Purchasing
manually offers more control over when tickets are purchased, how much is paid
for each ticket, and how often the purchasing wallet is unlocked.
The automated buyer offers more convenience and requires less maintenance,
however it requires the purchasing wallet to remain online constantly.
Both manual and automatic ticket purchasing require your wallet to be
unlocked
.
Tip
To find the current ticket price, issue the
dcrctl --wallet getstakeinfo
command and look for the
difficulty
value.
This is the price of each ticket in the current price window.
You will want to adjust your
spendlimit
argument in the
purchaseticket
command to be greater than this
difficulty
value when purchasing tickets
manually.
Manual Ticket Purchase
The purchaseticket RPC command will attempt to purchase a ticket immediately
using available funds. There are two required parameters:
fromaccount
- String: The account from which to purchase tickets (e.g. “default”).
spendlimit
- Number: Limit on the amount to spend on ticket (e.g. 50).
More advanced parameters can be listed with the command
dcrctl --wallet help purchaseticket
.
If the purchaseticket command is successful it will output the hash of the
purchased ticket.
$
dcrctl
--testnet
--wallet
purchaseticket
default
100
[
"69b855e0d318dc5a21ff0f2717ad149b324027a1e46ecd28d0a18ea1ca249f5b"
]
The ticket has now entered the mempool and begins the
ticket lifecycle
.
For
solo voters
the process is complete. If they are using separate ticket
buying and voting wallets, the ticket buying wallet can now be closed.
VSP users
need to keep their wallet open a few moments longer while the
newly purchased ticket is registered with the VSP and the fee is paid. A
“successfully processed” message in the dcrwallet log will indicate when the
registration is complete.
[INF] WLLT: Published ticket purchase 69b855e0d318dc5a21ff0f2717ad149b324027a1e46ecd28d0a18ea1ca249f5b
[INF] VSPC: VSP requires fee 0.00010829 DCR
[INF] VSPC: successfully processed 69b855e0d318dc5a21ff0f2717ad149b324027a1e46ecd28d0a18ea1ca249f5b
Automatic Ticketbuyer
dcrwallet
includes a built-in
ticketbuyer
which can buy tickets for you automatically.
It can be enabled by adding the following line to your
dcrwallet.conf
config file:
enableticketbuyer
=
1
If you don’t want
ticketbuyer
to spend all of your funds, there is one more option which allows you to specify a balance which will not be spent:
ticketbuyer.balancetomaintainabsolute
=
<balance>
## /wallets/cli/dcrd-and-dcrwallet-cli-arguments
dcrd
and
dcrwallet
CLI Arguments
Last updated for CLI release v1.8.0.
Both the
dcrd
and
dcrwallet
daemons should work with default configuration for most users, however there is a wide variety of command line arguments to change the way they behave if required. For example, the following command can be used to change the log directory
dcrd
will write to.
dcrd
--logdir
=
/my/custom/log/directory
dcrd
and
dcrwallet
both support a
--help
argument which will print details of all the arguments they support and then exit immediately.
dcrd
Click to expand full list of
dcrd
CLI arguments
General
Description
-V
or
--version
Display version information and exit
-A
or
--appdata=
Path to application home directory (default:
~/.dcrd
)
-C
or
--configfile=
Path to configuration file (default:
~/.dcrd/dcrd.conf
)
-b
or
--datadir=
Directory to store data (default:
~/.dcrd/data
)
--logdir=
Directory to log output (default:
~/.dcrd/logs
)
--logsize=
Maximum size of log file before it is rotated (default: 10 MiB)
--nofilelogging
Disable file logging.
--dbtype=
Database backend to use for the Block Chain (default: ffldb)
--profile=
Enable HTTP profiling on given [addr:]port –
NOTE:
port must be between 1024 and 65536
--cpuprofile=
Write CPU profile to the specified file
--memprofile=
Write mem profile to the specified file
--testnet
Use the test network
--simnet
Use the simulation test network
--regnet
Use the regression test network
-d
or
--debuglevel=
Logging level for all subsystems {trace, debug, info, warn, error, critical} – You may also specify
<subsystem>=<level>,<subsystem2>=<level>,...
to set the log level for individual subsystems – Use
show
to list available subsystems (default: info)
--sigcachemaxsize=
The maximum number of entries in the signature verification cache (default: 100000)
--utxocachemaxsize=
The maximum size in MiB of the utxo cache (min: 25, max: 32768) (default: 150)
RPC Server
Description
--norpc
Disable built-in RPC server –
NOTE:
The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified
--rpclisten=
Add an interface/port to listen for RPC connections (default port: 9109, testnet: 19109)
-u
or
--rpcuser=
Username for RPC connections
-P
or
--rpcpass=
Password for RPC connections
--authtype=
Method for RPC client authentication (
basic
(default) or
clientcert
)
--clientcafile=
File containing Certificate Authorities to verify TLS client certificates; requires authtype=clientcert; (default:
~/.dcrd/clients.pem
)
--rpclimituser=
Username for limited RPC connections
--rpclimitpass=
Password for limited RPC connections
--rpccert=
File containing the certificate file (default:
~/.dcrd/rpc.cert
)
--rpckey=
File containing the certificate key (default:
~/.dcrd/rpc.key
)
--tlscurve=
Curve to use when generating TLS keypairs (default: P-256)
--altdnsnames=
Specify additional DNS names to use when generating the RPC server certificate [$DCRD_ALT_DNSNAMES]
--notls
Disable TLS for the RPC server –
NOTE:
This is only allowed if the RPC server is bound to localhost
--rpcmaxclients=
Max number of RPC clients for standard connections (default: 10)
--rpcmaxwebsockets=
Max number of RPC websocket connections (default: 25)
--rpcmaxconcurrentreqs=
Max number of concurrent RPC requests that may be processed concurrently (default: 20)
P2P Proxy and Tor
Description
--proxy=
Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)
--proxyuser=
Username for proxy server
--proxypass=
Password for proxy server
--onion=
Connect to Tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)
--onionuser=
Username for onion proxy server
--onionpass=
Password for onion proxy server
--noonion
Disable connecting to Tor hidden services
--torisolation
Enable Tor stream isolation by randomizing user credentials for each connection.
P2P Network
Description
-a
or
--addpeer=
Add a peer to connect with at startup
--connect=
Connect only to the specified peers at startup
--nolisten
Disable listening for incoming connections –
NOTE:
Listening is automatically disabled if the
--connect
or
--proxy
options are used without also specifying listen interfaces via
--listen
--listen=
Add an interface/port to listen for connections (default all interfaces port: 9108, testnet: 19108)
--maxsameip=
Max number of connections with the same IP – 0 to disable (default: 5)
--maxpeers=
Max number of inbound and outbound peers (default: 125)
--dialtimeout=
How long to wait for TCP connection completion. Valid time units are {s, m, h}. Minimum 1 second (default: 30s)
--peeridletimeout=
The duration of inactivity before a peer is timed out. Valid time units are {s,m,h}. Minimum 15 seconds (default: 2m0s)
P2P Network Discovery
Description
--noseeders
Disable seeding for peer discovery
--externalip=
Add a public-facing IP to the list of local external IPs that dcrd will advertise to other peers
--nodiscoverip
Disable automatic network address discovery of local external IPs
--upnp
Use UPnP to map our listening port outside of NAT
Banning
Description
--nobanning
Disable banning of misbehaving peers
--banduration=
How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second (default: 24h0m0s)
--banthreshold=
Maximum allowed ban score before disconnecting and banning misbehaving peers. (default: 100)
--whitelist=
Add an IP network or IP that will not be banned (eg. 192.168.1.0/24 or ::1)
Chain Related
Description
--allowoldforks
Process forks deep in history. Don’t do this unless you know what you’re doing
--dumpblockchain=
Write blockchain as a flat file of blocks for use with addblock, to the specified filename
--assumevalid=
Hash of an assumed valid block. Defaults to the hard-coded assumed valid block that is updated periodically with new releases. Don’t use a different hash unless you understand the implications. Set to 0 to disable
Relay and Mempool Policy
Description
--minrelaytxfee=
The minimum transaction fee in DCR/kB to be considered a non-zero fee. (default: 0.0001)
--limitfreerelay=
DEPRECATED: This behavior is no longer available and this option will be removed in a future version of the software.
Limit relay of transactions with no transaction fee to the given amount in thousands of bytes per minute (default: 15)
--norelaypriority
DEPRECATED: This behavior is no longer available and this option will be removed in a future version of the software.
Do not require free or low-fee transactions to have high priority for relaying
--maxorphantx=
Max number of orphan transactions to keep in memory (default: 100)
--blocksonly
Do not accept transactions from remote peers.
--acceptnonstd
Accept and relay non-standard transactions to the network regardless of the default settings for the active network. (This is not the default for mainnet)
--rejectnonstd
Reject non-standard transactions regardless of the default settings for the active network. (This is the default for mainnet)
--allowoldvotes
Enable the addition of very old votes to the mempool
Mining Options and Policy
Description
--generate
Generate (mine) coins using the CPU
--miningaddr=
Add the specified payment address to the list of addresses to use for generated blocks. At least one address is required if the generate option is set
--blockminsize=
DEPRECATED: This behavior is no longer available and this option will be removed in a future version of the software.
Minimum block size in bytes to be used when creating a block
--blockmaxsize=
Maximum block size in bytes to be used when creating a block (default: 375000)
--blockprioritysize=
DEPRECATED: This behavior is no longer available and this option will be removed in a future version of the software.
Size in bytes for high-priority/low-fee transactions when creating a block (default: 20000)
--miningtimeoffset=
Offset the mining timestamp of a block by this many seconds (positive values are in the past)
--nonaggressive
Disable mining off of the parent block of the blockchain if there aren’t enough voters
--nominingstatesync
Disable synchronizing the mining state with other nodes
--allowunsyncedmining
Allow block templates to be generated even when the chain is not considered synced on networks other than the main network. This is automatically enabled when the simnet option is set. Don’t do this unless you know what you’re doing
Indexing
Description
--txindex
Maintain a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC
--droptxindex
Deletes the hash-based transaction index from the database on startup and then exits.
--noexistsaddrindex
Disable the exists address index, which tracks whether or not an address has even been used.
--dropexistsaddrindex
Deletes the exists address index from the database on startup and then exits.
IPC (Interprocess Communication)
Description
--piperx=
File descriptor of read end pipe to enable parent -> child process communication
--pipetx=
File descriptor of write end pipe to enable parent <- child process communication
--lifetimeevents
Send lifetime notifications over the TX pipe
--boundaddrevents
Send notifications with the locally bound addresses of the P2P and RPC subsystems over the TX pipe
dcrwallet
Click to expand full list of
dcrwallet
CLI arguments
General
Description
-C
or
--configfile=
Path to configuration file (default:
~/.dcrwallet/dcrwallet.conf
)
-V
or
--version
Display version information and exit
--create
Create the wallet if it does not exist
--createtemp
Create a temporary simulation wallet (pass=password) in the data directory indicated; must call with
--appdata
--createwatchingonly
Create the wallet and instantiate it as watching only with an HD extended pubkey
-A
or
--appdata=
Application data directory for wallet config, databases and logs (default:
~/.dcrwallet
)
--testnet
Use the test network
--simnet
Use the simulation test network
--noinitialload
Defer wallet creation/opening on startup and enable loading wallets over RPC
-d
or
--debuglevel=
Logging level {trace, debug, info, warn, error, critical} – You may also specify
<subsystem>=<level>,<subsystem2>=<level>,...
to set the log level for individual subsystems – Use
show
to list available subsystems (default: info)
--logdir=
Directory 프로젝트로 돌아가기