Categorygithub.com/coolsnady/dcrd
modulepackage
1.2.0
Repository: https://github.com/coolsnady/dcrd.git
Documentation: pkg.go.dev

# README

dcrd

Build Status ISC License GoDoc

dcrd is a Decred full node implementation written in Go (golang).

This acts as a chain daemon for the Decred cryptocurrency. dcrd maintains the entire past transactional ledger of Decred and allows relaying of transactions to other Decred nodes across the world. To read more about Decred please see the project documentation.

Note: To send or receive funds and join Proof-of-Stake mining, you will also need dcrwallet.

This project is currently under active development and is in a Beta state. It is extremely stable and has been in production use since February 2016.

It is forked from btcd which is a bitcoin full node implementation written in Go. btcd is a ongoing project under active development. Because dcrd is constantly synced with btcd codebase, it will get the benefit of btcd's ongoing upgrades to peer and connection handling, database optimization and other blockchain related technology improvements.

Requirements

Go 1.9 or newer.

Getting Started

  • dcrd (and utilities) will now be installed in either $GOROOT/bin or $GOPATH/bin depending on your configuration. If you did not already add the bin directory to your system path during Go installation, we recommend you do so now.

Updating

Windows

Install a newer MSI

Linux/BSD/MacOSX/POSIX - Build from Source

  • Dep

    Dep is used to manage project dependencies and provide reproducible builds. To install:

    go get -u github.com/golang/dep/cmd/dep

Unfortunately, the use of dep prevents a handy tool such as go get from automatically downloading, building, and installing the source in a single command. Instead, the latest project and dependency sources must be first obtained manually with git and dep, and then go is used to build and install the project.

Getting the source:

For a first time installation, the project and dependency sources can be obtained manually with git and dep (create directories as needed):

git clone https://github.com/decred/dcrd $GOPATH/src/github.com/decred/dcrd
cd $GOPATH/src/github.com/decred/dcrd
dep ensure
go install . ./cmd/...

To update an existing source tree, pull the latest changes and install the matching dependencies:

cd $GOPATH/src/github.com/decred/dcrd
git pull
dep ensure
go install . ./cmd/...

For more information about Decred and how to set up your software please go to our docs page at docs.decred.org.

Docker

All tests and linters may be run in a docker container using the script run_tests.sh. This script defaults to using the current supported version of go. You can run it with the major version of Go you would like to use as the only arguement to test a previous on a previous version of Go (generally Decred supports the current version of Go and the previous one).

./run_tests.sh 1.9

To run the tests locally without docker:

./run_tests.sh local

Contact

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

  • irc.freenode.net (channel #decred)
  • webchat
  • forum.decred.org
  • decred.slack.com

Issue Tracker

The integrated github issue tracker is used for this project.

Documentation

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

License

dcrd is licensed under the copyfree ISC License.

# Packages

Package addrmgr implements concurrency safe Decred address manager.
Package blockchain implements Decred block handling and chain selection rules.
Package bloom provides an API for dealing with decred-specific bloom filters.
Package certgen includes a common base for creating a new TLS certificate key pair.
Package chaincfg defines chain configuration parameters.
No description provided by the author
Package connmgr implements a generic Decred network connection manager.
Package database provides a block and metadata storage database.
No description provided by the author
Package dcrjson provides primitives for working with the Decred JSON-RPC API.
Package dcrutil provides decred-specific convenience functions and types.
Package gcs provides an API for building and using a Golomb-coded set filter.
Package hdkeychain provides an API for Decred hierarchical deterministic extended keys (based on BIP0032).
Package limits allows to raises some process limits.
Package mempool provides a policy-enforced pool of unmined Decred transactions.
Package mining includes all mining and policy types, and will house all mining code in the future.
Package peer provides a common base for creating and managing Decred network peers.
Package rpcclient implements a websocket-enabled Decred JSON-RPC client.
Package rpctest provides a dcrd-specific RPC testing harness crafting and executing integration tests by driving a `dcrd` instance via the `RPC` interface.
Package sampleconfig provides a single constant that contains the contents of the sample configuration file for dcrd.
Package txscript implements the Decred transaction script language.
Package wire implements the Decred wire protocol.

# Functions

Discover searches the local network for a UPnP router returning a NAT for the network if so, nil if not.
NewBlockTemplate returns a new block template that is ready to be solved using the transactions from the passed transaction source pool and a coinbase that either pays to the passed address if it is not nil, or a coinbase that is redeemable by anyone if the passed address is nil.
SortParentsByVotes takes a list of block header hashes and sorts them by the number of votes currently available for them in the votes map of mempool.
UpdateBlockTime updates the timestamp in the header of the passed block to the current time while taking into account the median time of the last several blocks to ensure the new time is after that time per the chain consensus rules.
UpdateExtraNonce updates the extra nonce in the coinbase script of the passed block by regenerating the coinbase script with the passed value and block height.

# Constants

ErrCheckConnectBlock indicates that a newly created block template failed blockchain.CheckBlockSanity.
ErrCheckConnectBlock indicates that a newly created block template failed blockchain.CheckConnectBlock.
ErrCoinbaseLengthOverflow indicates that a coinbase length was overflowed, probably of a result of incrementing extranonce.
ErrCreatingCoinbase indicates that there was a problem generating the coinbase.
ErrFailedToGetGeneration specifies that the current generation for a block could not be obtained from blockchain.
ErrFetchTxStore indicates a transaction store failed to fetch.
ErrFraudProofIndex indicates that there was an error finding the index for a fraud proof.
ErrGetStakeDifficulty indicates that the current stake difficulty could not be obtained.
ErrGettingDifficulty indicates that there was an error getting the PoW difficulty.
ErrGettingMedianTime indicates that the server was unable to get the median adjusted time for the network.
ErrGetStakeDifficulty indicates that the current top block of the blockchain could not be obtained.
ErrNotEnoughVoters indicates that there were not enough voters to build a block on top of HEAD.
ErrTransactionAppend indicates there was a problem adding a msgtx to a msgblock.

# Variables

ErrClientQuit describes the error where a client send is not processed due to the client having already been disconnected or dropped.
ErrInvalidLongPoll is an internal error code to indicate that longpollid is not formated properly.
ErrRPCNoWallet is an error returned to RPC clients when the provided command is recognized as a wallet command.
ErrRPCUnimplemented is an error returned to RPC clients when the provided command is recognized, but not implemented.

# Structs

BlockTemplate houses a block that has yet to be solved along with additional details about the fees and the number of signature operations for each transaction in the block.
CPUMiner provides facilities for solving blocks (mining) using the CPU in a concurrency-safe manner.
MiningRuleError identifies a rule violation.
StakeDifficultyNtfnData is the data that is used to generate stake difficulty notifications.
WinningTicketsNtfnData is the data that is used to generate winning ticket notifications (which indicate a block and the tickets eligible to vote on it).

# Interfaces

NAT is an interface representing a NAT traversal options for example UPNP or NAT-PMP.

# Type aliases

MiningErrorCode identifies a kind of error.