<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a></div><!----></nav><ulclass="sidebar-links"><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading"><span>Getting Started</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/anchor/getting-started/introduction.html"class="sidebar-link">Introduction</a></li><li><ahref="/anchor/getting-started/installation.html"class="sidebar-link">Installing Dependencies</a></li></ul></section></li><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading"><span>Teams</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/anchor/getting-started/projects.html"class="sidebar-link">Projects</a></li></ul></section></li><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading"><span>Tutorials</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/anchor/tutorials/tutorial-0.html"class="sidebar-link">A Minimal Example</a></li><li><ahref="/anchor/tutorials/tutorial-1.html"class="sidebar-link">Arguments and Accounts</a></li><li><ahref="/anchor/tutorials/tutorial-2.html"class="sidebar-link">Account Constraints and Access Control</a></li><li><ahref="/anchor/tutorials/tutorial-3.html"class="sidebar-link">Cross Program Invocations (CPI)</a></li><li><ahref="/anchor/tutorials/tutorial-4.html"class="sidebar-link">Errors</a></li></ul></section></li><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading"><span>CLI</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/anchor/cli/commands.html"class="sidebar-link">Commands</a></li></ul></section></li><li><sectionclass="sidebar-group depth-0"><pclass="sidebar-heading open"><span>Source Verification</span><!----></p><ulclass="sidebar-links sidebar-group-items"><li><ahref="/anchor/getting-started/verification.html"class="sidebar-link">Verifiable Builds</a></li><li><ahref="/anchor/getting-started/publishing.html"aria-current="page"class="active sidebar-link">Publishing Source</a><ulclass="sidebar-sub-headers"><liclass="sidebar-sub-header"><ahref="/anchor/getting-started/publishing.html#getting-started"class="sidebar-link">Getting Started</a></li><liclass="sidebar-sub-header"><ahref="/anchor/getting-started/publishing.html#configuring-a-build"class="sidebar-link">Configuring a Build</a><ulclass="sidebar-sub-headers"><liclass="sidebar-sub-header"><ahref="/anchor/getting-started/publishing.html#examples"class="sidebar-link">Examples</a></li></ul></li><liclass="sidebar-sub-header"><ahref="/anchor/getting-started/publishing.html#publishing"class="sidebar-link">Publishing</a></li></ul></li></ul></section></li></ul></aside><mainclass="page"><divclass="theme-default-content content__default"><h1id="publishing-source"><ahref="#publishing-source"class="header-anchor">#</a> Publishing Source</h1><p>The Anchor Program Registry at <ahref="https://anchor.projectserum.com"target="_blank"rel="noopener noreferrer">anchor.projectserum.com<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a>
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.</p><divclass="custom-block tip"><pclass="custom-block-title">note</p><p>The Anchor Program Registry is currently in alpha testing. For access to publishing
please ask on <ahref="https://discord.gg/rg5ZZPmmTm"target="_blank"rel="noopener noreferrer">Discord<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a>.</p></div><h2id="getting-started"><ahref="#getting-started"class="header-anchor">#</a> Getting Started</h2><p>The process for publishing is mostly identical to <code>crates.io</code>.</p><ul><li>Signup for an account <ahref="https://anchor.projectserum.com/signup"target="_blank"rel="noopener noreferrer">here<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a>.</li><li>Confirm your email by clicking the link sent to your address.</li><li>Navigate to your Username -> Account Settings on the top navbar.</li><li>Click "New Token" in the <strong>API Access</strong> section.</li><li>Run <code>anchor login <token></code> at the command line.</li></ul><p>And you're ready to interact with the registry.</p><h2id="configuring-a-build"><ahref="#configuring-a-build"class="header-anchor">#</a> Configuring a Build</h2><p>Whether your program is written in Anchor or not, all source being published must
have an <code>Anchor.toml</code> to define the build.</p><p>An example <code>Anchor.toml</code> config looks as follows,</p><divclass="language-toml extra-class"><preclass="language-toml"><code><spanclass="token key property">anchor_version</span><spanclass="token punctuation">=</span><spanclass="token string">"0.24.2"</span>
</code></pre></div><p>Here there are four sections.</p><ol><li><code>anchor_version</code> (optional) - sets the anchor docker image to use. By default, the builder will use the latest version of Anchor.</li><li><code>[workspace]</code> (optional) - sets the paths--relative to the <code>Anchor.toml</code>--
to all programs in the local
workspace, i.e., the path to the <code>Cargo.toml</code> manifest associated with each
program that can be compiled by the <code>anchor</code> CLI. 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.</li><li><code>[provider]</code> - configures the wallet and cluster settings. Here, <code>mainnet</code> is used because the registry only supports <code>mainnet</code> binary verification at the moment.</li><li><code>[programs.mainnet]</code> - configures each program in the workpace, providing
the <code>address</code> of the program to verify.</li></ol><divclass="custom-block tip"><pclass="custom-block-title">TIP</p><p>When defining program in <code>[programs.mainnet]</code>, make sure the name provided
matches the <strong>lib</strong> name for your program, which is defined
by your program's Cargo.toml.</p></div><h3id="examples"><ahref="#examples"class="header-anchor">#</a> Examples</h3><h4id="anchor-program"><ahref="#anchor-program"class="header-anchor">#</a> Anchor Program</h4><p>An example of a toml file for an Anchor program can be found <ahref="https://anchor.projectserum.com/build/2"target="_blank"rel="noopener noreferrer">here<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a>.</p><h4id="non-anchor-program"><ahref="#non-anchor-program"class="header-anchor">#</a> Non Anchor Program</h4><p>An example of a toml file for a non-anchor program can be found <ahref="https://anchor.projectserum.com/build/1"target="_blank"rel="noopener noreferrer">here<span><svgxmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewBox="0 0 100 100"width="15"height="15"class="icon outbound"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="sr-only">(opens new window)</span></span></a>.</p><h2id="publishing"><ahref="#publishing"class="header-anchor">#</a> Publishing</h2><p>To publish to the Anchor Program Registry, change directories to the <code>Anchor.toml</code>
defined root and run</p><divclass="language-bash extra-class"><preclass="language-bash"><code>anchor publish <spanclass="token operator"><</span>program-name<spanclass="token operator">></span>
</code></pre></div><p>where <code><program-name></code> is as defined in <code>[programs.mainnet]</code>, i.e., <code>multisig</code>
in the example above.</p></div><footerclass="page-edit"><!----><!----></footer><divclass="page-nav"><pclass="inner"><spanclass="prev">