Skip to content

Commit aea06fd

Browse files
authored
Merge pull request #1253 from ipfs/snapshot
snapshot case study
2 parents 12c50cd + 738e6b6 commit aea06fd

File tree

8 files changed

+152
-0
lines changed

8 files changed

+152
-0
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ module.exports = {
151151
['/concepts/case-study-fleek', 'Fleek'],
152152
['/concepts/case-study-likecoin', 'LikeCoin'],
153153
['/concepts/case-study-morpheus', 'Morpheus.Network'],
154+
['/concepts/case-study-snapshot', 'Snapshot']
154155
]
155156
},
156157
{

docs/concepts/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Get inspired by usage ideas, explore examples of IPFS implemented in the wild, a
4646
- [Case study: Fleek](case-study-fleek.md)
4747
- [Case study: LikeCoin](case-study-likecoin.md)
4848
- [Case study: Morpheus.Network](case-study-morpheus.md)
49+
- [Case study: Snapshot](case-study-snapshot.md)
4950

5051
## Content-addressed storage
5152

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
title: 'Case study: Snapshot & IPFS'
3+
description: Explore how the leading decentralized gasless voting platform Snapshot uses IPFS as its main storage layer.
4+
---
5+
6+
# Case study: Snapshot
7+
8+
::: callout
9+
**"IPFS is the standard for storing data in a verifiable and fully transparent way, thereby allowing us to build openly auditable governance systems"**
10+
11+
_— [Fabien](https://twitter.com/bonustrack87), Founder and CEO, Snapshot Labs_
12+
:::
13+
14+
## Overview
15+
16+
In this case study, you'll learn how [Snapshot](https://snapshot.org/) works and how it uses IPFS to lower the barriers to entry for voting and community governance.
17+
18+
## What is Snapshot
19+
20+
::: right
21+
<img src="./images/case-studies/logo-snapshot.png" alt="Snapshot logo" width="200">
22+
:::
23+
24+
Snapshot is an open-source **voting platform** for Web3 projects, DAOs, and communities that uses IPFS as its main storage layer.
25+
Snapshot works with projects deployed to Ethereum and EVM compatible chains and allows the use of governance tokens as a means to distribute voting power and eligibility.
26+
27+
Snapshot is unique in its use of IPFS to store proposals and user votes using a technique known as ‘off-chain’ voting, where the cryptographic signatures proving user votes are persisted to IPFS instead of being stored on the blockchain.
28+
29+
This means that voting with Snapshot is practically free since voters don’t need to pay gas for transactions, i.e. *gasless voting*. In doing so, Snapshot lowers the barrier to entry for voting, increases governance participation, and allows projects and communities to scale their voter base.
30+
31+
Transparency, one of the core tenets of governance in the Web3 space, is achieved by having all proposals and votes persisted using _content addressing_ on IPFS, thereby allowing anyone to view, audit, and replicate a copy of the CIDs containing the cryptographic signature.
32+
33+
Web3 projects and Decentralized Autonomous Organizations (DAOs) are typically characterized by their bottom-up approach to governance, where control is spread out across the participants (or token holders), rather than being built on a top-down hierarchy. While there are many different approaches to bottom-up community governance, almost all involve _voting_ as a mechanism to engage the community and distribute control.
34+
35+
In essence, Snapshot allows projects and DAOs aiming for decentralization to poll their community over which direction a project should move in.
36+
37+
### Snapshot by the numbers
38+
39+
<NumberBlock :items="[
40+
{value: '7M ', text:'CIDs'},
41+
{value: '5M', text: 'Votes cast'},
42+
{value: '&gt;9K', text: 'Projects & DAOs on Snapshot'},
43+
{value: '63K', text: 'Proposals created on Snapshot'}
44+
]" />
45+
46+
## The story
47+
48+
Snapshot was originally built while Fabien, Snapshot's founder, was working for the automated market maker [Balancer](https://balancer.fi/). The goal was to create a voting platform that would be flexible enough to grant BAL tokens within [Balancer pools](https://docs.balancer.fi/products/balancer-pools) voting power. However, doing this on-chain turned out to be too computationally heavy to be feasible. That's when he realized that doing it off-chain with IPFS could provide them with the flexibility needed.
49+
50+
While free ("gassless") voting was not one of the initial requirements for Balancer, it came as a serendipitous bonus of the off-chain design with IPFS.
51+
52+
Two weeks later, Fabien began generalizing his gas-efficient implementation using IPFS so that could be used by projects and DAOs beyond Balancer – and Snapshot was born.
53+
54+
After open-sourcing an early version of Snapshot, it was quickly adopted by early DeFi projects like Yam and Yearn and has since taken over the governance landscape.
55+
56+
Today, Snapshot is the leading voting platform used by over 9,645 projects. Their users include many of the leading Ethereum projects, including Gitcoin, Ethereum Name System (ENS), Aave, Uniswap, and Sushi.
57+
58+
## How Snapshot works
59+
60+
In Snapshot, all proposals and votes are associated with a **space,** where each space is an organization’s (or project’s) page on Snapshot. Voters can access spaces by using the project's [Ethereum Name System (ENS)](http://ens.domains/) name, e.g. `https://snapshot.org/#/gitcoindao.eth`, where `gitcoindao.eth` is the ENS name.
61+
62+
The only requirement for using Snapshot is to have an ENS name. To create a space, you create an [ENS text record](https://docs.ens.domains/ens-improvement-proposals/ensip-5-text-records) with the key `snapshot` pointing to an IPFS CID containing the JSON configuration for the space. For example, GnosisDAO with the [gnosis.eth ENS name has the `snapshot`](https://app.ens.domains/name/gnosis.eth/details) text record set to [`ipfs://QmWUemB5QDr6Zkp2tqQRcEW1ZC7n4MiLaE6CFneVJUeYyD`](https://ipfs.io/ipfs/QmWUemB5QDr6Zkp2tqQRcEW1ZC7n4MiLaE6CFneVJUeYyD) which contains the JSON configuration for the space.
63+
64+
![ENS configuration for Snapshot on IPFS](./images/case-studies/img-snapshot-ens-config.png)
65+
66+
Each space configuration in Snapshot allows you to configure various **strategies** to determine:
67+
68+
- Who can participate in voting, e.g. token holders of an ERC-20 token or NFT tokens (ERC-721, and ERC-1155.)
69+
- The voter's voting power, e.g. one vote per token.
70+
- Who submit proposals to be voted on, e.g. token holders with a given minimum number of tokens.
71+
72+
For example, the ENS project requires holding the ENS token to vote on proposals and at least 10k ENS tokens to create proposals.
73+
74+
### Participants vote on proposals
75+
76+
Once a space is created, voting happens through **proposals**. A proposal describes the issue of a vote and also has a voting system that determines the choices voters can select, and how the results will be calculated.
77+
78+
Importantly, each proposal includes a **Snapshot block number** pointing to an Ethereum (or any other supported blockchain) block number. The block number is the snapshot where the balance of voters will be counted. This prevents manipulation by the temporary acquisition of tokens after a proposal is made.
79+
80+
### Calculating results
81+
82+
To calculate the results of a vote, each proposal employs one of the following **voting systems**:
83+
84+
- Single choice
85+
- Approval voting, where a voter can select multiple choices
86+
- [Quadratic voting](https://en.wikipedia.org/wiki/Quadratic_voting)
87+
- Weighted voting
88+
- [and others](https://docs.snapshot.org/proposals/voting-types)
89+
90+
These voting systems are used to calculate the results of a vote based on the voting power. For example, the [following proposal](https://snapshot.org/#/decrypt-media.eth/proposal/QmPDpQSZuokqGpzqtPbmLp1LTqDjbhd6vCeKaSmqEXM9KH)) in the [Decrypt Media](https://decrypt.co/) space, grants Decrypt NFT holders the right to choose a single topic for the content they will write next. Voting power for this proposal is relative to the number of Decrypt NFTs held by the voter at block number `12,811,388`.
91+
92+
![Decrypt content proposal](./images/case-studies/img-snapshot-decrypt-proposal.png)
93+
94+
## How Snapshot uses IPFS
95+
96+
Snapshot uses IPFS to make the whole voting process fully transparent and auditable. Every space, proposal, vote, and user action is added to IPFS and has a [content identifier (CID)](/concepts/content-addressing/).
97+
98+
Additionally, the Snapshot UI is also [available on IPFS](https://bafybeihzjoqahhgrhnsksyfubnlmjvkt66aliodeicywwtofodeuo2icde.ipfs.dweb.link/) and linked using the ENS name `shot.eth` which is accessible via any ENS resolution service, e.g. [shot.eth.limo](https://shot.eth.limo/), and [shot.eth.link](https://shot.eth.link/) (see the `x-ipfs-path` and `X-Ipfs-Roots` headers when making an HTTP request.)
99+
100+
To understand how Snapshot uses IPFS, it's useful to understand how the whole architecture was designed. Snapshot is a hybrid app combining design patterns common to Web2 and Web3 apps, and is based on the three-tier architecture:
101+
102+
- **Presentation tier:** [The Snapshot UI](https://github.com/snapshot-labs/snapshot).
103+
- **Logic tier:** The [snapshot-hub](https://github.com/snapshot-labs/snapshot-hub) node.js server that exposes a GraphQL API.
104+
- **Data tier:** A combination of a MySQL database for indexing and querying and IPFS as its storage layer for space configuration, proposals, user actions, and votes.
105+
106+
> **Note:** Even though MySQL is used for querying, all data stored on MySQL is available on IPFS. [Tables in the database schema](https://github.com/snapshot-labs/snapshot-hub/blob/master/src/helpers/schema.sql) have an `ipfs` field holding the IPFS CID.
107+
108+
![Snapshot architecture](./images/case-studies/img-snapshot-architecture.png)
109+
110+
### Uploading to IPFS pinning services with Pineapple
111+
112+
To make it easier to persist data to IPFS, Snapshot built a microservice called [Pineapple](https://github.com/snapshot-labs/pineapple) and a client library called [pineapple.js](https://github.com/snapshot-labs/pineapple.js). Together they abstract the details of uploading content to multiple IPFS pinning services.
113+
114+
pineapple.js exposes a `pin` method that takes a JSON object and sends it to the microservice over HTTP. The Pineapple microservice, races uploading the JSON to multiple IPFS pinning services and returns a response as soon as at least one of the services responds with a success. Additionally, the data is also uploaded to AWS S3.
115+
116+
### Open access via IPFS Gateways
117+
118+
After data is added to the IPFS network via pinning services, it is also made available for viewing by users via an [IPFS Gateway](/concepts/ipfs-gateway/). Links to the signed messages for [proposals](https://snapshot.mypinata.cloud/ipfs/bafkreigva2y23hnepirhvup2widmawmjiih3kvvuaph3a7mrivkiqcvuki) and [votes](https://snapshot.mypinata.cloud/ipfs/bafkreibozdzgw5y5piburro6pxspw7yjcdaymj3fyqjl2rohsthnqfwc6e) are integrated into the Snapshot UI.
119+
120+
## IPFS benefits
121+
122+
When the Snapshot team set out to build openly auditable voting systems, they chose IPFS because it’s the standard for storing data that must be fully verifiable, but is too large to store on blockchains.
123+
124+
The combination of user-controlled keys (via non-custodial crypto wallets), cryptographic signatures that prove the authenticity of user actions, and content addressable storage via the IPFS network have proven to be critical to Snapshot's success.
125+
126+
Moreover, IPFS has several properties that enable that mission:
127+
128+
- Proof of data integrity via IPFS content addressing
129+
- Ability to store data, even in perpetuity, without having to rely on a single centralized cloud storage platform.
130+
- Interoperability with multiple storage providers and pinning services. Once the data has been uploaded to a single pinning service on IPFS, it can move around easily and be stored on multiple pinning services to ensure redundancy.
131+
- Transparency and availability of data give anyone the ability to also pin and audit that data.
132+
- A thriving ecosystem of pinning services and open-source tooling
133+
134+
## Snapshot & IPFS: the future
135+
136+
As Snapshot continues to evolve, the team looks forward to decentralizing its tech stack so that anyone can run a node, reducing the dependency on the Snapshot Node.js servers. Thanks to IPFS's integral role in Snapshot, a significant part of their data layer is already decentralized.
137+
138+
::: callout
139+
**"Anytime we need to store data in Snapshot, we use IPFS so that users get full transparency and the ability to also take an active part in replicating that data."**
140+
141+
_&mdash; Fabien, Founder and CEO, Snapshot Labs_
142+
:::
143+
144+
_Note: Metrics and other details in this case study are current as of August 2022. Details may change in the interim._
101 KB
Loading
235 KB
Loading
211 KB
Loading
5.08 KB
Loading

docs/concepts/usage-ideas-examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ The [Brave](https://brave.com/) web browser has [built-in IPFS support](https://
2828

2929
A [dead drop](https://deaddrops.com/) is a drive or another storage device that is physically immobilized in a public location for people to pick up and deposit files. There is now an IPFS version, thanks to the [IPFS Dead Drop project](https://github.com/c-base/ipfs-deaddrop).
3030

31+
## Governance
32+
33+
### Voting and governance
34+
35+
[Snapshot](https://snapshot.org/) is a voting platform for Web3 projects, DAOs, and communities that uses IPFS as its main storage layer. Snapshot uses IPFS to store proposals and user votes using a technique known as ‘off-chain’ voting, where the cryptographic signatures proving user votes are persisted to IPFS instead of being stored on the blockchain.
36+
3137
## Collaborate
3238

3339
Let IPFS coordinate the flow of data between you and your colleagues, even when working offline or on a local network.

0 commit comments

Comments
 (0)