Decred's Technology Stack Overview

Decred's Technology Stack Overview
Decred's Technology Stack Overview
Decred Technology Stack

Decred is less than seven years old and during this time has built a platform that embraces the ethos of open-source, permissionless, non-custodial, decentralisation. The set of questions, I have for this series of articles, are:

  • How does this stuff work?
  • How does the technology connect?
  • And how do you build on the platform?

This is no small undertaking, but in this article, I’m going to start by doing an overview of Decred’s technology stack and how the components come together to form the peer to peer network. If this subject interests you, follow along, and please have no hesitation to add your input.

As a quick review, Decred is a blockchain-based cryptocurrency with a strong focus on community input, open governance, and sustainable funding for development. It utilises a hybrid proof-of-work and proof-of-stake mining system to ensure that a small group cannot dominate the flow of transactions or make changes to Decred without the input of the community. A unit of the currency is called a decred (DCR) and the smallest fraction of DCR is an atom (0.00000001).

Decred’s software is made up of modules that enable the platform to run and for users, software, and hardware to interact with the network.

dcrd

The system starts with dcrd, which is a full node implementation of Decred, written in Go (golang). It acts as a fully-validating chain daemon and maintains the entire past transactional ledger of Decred and allows relaying of transactions to other Decred nodes around the world. Forming the peer-to-peer network that is the backbone of the project. For reference, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user.

Running a full node with dcrd contributes to the overall security of the network. Increases the available paths for transactions and blocks to relay, and helps ensure there are an adequate number of nodes available to serve lightweight clients, such as Simplified Payment Verification (SPV) wallets.

dcrwallet

The next piece of software is dcrwallet, which is also a daemon, that handles Decred wallet functionality for a single user. It manages all of your accounts, addresses, and transactions; tracks balances across addresses; and allows stakeholders to participate in Proof-of-Stake voting. dcrwallet can connect to the Decred blockchain using either dcrd or by running in Simple Payment Verification (SPV) mode.

dcrctl

dcrctl is a 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 doesn’t run permanently in the background. It calls the requested RPC method, prints the response, and then terminates immediately.

SPV

Simple Payment Verification (SPV) allows the use of a Decred wallet without having to download the entire Decred blockchain. A wallet operating in SPV mode only needs to download full blocks containing transactions relevant to it (i.e. transactions involving the wallet’s addresses). In a typical case, this means downloading tens of megabytes, rather than multiple gigabytes. This reduces the wallet’s hardware requirements and greatly reduces the initial load time for new wallets.

SPV, isn’t technically a module, as it generally gets built into a wallet, this includes been built directly into the dcrwallet daemon.

Decred Technology Stack 1

VSPD and DCRPOOL

The next tools that interact with the chain are the staking and mining tools. Although VSPD and DCRPOOL are the tools provided by Decred, it’s also not uncommon for individual miners and pools to create their own software.

It’s important to note at this point, dcrwallet and dcrd have been integral for connecting the previous pieces of software to the chain.

DCRDATA

DCRDATA is the first instance where a module connects directly to dcrd to retrieve information from the Decred blockchain. DCRDATA is Decred’s block explorer, and it has access to the information and data recorded on-chain or the transactions that are currently sitting in the mempool. The aim with any block explorer is to give you real-time and historic information on how the blockchain is performing. A block explorer is an essential tool for people trying to find out if a project is viable. The visual feedback and transparency found in DCRDATA is unprecedented.

DCRDATA

Coinshuffle++

Another integral part of Decred’s network is the Coinshuffle++ mixing server (and eventual server mesh). Which allows the user to mix their coins for greater privacy. StakeShuffle is combined with the Decred ticket pool for a greater anonymity set.

Privacy is an important aspect of any cryptocurrency, as it helps prevent confiscation and maintains coin fungibility. Decred’s solution to this problem is relatively simple, elegant and allows for future chain pruning, auditable supply and high participation.

DCRTIME

DCRTIME is a timestamping application that allows users to store hashes of arbitrary data on the Decred blockchain. Technically individual hashes are not stored directly (it would allow to spam the blockchain with tons of hashes in each block and it would be expensive because each extra hash would increase the fee of the timestamping tx). Instead all hashes submitted for timestamping in a period of time are grouped into a structure called Merkle Tree, and a single hash of that is saved on the blockchain.

DCRTIME was originally built to store timestamped hashes of data from Politeia, Decred’s proposal system, on the Decred blockchain. It can, and is frequently used as a generic timestamping service, as we saw recently in the 2022 Brazilian presidential election

Brazil new President used Decred Blockchain to improve his campaign!
The 2022 Brazilian election, which held its second round on October 30, was the biggest in the history of Brazil’s young democracy. More than 120 million voters went to the polls in two rounds to elect representatives of the legislative and executive. People from all around the world turned their

Blockchain timestamping has yet to come of age, but I can see a future where this will be used in all kinds of industries. A good example could be, the use of timestamping for musicians and artists to copyright their work. This would demonstrate proof of ownership and proof that the work existed at a particular time.

timestamp.decred.org

Community memeber @bee added, "Timestamping alone is only a part of a system for proving ownership. In my book we don't have a complete solution for ownership proofs, that requires public key infrastructure (PKI) and people signing their content. Timestamping says "data X existed on Y or earlier" but nothing about who authored X. It's still pretty cool and necessary though."

Decrediton

