anchor/assets/js/15.243176ff.js

1 line
3.7 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{407:function(e,a,r){"use strict";r.r(a);var t=r(29),s=Object(t.a)({},(function(){var e=this,a=e.$createElement,r=e._self._c||a;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"verifiable-builds"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifiable-builds"}},[e._v("#")]),e._v(" Verifiable Builds")]),e._v(" "),r("p",[e._v("Building programs with the Solana CLI may embed machine specfic\ncode into the resulting binary. As a result, building the same program\non different machines may produce different executables. To get around this\nproblem, one can build inside a docker image with pinned dependencies to produce\na verifiable build.")]),e._v(" "),r("p",[e._v("Anchor makes this easy by providing CLI commands to build and take care of\ndocker for you. To get started, first make sure you\n"),r("a",{attrs:{href:"https://docs.docker.com/get-docker/",target:"_blank",rel:"noopener noreferrer"}},[e._v("install"),r("OutboundLink")],1),e._v(" docker on your local machine.")]),e._v(" "),r("h2",{attrs:{id:"building"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#building"}},[e._v("#")]),e._v(" Building")]),e._v(" "),r("p",[e._v("To produce a verifiable build, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor build --verifiable\n")])])]),r("h2",{attrs:{id:"verifying"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifying"}},[e._v("#")]),e._v(" Verifying")]),e._v(" "),r("p",[e._v("To verify a build against a program deployed on mainnet, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor verify -p "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("lib-name"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v(" "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("program-id"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v("\n")])])]),r("p",[e._v("where the "),r("code",[e._v("<lib-name>")]),e._v(" is defined by your program's Cargo.toml.")]),e._v(" "),r("p",[e._v("If the program has an IDL, it will also check the IDL deployed on chain matches.")]),e._v(" "),r("h2",{attrs:{id:"images"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#images"}},[e._v("#")]),e._v(" Images")]),e._v(" "),r("p",[e._v("A docker image for each version of Anchor is published on "),r("a",{attrs:{href:"https://hub.docker.com/r/projectserum/build",target:"_blank",rel:"noopener noreferrer"}},[e._v("Docker Hub"),r("OutboundLink")],1),e._v(". They are tagged in the form "),r("code",[e._v("projectserum/build:<version>")]),e._v(". For example, to get the image for Anchor "),r("code",[e._v("v0.24.2")]),e._v(" one can run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker pull projectserum/build:v0.24.2\n")])])]),r("h2",{attrs:{id:"removing-an-image"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#removing-an-image"}},[e._v("#")]),e._v(" Removing an Image")]),e._v(" "),r("p",[e._v("In the event you run a verifiable build from the CLI and exit prematurely,\nit's possible the docker image may still be building in the background.")]),e._v(" "),r("p",[e._v("To remove, run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker rm -f anchor-program\n")])])]),r("p",[e._v("where "),r("code",[e._v("anchor-program")]),e._v(" is the name of the image created by default from within\nthe Anchor CLI.")])])}),[],!1,null,null,null);a.default=s.exports}}]);