decred / dcrdocs

Documentation for Decred.
https://docs.decred.org
ISC License
81 stars 129 forks source link

Explain difference between stateless transactions vs. stateful transactions #970

Open s-ben opened 5 years ago

s-ben commented 5 years ago

Per @davecgh suggestion, we should make more clear the difference between standard stateless transactions (e.g. regular tree transactions) and special stateful transactions (e.g. stake tree transactions). Below I've collected all the relevant references to regular vs. state transactions I could find.

https://docs.decred.org/getting-started/using-the-block-explorer/#transactions https://docs.decred.org/glossary/#regular-transaction-tree https://docs.decred.org/glossary/#stakebase-transaction https://docs.decred.org/glossary/#coinbase-transaction https://docs.decred.org/advanced/transaction-details/

The Transaction Details page under /advanced has low-level technical details, but that is for a developer audience. The glossary has basic definitions for regular, stakebase and transaction trees, but does not address 'stateful' and 'stateless' nature of transactions, or give context for why the user should care. The How to Use the Block Explorer page just lists some variables you can look up for standard transactions and tickets. Ideas for how to better convey this?

davecgh commented 5 years ago

To clarify a bit more what I'm referring to, regular transaction scripts are stateless in the sense they have no access to global state. The only information available to them is the input script and the transaction itself. This requirement supports pruning and provides optimization opportunities such as caching because there is no additional state that can change out from under cached results.

On the other hand, stake transactions are stateful in the sense they require access to global state such as live, expired, and missed tickets and tickets that are eligible to vote on a given block. This means they require additional special handling.

s-ben commented 5 years ago

Perhaps this is better to include in the devdocs now that we're doing that? Could go under Core Blockchain Concepts -> Transactions