Audius Developer Documentation
website·Indexed 40 days ago
https://docs.audius.co/Documentation for building on Audius, a decentralized music platform. Includes the Audius API Reference, JavaScript (TypeScript) SDK, and community projects like the Go SDK and Unreal Engine Plugin. Covers OAuth authentication, track and playlist management, audio uploads, user data retrieval, and the GraphQL API endpoint hosted by The Graph for Ethereum Mainnet contract data.
What's inside Audius
- Hedgehog is an open-source, client-side Ethereum wallet that allows users to interact with DApps using a username and password, removing the need for browser extensions like MetaMask. It manages the user's private key and wallet within the browser, providing a familiar authentication experience across multiple devices. It is specifically designed for low-to-no financial value use cases where user experience (UX) is prioritized over the high-security friction of constant transaction confirmations.
Understand Audius on-chain governance and voting
Audius uses an on-chain governance system where $AUDIO holders can vote on proposals. For a proposal to pass, it must meet two criteria: a quorum of at least 5% of all staked $AUDIO must vote, and more than 50% of those votes must be 'For'. Currently, only node operators are permitted to make on-chain proposals. The general governance flow is: Community Feedback $\rightarrow$ Forum Post $\rightarrow$ Governance Portal $\rightarrow$ On-Chain Vote $\rightarrow$ Execution.Query Proposal entities in the Audius Subgraph
TheProposalentity tracks governance proposals on the Audius network. It includes metadata about the proposal, the proposer, the target contract to be executed, and the voting results.# Example fields available on the Proposal entity { proposal(id: "...") { name description proposer { id } targetContractAddress functionSignature callData outcome voteMagnitudeYes voteMagnitudeNo numVotes votes { id } } }Content Node technical stack and architecture
The Content Node is implemented as a NodeJS Express web server with an HTTP API for metadata and file uploads/retrieval. It utilizes the following infrastructure:
- Persistent Storage: A PostgreSQL database managed via the Sequelize ORM for pointers to content and metadata stored on the file system.
- Caching and Locking: A Redis client (via the
ioredisnpm package) for resource locking, request rate limiting, and caching. - Audio Processing: FFMPEG is used to segment and transcode uploaded track files before storage and serving.
- Redundancy: Nodes automatically monitor each other to ensure minimum data redundancy by transferring files as required.
Understand the role of Audius Content Nodes
An Audius Content Node (also known as a Creator Node) is a service responsible for storing and maintaining the availability of all content across the network, including user/track/playlist metadata, images, artwork, and audio files. Its primary design goals are to surface the Audius Storage Protocol, ensure data replication and availability, provide interfaces for content upload/transcoding/identification, and allow users agency over their data storage.Understand the role of Audius Discovery Nodes
An Audius Discovery Node (also known as a Discovery Provider) indexes metadata and data availability across the protocol to allow users to query information about users, tracks, albums, playlists, and social features. It exposes this data via a RESTful API. Its primary goals are to provide queryable endpoints, reliably store blockchain events, and continuously monitor the blockchain to keep data current.Use the Harmony design system in Audius apps
Applications initialized viacreate-audius-appuse the Harmony design system, which provides a shared language and reusable components to ensure consistency between Figma designs and code across platforms. Documentation is available at https://harmony.audius.co/.Retrieve a user profile by ID using getUser
UseaudiusSdk.users.getUserto fetch detailed information about a specific user. The method requires a user ID and returns a promise containing a user data object including profile details, wallet addresses, and social counts. An optionalRequestInitobject can be passed as the second argument to customize the fetch request.const { data: user } = await audiusSdk.users.getUser({ id: 'eAZl3', }) console.log(user)Query on-chain governance data using the Audius Subgraph
Audius provides a GraphQL API endpoint hosted by The Graph (a subgraph) specifically for indexing and organizing data from Audius smart contracts on the Ethereum Mainnet. This is primarily used to explore on-chain governance data.PlaylistResponse object reference
ThePlaylistResponseobject contains detailed information about a playlist, including its metadata, ownership, and track contents.{ artwork: { _1000x1000: string, _150x150: string, _480x480: string }, coverArtSizes: string, // CID of cover art sizes description: string, favoriteCount: number, id: string, isAlbum: boolean, isImageAutogenerated: boolean, isPrivate: boolean, permalink: string, playlistContents: Array<{ trackId: string, timestamp: number, metadataTimestamp: number }>, playlistName: string, repostCount: number, totalPlayCount: number, user: object // The playlist owner }Discovery Node technical stack and architecture
The Discovery Node uses a combination of Python-based services and indexing tools:
- Web Server: A Flask application that serves as the entry point for the Open Audio Protocol, returning JSON objects parsed from SQLAlchemy queries.
- Database: PostgreSQL managed through SQLAlchemy (ORM) and Alembic (migration tool).
- Task Queue: Celery is used for background tasks. A Celery Worker executes the
index_blockstask to process blockchain transactions and update the database, while Celery Beat schedules these tasks (default interval is 5 seconds). - Caching and Broker: Redis is used for internal/external caching, as the Celery broker, and for locking execution contexts.
- Search and Discovery: Elastic Search is used to denormalize data for feeds, search, and related artist queries. Data is populated via database triggers and the
es-indexerETL code.
Understand Audius Network Architecture and User Roles
Audius is a decentralized streaming protocol consisting of three primary user roles:
- Artists: Upload tracks, create albums, and share content.
- Fans: Stream tracks, create playlists, and follow artists.
- Node Operators: Secure the network and serve app traffic by hosting Discovery and Content nodes.
Core Components:
- Content Nodes: Maintain availability of user content (metadata, images, audio) on IPFS.
- Discovery Nodes: Index and store Audius contract data from the Ethereum blockchain for API querying.
- Identity Service: Handles encrypted auth ciphertexts, Twitter OAuth, and relays transactions to pay gas for users.