# Publishing Source
The Anchor Program Registry at anchor.projectserum.com (opens new window) hosts a catalog of verified programs on Solana both written with and without Anchor. It is recommended that authors of smart contracts publish their source to promote best practices for security and transparency.
The Anchor Program Registry is currently in alpha testing. For access to publishing please ask on Discord (opens new window).
# Getting Started
The process for publishing is mostly identical to
- Signup for an account here (opens new window).
- Confirm your email by clicking the link sent to your address.
- Navigate to your Username -> Account Settings on the top navbar.
- Click "New Token" in the API Access section.
anchor login <token>at the command line.
And you're ready to interact with the registry.
# Configuring a Build
Whether your program is written in Anchor or not, all source being published must
Anchor.toml to define the build.
Anchor.toml config looks as follows,
anchor_version = "0.24.2" [workspace] members = ["programs/multisig"] [provider] cluster = "mainnet" wallet = "~/.config/solana/id.json" [programs.mainnet] multisig = "A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u" [programs.localnet] multisig = "A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u"
Here there are four sections.
anchor_version(optional) - sets the anchor docker image to use. By default, the builder will use the latest version of Anchor.
[workspace](optional) - sets the paths--relative to the
Anchor.toml-- to all programs in the local workspace, i.e., the path to the
Cargo.tomlmanifest associated with each program that can be compiled by the
anchorCLI. For programs using the standard Anchor workflow, this can be ommitted. For programs not written in Anchor but still want to publish, this should be added.
[provider]- configures the wallet and cluster settings. Here,
mainnetis used because the registry only supports
mainnetbinary verification at the moment.
[programs.mainnet]- configures each program in the workpace, providing the
addressof the program to verify.
When defining program in
[programs.mainnet], make sure the name provided
matches the lib name for your program, which is defined
by your program's Cargo.toml.
# Anchor Program
An example of a toml file for an Anchor program can be found here (opens new window).
# Non Anchor Program
An example of a toml file for a non-anchor program can be found here (opens new window).
To publish to the Anchor Program Registry, change directories to the
defined root and run
anchor publish <program-name>
<program-name> is as defined in
in the example above.