Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: fabbit on January 15, 2020, 10:43:39 AM



Title: Stateless verification
Post by: fabbit on January 15, 2020, 10:43:39 AM
What are the advantages of a stateless verification?


Title: Re: Stateless verification
Post by: BitMaxz on January 15, 2020, 10:51:31 PM
You might need to read the "Mastering Bitcoin by Andreas M. Antonopoulos" from here below to get some idea.

- https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch05.html


Title: Re: Stateless verification
Post by: fabbit on January 16, 2020, 12:18:06 AM
You might need to read the "Mastering Bitcoin by Andreas M. Antonopoulos" from here below to get some idea.

- https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch05.html


Actually I read that part of the book but I didn't understand it very well


Title: Re: Stateless verification
Post by: squatter on January 16, 2020, 02:45:18 AM
You might need to read the "Mastering Bitcoin by Andreas M. Antonopoulos" from here below to get some idea.

- https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch05.html
Actually I read that part of the book but I didn't understand it very well

This bit is important:

Quote
Bitcoin scripts have limited complexity and predictable execution times. Script is not a general-purpose language. These limitations ensure that the language cannot be used to create an infinite loop or other form of “logic bomb” that could be embedded in a transaction in a way that causes a denial-of-service attack against the bitcoin network. Remember, every transaction is validated by every full node on the bitcoin network. A limited language prevents the transaction validation mechanism from being used as a vulnerability.

Compare this to Ethereum, which was persistently attacked in 2016 with denial-of-service attacks (https://blog.ethereum.org/2016/09/22/ethereum-network-currently-undergoing-dos-attack/).

Another obvious advantage of Bitcoin's model is superior long term scalability. Bitcoin only retains a very limited form of state -- namely, the blockchain and the UTXO set. In Ethereum, by comparison, each block contains a "state root" which stores the entire state of the network -- account nonces, account balances, contract bytecode, contract storage. Ethereum allows for much more complexity and functionality vis-a-vis contract programming and is thus considered "stateful" (while Bitcoin is considered "stateless") but it comes at great cost (https://blog.ethereum.org/2015/06/26/state-tree-pruning/):

Quote
Eventually, as a node processes every block, we can thus expect the total disk space utilization to be, in computer science terms, roughly O(n*log(n)), where n is the transaction load. In practical terms, the Ethereum blockchain is only 1.3 gigabytes, but the size of the database including all these extra nodes is 10-40 gigabytes.

Ultimately, this is probably why the number of Ethereum nodes has plummeted (https://www.trustnodes.com/2019/12/19/bitcoin-now-has-thousands-more-nodes-than-ethereum) during a period where the number of reachable Bitcoin nodes has steadily grown. To counter unsustainable state growth, Ethereum will need to implement schemes like state rent (https://ethereum-magicians.org/t/state-rent-proposal-version-2-rushed/2494).


Title: Re: Stateless verification
Post by: fabbit on January 16, 2020, 11:26:42 PM
I don't understand this:
Quote
If your system verifies a script, you can be sure that every other system in the bitcoin network will also verify the script, meaning that a valid transaction is valid for everyone and everyone knows this.
If a transaction is valid for everyone and everyone knows, why is the transaction broadcasted?


Title: Re: Stateless verification
Post by: pooya87 on January 17, 2020, 04:15:45 AM
If a transaction is valid for everyone and everyone knows, why is the transaction broadcasted?

if you don't broadcast the transactions then how are you going to let everyone else know that you have spent some "coins" (aka transaction outputs) and let every node that holds the blockchain (that contains these coins) update their database?


Title: Re: Stateless verification
Post by: fabbit on January 17, 2020, 11:29:02 AM
Mh I mean when a node received the broadcasted transaction why does the node check for transaction's validation? I mean the node should already known that the transaction is valid for stateless verification principle.


Title: Re: Stateless verification
Post by: ranochigo on January 18, 2020, 08:14:35 AM
Mh I mean when a node received the broadcasted transaction why does the node check for transaction's validation? I mean the node should already known that the transaction is valid for stateless verification principle.
Stateless verification only means that the information required to validate a script is contained within the script itself. This does not necessary mean that a script is guaranteed to be valid. This only means that the script will be executed the same way on every client. The only way for the individual clients to know if a script is valid is that if they check for it themselves.


Title: Re: Stateless verification
Post by: fabbit on January 19, 2020, 10:51:30 PM
But if a script will be executed the same way in every client, if my node verifies the script than all other nodes verify the script too, because the behaviour is the same in every node?