Skip to main content

Introduction

NEXUS smart contracts are written in Rust and compiled to WebAssembly (WASM). They run in a deterministic VM with access to storage, events, cross-contract calls, and L1 chain data from Bitcoin, Zcash, and Dogecoin. The SDK provides Solidity-compatible types and patterns, making it familiar for EVM developers while leveraging Rust’s safety guarantees.

Getting Started

The fastest way to start is the nexus-contract-template — a pre-configured Cargo workspace with the NEXUS SDK vendored locally, a cargo xtask build pipeline, and a full test harness. No network access required to build or test.

Prerequisites

Clone the Template

Build

Deploy

Contract Structure

NEXUS contracts use the nexus_fn! macro for ABI-compatible function exports:

SDK Features

Solidity-Compatible Types

SafeMath Operations

Reentrancy Protection

Cross-Contract Calls

Context Access

Best Practices

  1. Use ReentrancyGuard — Protect state-changing functions
  2. Validate inputs — Use require! macro for assertions
  3. Use SafeMath — Prevent overflow/underflow
  4. Emit events — For indexing and off-chain tracking
  5. Modular design — Separate internal logic from ABI entry points
  6. Always start from the template — It handles WASM memory patching, toolchain pinning, and test harness setup