Skip to main content

MultiversX: utility package for building Rust contracts (reproducible builds).

Project description

mx-sdk-build-contract

Docker image (and wrappers) for reproducible contract builds (Rust). See docs.multiversx.com.

Build the Docker image

docker buildx build --no-cache . -t sdk-rust-contract-builder:experimental -f ./Dockerfile

Build contract using the wrapper

Without providing cargo-target-dir:

python3 ./build_with_docker.py --image=sdk-rust-contract-builder:experimental \
    --project=~/contracts/reproducible-contract-build-example \
    --output=~/contracts/output-from-docker

With providing cargo-target-dir:

python3 ./build_with_docker.py --image=sdk-rust-contract-builder:experimental \
    --project=~/contracts/reproducible-contract-build-example \
    --output=~/contracts/output-from-docker \
    --cargo-target-dir=~/cargo-target-dir-docker

Building from a packaged source code:

python3 ./build_with_docker.py --image=sdk-rust-contract-builder:experimental \
    --packaged-src=~/contracts/example-0.0.0.source.json \
    --output=~/contracts/output-from-docker

Build contract using the Docker inner script

This is useful for useful for testing, debugging and reviewing the script.

export PROJECT=${HOME}/contracts/reproducible-contract-build-example
export OUTPUT=${HOME}/contracts/output
export CARGO_TARGET_DIR=${HOME}/cargo-target-dir
export PATH=${HOME}/multiversx-sdk/vendor-rust/bin:${HOME}/multiversx-sdk/wabt/latest/bin:${PATH}
export RUSTUP_HOME=${HOME}/multiversx-sdk/vendor-rust
export CARGO_HOME=${HOME}/multiversx-sdk/vendor-rust

Build a project:

python3 ./build_within_docker.py --project=${PROJECT} --output=${OUTPUT} \
    --cargo-target-dir=${CARGO_TARGET_DIR}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page