Decrediton is the gateway wallet for general users that allows for full participation in the Decred network, from – sending and receiving coins, viewing transaction history; buying tickets; voting on proposals, consensus changes and treasury spends; participating in privacy mixing; and participating in Decred’s Lightning Network.

Decrediton has a visual interface and is easy to use for non-technical users. This contrasts with the dcrctl client, which offers similar functionality but is more suited to technical users.

Decrediton

TinyWallet 2

TinyWallet 2 is not currently production ready and isn’t officially part of the Decred technology stack, but it aims to fill a void. This product is a lite wallet which will fully interact with the Decred chain and the Lightning Network. Because it’s a lite wallet it will be mobile and web ready, meaning it will be able to run on most devices including mobile.

The mobile apps for Android and iOS are not currently in active development, this includes Decred Android, Decred iOS and GODCR. GODCR was aiming to replace both the Android and iOS wallets, but due to its proposal not being reapproved, all work has stopped. The hope is: A new developer will take up the mantle for this project, but the likelihood is TinyWallet 2 is currently our best hope for an official Decred mobile wallet.

This project could also be an ideal opportunity for anyone interested in helping out with Decred development. During a previous episode of “Decred and the state of the market” @BlockchainBuck put a call-out for any developers interested in helping him build out this project. https://youtu.be/n3welZEDchU

Tiny Wallet 2 Framework

Politeia

Politeia is a platform that supports Decred’s governance. It facilitates the submission, tracking, and discussion of Decred governance proposals by the stakeholder community. The Politeia web platform facilitates browsing, discussing and submitting proposals.

Voting on proposals does not happen directly on Politeia, as it requires signatures from your Decred wallet. Voting can be done from Decrediton or on the command line using the politeiavoter CLI tool.

Politeia currently runs two web platforms proposals.decred.org and cms.decred.org and is in the process of converting to a plugin architecture to increase its usability and usefulness as a Decred web platform. Current plugins include – User Authentication, User Identity, DCR Payments and Comments.

The future of Politeia is very exciting, imagine being able to spin up a website that includes Decred / crypto functionality and common web2 infrastructure. Instances could include:

  • Running a subscription service / paywall website
  • Running a digital marketplace
  • Running a community or social media hub.

Politeia could be the first web3 platform that facilitates these actions out of the box whilst having access to the full functionality of the Decred technology stack.

Politeia

@bee added, "Besides ticket voting, the killer feature of Pi in my mind is that each piece of data is signed by its author, and that there is an append-only (immutable) log of all data ever submitted. On Pi we have ownership proofs, in some form, you don't have that on Twitter or Reddit, and I bet they don't want such levels of accountability to play their games." Moving this forward, it would also be nice if "Pi would let me download all data at once like it was possible on the Git backend, but this feature has not been re-implemented on the new backend. Having access to all data is key to verify that the server is not cheating."

DCRDEX

With all the nonsense that’s happening in the centralised exchange world, it’s a breath of fresh air to know that Decred has built an alternative method of exchange not seen in crypto or traditional finance. The Decred decentralised exchange (DCRDEX) is a system that enables trustless exchange of different types of blockchain assets via a familiar market-based design. DCRDEX is a non-custodial solution for cross-chain exchange based on atomic swap technology. DCRDEX matches trading parties and facilitates price discovery and the communication of swap details.

Trades are performed directly between users through on-chain contracts with no actual reliance on DEX, though swap details must be reported both as a courtesy and to prove compliance with trading rules. Trades are settled on-chain with pure 4-transaction atomic swaps and nothing else.

  • No trading fees.
  • No intermediary coin (not even Decred DCR)
  • No middle men
  • No front-running

The future of DCRDEX will include more pairs, liquidity, internal wallets and improvements to the user experience. The development I’m most excited about is the mesh server, which allows server providers the ability to spin up a DCRDEX server and have it connect to all other servers and their order books.

DCRDEX

dcrlnd

The Decred Lightning Network Daemon (dcrlnd) – is a complete implementation of a Lightning Network node deployed on the Decred blockchain.

dcrlnd requires a dcrd backing full node to perform the required chain services. The project's codebase uses the existing set of decred libraries, and also exports a large set of isolated re-usable Lightning Network related libraries within it.

The Lightning Network aims to solve the on-chain scaling issue and is suitable for smaller transaction payments, e.g. 1000 atoms for a cup of coffee. As a side effect, it also helps maintain a smaller, more efficient blockchain.

As time moves forward, it’s likely that the bulk of merchant and consumer services will be set up using the Lightning Network, or other Layer 2 / 3 solution, rather than being performed directly on-chain.

In the current state, dcrlnd is capable of:

  • Creating channels.
  • Closing channels.
  • Completely managing all channel states (including the exceptional ones!).
  • Maintaining a fully authenticated + validated channel graph.
  • Performing path finding within the network, passively forwarding incoming payments.
  • Sending outgoing onion-encrypted payments through the network.
  • Updating advertised fee schedules.
  • Automatic channel management (autopilot).
Decred Lightning Network

Overview

As you can see, the building blocks for Decred are in place and the framework is very close to being ready to see a multitude of services built on top of the network.

In the coming articles, I’m aiming to investigate the inner workings of these components. I’m also interested to evaluate how services can build their products on the network and the kind of initiatives that we’re likely to see.

Decred Technology Stack - This chart is a continued work in progress

References:

Special thanks to @bee for their help with the accuracy of this piece and the technical specification.