>_ DevTrendsen

Language

Home

Languages

Sections

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Embedded Security
Rust

Looking under the hood of the Amadeus Protocol node

Recently came across an interesting node repository from the amadeusprotocol team. The project is positioned as a research blockchain node, and it immediately stands out for its mix of technologies. The main codebase is tied to Rust and the BEAM ecosystem (Erlang/Elixir), while smart contracts are compiled to WebAssembly directly from AssemblyScript.

There are no familiar EVM development tools like Hardhat or Foundry here. Instead, the developers offer direct local network management through an interactive Elixir console and running transactions over an optimized UDP stack. Let's break down how this is structured and how to set up a test environment.

What's inside the project

Based on the build scripts and code, the authors focus on two things: high network layer throughput and a simple smart contract execution model via WASM.

Several interesting details stand out in the repository:

  • The network stack is optimized for gigabit UDP traffic with aggressive system socket buffer settings.
  • Smart contracts are compiled into WASM files from AssemblyScript (a TypeScript subset), familiar to web developers.
  • The built-in interactive REPL allows calling contract methods and transferring tokens with a single line of Elixir code.
  • Node roles are divided into computors and validators (trainers).

Building and running a local testnet

You'll need Docker or Podman installed to build. The project compiles in an isolated container with Erlang and Rust environment:

podman build --tag erlang_builder -f build.Dockerfile
./build.sh

After building, you get an executable binary amadeusd. To test it locally, the authors suggest spinning up a local endpoint and pointing it to the system host:

# Прописываем локальный домен в /etc/hosts
echo "127.0.0.1 nodes.amadeus.bot" | sudo tee -a /etc/hosts

# Разрешаем привязку к непривилегированным портам
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80

# Запускаем локальный узел
TESTNET=true WORKFOLDER=/tmp/testnet HTTP_IPV4=127.0.0.1 HTTP_PORT=80 ./amadeusd

Working with smart contracts via the console

The most interesting part is interacting with the node through the REPL. When starting the testnet, you can immediately get the built-in account keys trainer and deploy a test counter contract.

Here's what deploying and calling contract methods looks like:

# Получаем ключи аккаунта
pk = Application.fetch_env!(:ama, :trainer_pk)
sk = Application.fetch_env!(:ama, :trainer_sk)

# Отправляем перевод токенов AMA
Testnet.call(sk, "Coin", "transfer", [pk, "1", "AMA"])

# Деплоим WASM-байткод счетчика
Testnet.deploy "/home/user/project/node/contract_samples/assemblyscript/counter.wasm"

# Читаем значение и вызываем инкремент
Testnet.call(sk, pk, "get", [])
Testnet.call(sk, pk, "increment", ["2"])

The contract is written in AssemblyScript, compiled to WASM, and handed to the node for execution. This significantly lowers the entry barrier compared to learning specific DSLs like Move or even Solidity.

Tuning the system for high network loads

In the documentation, the authors pay a lot of attention to Linux network settings. To handle intensive UDP traffic, they suggest cranking up socket buffers and file descriptor limits in /etc/sysctl.conf:

net.core.wmem_max = 268435456
net.core.rmem_default = 212992
net.core.rmem_max = 268435456
net.core.netdev_max_backlog = 300000
net.core.optmem_max = 16777216
net.ipv4.udp_mem = 3060432 4080578 6120864
net.ipv4.conf.all.rp_filter = 1

For background mode, the node is packaged as a systemd service that launches the process inside screen. This makes it possible to connect to an active session at any time via screen -rd amadeusd and debug the state.

Who might find this project interesting

The project documentation is still quite minimal, and the disclaimer honestly states that this is an experimental research prototype. Nevertheless, the source code will be useful for:

  • Erlang and Elixir developers who want to see implementations of cryptographic primitives and distributed consensus on BEAM.
  • Those studying WASM runtime integration in server applications.
  • System engineers interested in UDP stack tuning for high-load network protocols.

The code is open, and you can build and poke around a local testnet with your own WASM contracts in 10–15 minutes.

Related projects