Skip to content

DAO DAO Infrastructure

noah edited this page Feb 3, 2023 · 7 revisions

Introduction

DAO DAO is a blockchain application. What this means is that the DAO's existence and core logic (voting, managing money, etc.) are guaranteed by a blockchain. The data lives on the blockchain, and the data is updated by logic in smart contracts running on the blockchain. This replaces the traditional "backend" API server used by web2 applications.

In order to offer all features supported by the DAO DAO webapp, DAO DAO manages many services that do not live on the blockchain (also known as off-chain). DAO DAO's infrastructure is detailed below.

Blockchain

The smart contracts that run on a blockchain can be found in the dao-contracts repository. The code IDs of the deployed contracts can be found in each release on the releases page of that repo.

Next.js

The frontend is written using Next.js in TypeScript and hosted on Vercel. The code can be found in the repo you're currently viewing, or here if for some reason you're not.

The DAO DAO frontend is mostly served statically, but there are a few serverless API functions that handle:

  • retrieving data from the indexer (with a private token)
  • uploading images and NFT metadata to NFT.Storage (with a private token)
  • resetting the page cache for a DAO when a proposal is executed

Indexer

DAO DAO uses a custom-built CosmWasm indexer that indexes the state of smart contracts on the blockchain. It can be found here. The indexer is deployed on a https://www.digitalocean.com/ droplet.

Search

DAO search uses a Meilisearch instance hosted on a https://www.digitalocean.com/ droplet. The Meilisearch indexes are populated by the indexer.

Example code that uses the meilisearch npm package can be found here.

If the example code above is insufficient, the Meilisearch search docs are the best place to look for usage instructions.

value.contractAddress and value.proposalCount can be filtered, and blockHeight and value.proposalCount can be sorted.

Connection Info

Host: https://search.daodao.zone

API Key: 420b1cae24ffc324a766566813feca6940727ae1a41aa6a1c8d408bae7a1cdfd

Indexes:

Name Description
daos DAOs on Juno Mainnet
testnet_daos DAOs on Juno Testnet

Profiles

DAO DAO profiles, which simply map a name and NFT-owned image to a secp256k1 public key used by the Cosmos SDK, are managed by a Cloudflare Worker running pfpk. The repo's README contains API docs which explain how to retrieve a profile, update a profile, and search for profiles with a name prefix.

Payroll

DAO DAO supports various payroll structures, but only one requires an off-chain service: retroactive compensation. A Cloudflare Worker runs retroactive-compensation-cf-worker, which manages the survey cycle wherein submissions are accepted and then rated by DAO members before a proposal is proposed on-chain to the DAO. The frontend code that uses this API can be found here.

Following

To manage the list of DAOs a user follows, DAO DAO uses a Cloudflare Worker running following-daos-cf-worker. The indexer sends a webhook to this worker when a user's membership in a DAO changes, which adds it to a user's pending list. Pending DAOs are shown to the user and are either followed or ignored, removing them from the pending list. The frontend code that uses this API to fetch and update following DAOs can be found here, and the code that fetches and updates pending DAOs can be found here.

KV

Some features simply need access to a key-value store attached to a given wallet. An authenticated location to store tiny pieces of state to provide a seamless cross-browser experience for a given identity. DAO DAO uses a Cloudflare Worker running kvpk, which simply wraps the a Cloudflare KV Store to provide authenticated access. This works with a secp256k1 public key used by the Cosmos SDK.

The service above that manages followed DAOs was built before kvpk and works very similarly; however, it needs to allow the indexer to update the pending list of DAOs.

Checkmarks

Checkmark identity verification is managed by a [Cloudflare Worker] (https://developers.cloudflare.com/workers) running pending-checkmarks-cf-worker. This handles authenticating private keys and managing the verification process with the identity verification provider. It verifies payments and controls the wallet that can assign checkmarks.