# What Programming Languages Are Supported for Amadeus Protocol Smart Contracts?

> Amadeus Protocol supports Rust and AssemblyScript for smart contract development. Learn how to write Wasm modules with these powerful languages.

- Repository: [Amadeus Protocol/node](https://github.com/amadeusprotocol/node)
- Tags: api-reference
- Published: 2026-08-20

---

**Amadeus Protocol supports Rust and AssemblyScript as the two primary programming languages for writing smart contracts that compile to WebAssembly (Wasm) modules.**

The `amadeusprotocol/node` repository provides first-class tooling and official contract templates for both languages. Developers write contract logic in either Rust or AssemblyScript, compile to `.wasm` binaries, and deploy to the Amadeus blockchain using the `amadeusd` CLI.

## Rust Smart Contract Development

Rust is officially supported through the `amadeus-sdk` crate with procedural macros for contract definition. The source templates live in `contract_samples/rust/` and target `wasm32-unknown-unknown` for compilation.

### Key Rust Contract Features

- **`#[amadeus::contract]`** — Annotates the main contract struct
- **`#[amadeus::init]`** — Defines contract initialization logic
- **`#[amadeus::action]`** — Marks state-mutating functions
- **`#[amadeus::view]`** — Marks read-only query functions

### Rust Counter Contract Example

```rust
use amadeus_sdk::prelude::*;

/// A simple counter contract
#[amadeus::contract]
pub struct Counter {
    value: u64,
}

#[amadeus::init]
fn init() -> Counter {
    Counter { value: 0 }
}

#[amadeus::action]
fn increment(&mut self, amount: u64) {
    self.value += amount;
}

#[amadeus::view]
fn get(&self) -> u64 {
    self.value
}

```

Build the contract using the provided [`./build_and_validate.sh`](https://github.com/amadeusprotocol/node/blob/main/./build_and_validate.sh) script in `contract_samples/rust/`. This produces a deployable `.wasm` artifact.

## AssemblyScript Smart Contract Development

AssemblyScript is the second supported language, compiling TypeScript-like syntax directly to Wasm. Templates are maintained in `contract_samples/assemblyscript/` with equivalent SDK decorators.

### Key AssemblyScript Contract Features

- **`@Contract`** — Class decorator for the contract structure
- **`@init`** — Function decorator for initialization
- **`@action`** — Decorator for mutable operations
- **`@view`** — Decorator for read-only queries

### AssemblyScript Counter Contract Example

```ts
import { Contract, init, action, view } from "amadeus-sdk";

/** A simple counter contract */
@Contract
export class Counter {
  private value: u64 = 0;
}

/** Initialize the contract */
@init
export function init(): Counter {
  return new Counter();
}

/** Increment the counter */
@action
export function increment(state: Counter, amount: u64): void {
  state.value += amount;
}

/** Read-only view of the counter */
@view
export function get(state: Counter): u64 {
  return state.value;
}

```

The AssemblyScript build pipeline compiles this to Wasm using the repository's configured toolchain.

## Deployment Workflow for Both Languages

Regardless of source language, the deployment flow follows the same pattern:

1. **Write** contract logic using the appropriate SDK decorators
2. **Compile** to Wasm using language-specific build scripts
3. **Validate** the `.wasm` output with provided tooling
4. **Deploy** via `amadeusd` CLI to the Amadeus blockchain

This unified Wasm-based execution model ensures contracts from both Rust and AssemblyScript run identically on-chain.

## Source Files and Documentation

| Purpose | Path |
|---------|------|
| Project overview & supported contract languages | [`README.md`](https://github.com/amadeusprotocol/node/blob/main/README.md) |
| Contract documentation | [`DOCS.md`](https://github.com/amadeusprotocol/node/blob/main/DOCS.md) |
| Rust sample & build instructions | [`contract_samples/rust/README.md`](https://github.com/amadeusprotocol/node/blob/main/contract_samples/rust/README.md) |
| AssemblyScript sample & build instructions | [`contract_samples/assemblyscript/README.md`](https://github.com/amadeusprotocol/node/blob/main/contract_samples/assemblyscript/README.md) |
| General "Getting Started" guide | [`contract_samples/GETTINGSTARTED.md`](https://github.com/amadeusprotocol/node/blob/main/contract_samples/GETTINGSTARTED.md) |

## Summary

- **Two supported languages**: Rust and AssemblyScript for Amadeus Protocol smart contracts
- **Common target**: Both compile to WebAssembly (`.wasm`) for on-chain execution
- **Equivalent SDKs**: `amadeus-sdk` provides matching decorators/macros in both languages
- **Unified deployment**: `amadeusd` CLI deploys Wasm binaries regardless of source language
- **Official templates**: Located in `contract_samples/rust/` and `contract_samples/assemblyscript/`

## Frequently Asked Questions

### Does Amadeus Protocol support Solidity for smart contracts?

No. Amadeus Protocol does not use the Ethereum Virtual Machine (EVM). Smart contracts run as WebAssembly modules, requiring compilation from Rust or AssemblyScript rather than Solidity.

### Which language should I choose for Amadeus Protocol development?

**Rust** offers mature tooling, strong type safety, and the `wasm32-unknown-unknown` target's stability. **AssemblyScript** provides a gentler learning curve for TypeScript developers and faster iteration cycles. Both are production-ready according to the `amadeusprotocol/node` source code.

### Can I use other languages that compile to WebAssembly?

The repository officially supports only Rust and AssemblyScript with tested SDK bindings and build scripts. Other Wasm-capable languages may technically compile, but lack the `amadeus-sdk` decorators and validation tooling required for proper contract deployment.

### What version of Rust is required for Amadeus contract development?

The `contract_samples/rust/` directory includes a `rust-toolchain` or documented requirements. Check [`contract_samples/rust/README.md`](https://github.com/amadeusprotocol/node/blob/main/contract_samples/rust/README.md) for the specific Rust version and `wasm32-unknown-unknown` target configuration used in the official templates.