> For the complete documentation index, see [llms.txt](https://davidjosearaujo.gitbook.io/online-courses/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davidjosearaujo.gitbook.io/online-courses/blockchain-security/consensus-algorithm-security/proof-of-stake.md).

# Proof of stake

We start by discussing proof of work, the original blockchain consensus algorithm, including how it works, its limitations, and common attacks against it. Then, we move on to proof of stake, which is a popular **alternative to proof of work**. We learn how proof of stake works, how it can be attacked, and its advantages over proof of work.

**Proof of stake uses the principle of security via scarcity**, where the amount of cryptocurrency you own determines your power on the blockchain. **Users can stake their cryptocurrency, committing not to spend it, and in exchange, they have a chance of being selected to create blocks.** It's like participating in a raffle, where the more tickets you have, the higher your chances of winning a prize. Unlike a raffle, you can withdraw your stake at any time and get your money back, but you won't be part of the block creation process anymore. Proof of stake offers a more efficient and cost-effective way to secure the blockchain network.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://davidjosearaujo.gitbook.io/online-courses/blockchain-security/consensus-algorithm-security/proof-of-stake.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
