Guide
Choose a builder image
On this page
The builder image is part of what gets verified. cargo-near records it in the contract's NEP-330 metadata as build_environment, in the form image:tag@sha256:digest, and a verifier rebuilds inside exactly that digest. Choose it before your first reproducible deployment and keep it with the commit.
Write the image name exactly as sourcescan/cargo-near or ghcr.io/near/cargo-near. NEAR CLI compares the name literally, so a registry prefix such as docker.io/sourcescan/cargo-near, the form in the NEP-330 example, is rejected.
Docker Hub or GHCR
Two image families are accepted for verification. Both are published for linux/amd64.
| Docker Hub | GitHub Container Registry (GHCR) | |
|---|---|---|
| Image | sourcescan/cargo-near |
ghcr.io/near/cargo-near |
| Published by | SourceScan, from cargo-near-image | NEAR, from cargo-near |
| Tags | Docker Hub tag list | GHCR package |
Used by cargo near new in cargo-near 0.23.0 |
Yes | No |
Use Docker Hub sourcescan/cargo-near for hosted verification through NearBlocks. It is the cargo-near 0.23.0 template default. On 23 November 2026, the deployed metadata for all 77 Mainnet accounts whose code matched their records named this image.
Use GHCR ghcr.io/near/cargo-near when you want NEAR's own builder and can verify locally with NEAR CLI 0.31.0 or later. Do not count on hosted verification of a GHCR-built contract until it is confirmed in support status.
Which tools accept which image
| Tool | sourcescan/cargo-near |
ghcr.io/near/cargo-near |
|---|---|---|
near contract verify in NEAR CLI 0.31.0 and later |
Verified | Verified |
near contract verify in NEAR CLI 0.21.0 to 0.30.x |
Verified | Unsupported |
| Hosted SourceScan verifier, used by NearBlocks, running NEAR CLI 0.31.1 on 25 November 2026 | Verified | Unconfirmed: allowed, not yet tested end to end |
| Any other image | Unsupported | Unsupported |
NEAR CLI checks the image name against an exact-match allowlist before building. The verify command has had one since it first shipped in NEAR CLI 0.21.0, naming only sourcescan/cargo-near; NEAR CLI 0.31.0 added the GHCR image (allowlist in 0.31.1, exact match). The --no-image-whitelist flag skips the check for a local rebuild only, and the hosted verifier does not use it.
The hosted verifier ran NEAR CLI 0.31.1 when checked on 25 November 2026. That version allows GHCR images, but hosted GHCR verification has not been confirmed end to end. The verifier's public Dockerfile installs NEAR CLI without a fixed version, so rebuilding the service can change the version. Backend Dockerfile
Pin the image
Keep these fields together in [package.metadata.near.reproducible_build].
imagenames the repository and tag, written exactly assourcescan/cargo-near:TAGorghcr.io/near/cargo-near:TAG. The tag describes the version; it does not identify the bytes.image_digestidentifies the exact image. Verification requires it.container_build_commanddepends on the image version, as shown below.passed_envpasses build-time environment variables. Leave it empty: the cargo-near README says SourceScan and NearBlocks do not yet verify contracts whose metadata includes these parameters. cargo-near README
| Image version | container_build_command |
|---|---|
0.13.0-rust-1.83.0 and later |
["cargo", "near", "build", "non-reproducible-wasm", "--locked"] |
Before 0.13.0-rust-1.83.0 |
["cargo", "near", "build"] |
The outer cargo near build reproducible-wasm command starts the pinned container, and the container command runs inside it. cargo-near README
Same tag, different digest
The same tag name can exist on both registries with different digests. Copy the digest from the registry you build with, never from the other one.
| Image and tag | Digest |
|---|---|
sourcescan/cargo-near:0.22.0-rust-1.99.1 |
sha256:c9655eaf7436b90c87ea8b25739f91063032c5c30ba24cfeafe72c142943b5bb |
ghcr.io/near/cargo-near:0.22.0-rust-1.99.1 |
sha256:9076a6fd276c874830316917a2a27a63b81acfe89f635d03493c0f67429f43d2 |
Digests were read from both registries on 23 November 2026. To read a tag's digest yourself:
docker buildx imagetools inspect ghcr.io/near/cargo-near:0.22.0-rust-1.99.1
Use the Digest: line from the output. The cargo-near issue tracking the GHCR move describes the same difference.
On an ARM host
The images are linux/amd64 only. On Apple silicon and other ARM hosts, Docker runs them through emulation, which is slower. Enable amd64 emulation in Docker if a build fails to start.
Existing deployments
The metadata is compiled into the WASM, so changing any of these fields changes the bytes and needs a new deployment. near-sdk metadata macro To reproduce or verify code that is already deployed, use the image, digest and command from its metadata, even if a newer image exists. Do not swap a Docker Hub image for the GHCR one, or the reverse.
Updating for a new release
Pick a tag from a published release, so the image traces back to the workflow that built it. Copy its digest from the same registry, update container_build_command if the version range requires it, then commit, build, deploy and request verification again. On 23 November 2026, cargo-near 0.23.0 is the latest release, and its template still names Docker Hub. Proposals to move the template to GHCR were still open in the cargo-near repository.