Building the Etherlink kernel
It's not necessary to build Etherlink's kernel.
You can set the pre-images-endpoint field in the Smart Rollup node's configuration file as described in Running an Etherlink Smart Rollup node.
You can also download the installer kernel here: installer.hex.
However, if you want to build the kernel yourself, you can use these instructions.
This build process creates the installer kernel, which is a compressed version of the kernel that provides only enough information to install the original kernel. The data for the original kernel is stored in separate files called preimages. For more information about installer kernels and preimages, see the tutorial Deploy a Smart Rollup on docs.tezos.com.
Prerequisites
Before you begin, make sure that you have these prerequisites installed:
-
Docker, because the Etherlink build process relies on a Docker image to ensure reproducible builds
-
Rust, because of its support for WebAssembly (WASM), the language that Smart Rollups use to communicate.
To install Rust via the
rustupcommand, run this command:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shYou can see other ways of installing Rust at https://www.rust-lang.org.
-
Clang and LLVM, which are required for compilation to WebAssembly. Version 11 or later of Clang is required. Here are instructions for installing the appropriate tools on different operating systems:
- MacOS
- Ubuntu
- Fedora
- Arch Linux
brew install llvm
export CC="$(brew --prefix llvm)/bin/clang"
In some cases for MacOS you may need to update your PATH environment variable to include LLVM by running this command:
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
sudo apt-get install clang-11
export CC=clang-11
dnf install clang
export CC=clang
pacman -S clang
export CC=clang
The export CC command sets Clang as the default C/C++ compiler.
After you run these commands, run $CC --version to verify that you have version 11 or greater installed.
Also, ensure that your version of Clang wasm32 target with by running the command $CC -print-targets | grep wasm32 and verifying that the results include wasm32.
-
AR (macOS only)
To compile to WebAssembly on macOS, you need to use the LLVM archiver. If you've used Homebrew to install LLVM, you can configure it to use the archiver by running this command:
export AR="$(brew --prefix llvm)/bin/llvm-ar" -
The WebAssembly Toolkit (
wabt) provides tooling for reducing (or stripping) the size of WebAssembly binaries (with thewasm-stripcommand) and conversion utilities between the textual and binary representations of WebAssembly (including thewat2wasmandwasm2watcommands).Most distributions ship a
wabtpackage, which you can install with the appropriate command for your operating system:
- MacOS
- Ubuntu
- Fedora
- Arch Linux
brew install wabt
sudo apt install wabt
dnf install wabt
pacman -S wabt
Building the installer kernel
- Etherlink Mainnet
- Etherlink Shadownet Testnet
Follow these steps to build the installer kernel:
-
Clone the repository at https://gitlab.com/tezos/tezos.
-
Check out the commit with the hash
b9f6c9138719220db83086f0548e49c5c4c8421f. -
Build the kernel by running this command from the root directory:
./etherlink/scripts/build-wasm.shThis command creates the file
etherlink/kernels-b9f6c9138719220db83086f0548e49c5c4c8421f/evm_kernel.wasm. -
Run this command to install the installer kernel build dependencies:
make -f kernels.mk build-deps kernel_sdk -
Set the parameters for the Etherlink kernel by running this command, which sets the chain ID, governance and bridge contracts, and other values:
octez-evm-node make kernel installer config setup_file.yml --chain-id 42793 \
--sequencer edpktufVZGs2JmEwHSFLdA7XHXotmnkD2Nwr75ACpxUr1iKUWzYFHJ \
--delayed-bridge KT1AZeXH8qUdLMfwN2g7iwiYYSZYG4RrwhCj \
--ticketer KT1CeFqjJRJPNVvhvznQrWfHad2jCiDZ6Lyj \
--sequencer-governance KT1NcZQ3y9Wv32BGiUfD2ZciSUz9cY1DBDGF \
--kernel-governance KT1H5pCmFuhAwRExzNNrPQFKpunJx1yEVa6J \
--kernel-security-governance KT1N5MHQW5fkqXkW9GPjRYfn5KwbuYrvsY1g \
--sequencer-pool-address 0xCF02B9Ca488f8F6F4E28e37AA1bDD16b3F1b2aD8 \
--delayed-inbox-min-levels 1600 --remove-whitelist -
Run this command to build the installer kernel:
smart-rollup-installer get-reveal-installer \
-u etherlink/kernels-b9f6c9138719220db83086f0548e49c5c4c8421f/evm_kernel.wasm \
-o installer.hex \
-P wasm_2_0_0 \
-S setup_file.yml \
-d
Follow these steps to build the installer kernel:
-
Clone the repository at https://gitlab.com/tezos/tezos.
-
Check out the commit with the hash
6d73d486ace903ee0d524a9b39dfbd858838a690. -
Build the kernel by running this command from the root directory:
./etherlink/scripts/build-wasm.shThis command creates the file
etherlink/kernels-6d73d486ace903ee0d524a9b39dfbd858838a690/evm_kernel.wasm. -
Run this command to install the installer kernel build dependencies:
make -f kernels.mk build-deps kernel_sdk -
Set the parameters for the Etherlink kernel by running this command, which sets the chain ID, governance and bridge contracts, and other values:
octez-evm-node make kernel installer config setup_file.yml \
--chain-id 127823 \
--sequencer p2pk66pKYcCzjwNjJRf7HqZh5gZhBizmnD9tPWuEqgUtGspjAFpRX2E \
--delayed-bridge KT18tqoSSpiMy6sizSMx9kQCe29EQfGq9wWv \
--ticketer KT1JYZsawXmeArts18nn4uT79tUJc4AGTYgc \
--admin KT1PVWsDwY2DUoGsCVYh8T9RDAVRYDqQD54r \
--sequencer-governance KT1HrMqTgYrFYADFFZ1XwPHYSfuypDXWLyi6 \
--sequencer-pool-address 0x9bd1830F5cF6b225DABB17Fb725A1FA59839F308 \
--delayed-inbox-min-levels 3200 \
--enable-fa-bridge \
--enable-fast-withdrawal \
--eth-bootstrap-account 0x6ce4d79d4E77402e1ef3417Fdda433aA744C6e1c \
--eth-bootstrap-account 0xB53dc01974176E5dFf2298C5a94343c2585E3c54 \
--eth-bootstrap-account 0x9b49c988b5817Be31DfB00F7a5a4671772dCce2B -
Run this command to build the installer kernel:
smart-rollup-installer get-reveal-installer \
-u etherlink/kernels-6d73d486ace903ee0d524a9b39dfbd858838a690/evm_kernel.wasm \
-o installer.hex \
-P wasm_2_0_0 \
-S setup_file.yml \
-d
The output of the build process is the installer kernel itself, named installer.hex, and the preimages for the kernel, in the wasm_2_0_0 directory.