What's the way to distribute the compiled node binary to peers, so that they wouldn't need to build everything from scratch on their virtual machines? I'm asking this because building everything takes quite some time and effort from a peer and I'd like to simplify this path for them.
If the chipset architecture (i.e. the Rust build target, or platform) of your peers are the same as yours you can safely just distribute the binary you built locally. Polkadot GitHub repository releases actually each contain a pre-built binary targeted for
x86_64-unknown-linux-gnu, which run without problems on
x86_64 Linux machines. For instance you can find the
v0.9.17-rc4 binary on the release page here in the assets section.
If your peers are on different platforms then you can target those platforms in your builds and distribute multiple binaries for multiple platforms.
Are you familiar at all with Docker, or more broadly, https://opencontainers.org/ ?
Containers are a commonly requested way to package a system that contains the needed utilities to build and/or run your binary that is included within it. Thus architecture considerations are generally abstracted so you need only to configure the container image to be optimized once, and all users on any arcetecture can use them.
- Polkadot Docker images - effectively a cross-platform executable of a Polkadot node, no build required.
- Polkadot Docker instructions
- The self-contained Dokerfiles to build the Polkadot source within a Docker container.
Also of note: some critical files need to be generated on a single machine and distributed alongside your binary or within your images, namely your chain specification due to a non-determinism bug present in Rust's handling of Wasm builds. It is conventional to include the chain specification files for your node within the source code itself so that anyone can build your node in the same way, whereby it becomes easy to check for non-determinism by comparing a genesis blob with another. Polkadot, Kusama, Rococo, and more network chain spec files are found in the source here