← 返回
数据分析 中文

Arbitrum Dapp Skill

Opinionated guide for building dApps on Arbitrum using Stylus (Rust) and/or Solidity. Covers local devnode setup, contract development, testing, deployment, and React frontend integration with viem. Use when starting a new Arbitrum project, writing Stylus or Solidity contracts, deploying to Arbitrum, or building a frontend that interacts with Arbitrum contracts.
针对 Arbitrum 的 dApp 开发指南,使用 Stylus(Rust)和/或 Solidity,涵盖本地 devnode 搭建、合约开发、测试、部署以及 React 前端集成(viem)。适用于新 Arbitrum 项目、合约编写、部署或构建与 Arbitrum 合约交互的前端。
hummusonrails
数据分析 clawhub v1.1.0 1 版本 99957.6 Key: 无需
★ 0
Stars
📥 2,358
下载
💾 2
安装
1
版本
#latest

概述

Arbitrum dApp Development

Stack

LayerToolNotes
--------------------
Smart contracts (Rust)stylus-sdk v0.10+Compiled to WASM, runs on Stylus VM
Smart contracts (Solidity)Solidity 0.8.x + FoundryStandard EVM path on Arbitrum
Local nodenitro-devnodeDocker-based local Arbitrum chain
Contract CLIcargo-stylusCheck, deploy, export-abi for Stylus
Contract toolchainFoundry (forge, cast, anvil)Build, test, deploy, interact for Solidity
FrontendReact / Next.js + viem + wagmiviem for all chain interaction
Package managerpnpmWorkspace-friendly, fast

Decision Flow

When starting a new contract:

  1. Need max performance / lower gas? → Stylus Rust. See references/stylus-rust-contracts.md.
  2. Need broad tooling compatibility / rapid prototyping? → Solidity. See references/solidity-contracts.md.
  3. Hybrid? → Use both. Stylus and Solidity contracts are fully interoperable on Arbitrum.

Project Scaffolding

Monorepo layout (recommended)

my-arbitrum-dapp/
├── apps/
│   ├── frontend/            # React / Next.js app
│   ├── contracts-stylus/    # Rust Stylus contracts
│   ├── contracts-solidity/  # Foundry Solidity contracts
│   └── nitro-devnode/       # Local dev chain (git submodule)
├── pnpm-workspace.yaml
└── package.json

Bootstrap steps

# 1. Create workspace
mkdir my-arbitrum-dapp && cd my-arbitrum-dapp
pnpm init
printf "packages:\n  - 'apps/*'\n" > pnpm-workspace.yaml

# 2. Local devnode
git clone https://github.com/OffchainLabs/nitro-devnode.git apps/nitro-devnode
cd apps/nitro-devnode && ./run-dev-node.sh && cd ../..

# 3a. Stylus contract
cargo stylus new apps/contracts-stylus

# 3b. Solidity contract
cd apps && forge init contracts-solidity && cd ..

# 4. Frontend
pnpm create next-app apps/frontend --typescript
cd apps/frontend
pnpm add viem wagmi @tanstack/react-query

Core Workflow

Stylus Rust

# Validate
cargo stylus check --endpoint http://localhost:8547

# Deploy (uses the nitro-devnode pre-funded deployer account)
cargo stylus deploy \
  --endpoint http://localhost:8547 \
  --private-key $PRIVATE_KEY

# Export ABI for frontend consumption
cargo stylus export-abi

Solidity (Foundry)

# Build
forge build

# Test
forge test

# Deploy locally (uses the nitro-devnode pre-funded deployer account)
forge script script/Deploy.s.sol --rpc-url http://localhost:8547 --broadcast \
  --private-key $PRIVATE_KEY

> Note: The nitro-devnode ships with a pre-funded deployer account. See references/local-devnode.md for the default private key and address. For testnet/mainnet, use your own key via environment variables — never hardcode secrets.

Frontend (viem + wagmi)

import { createPublicClient, http } from "viem";
import { arbitrumSepolia } from "viem/chains";

const client = createPublicClient({
  chain: arbitrumSepolia,
  transport: http(),
});

// Read from contract
const result = await client.readContract({
  address: "0x...",
  abi: contractAbi,
  functionName: "myFunction",
});

See references/frontend-integration.md for full patterns with wagmi hooks, wallet connection, and write transactions.

Principles

  • Always use viem for chain interaction.
  • Test locally first against nitro-devnode before deploying to testnet.
  • Export ABIs from both Stylus (cargo stylus export-abi) and Solidity (forge inspect) and keep them in a shared location the frontend can import.
  • Use environment variables for RPC URLs, contract addresses, and private keys. Never hardcode secrets.
  • Stylus contracts are EVM-compatible — they share the same address space, storage model, and ABI encoding as Solidity contracts. Cross-contract calls work seamlessly.

References

Load these as needed for deeper guidance:

  • references/stylus-rust-contracts.md — Stylus SDK patterns, storage, macros, entrypoints
  • references/solidity-contracts.md — Solidity on Arbitrum specifics and Foundry workflow
  • references/frontend-integration.md — React + viem + wagmi patterns
  • references/local-devnode.md — Nitro devnode setup, accounts, and debugging
  • references/deployment.md — Deploying to testnet and mainnet
  • references/testing.md — Testing strategies for both Stylus and Solidity

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-28 16:59 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 60,154
data-analysis

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 270 📥 57,012
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 199 📥 65,213