← Protocols
Archway
01Description

Archway is a Cosmos SDK + CosmWasm chain whose defining feature is built-in dApp rewards: contracts can claim a share of gas fees and inflationary rewards proportional to the gas consumed by their users. This creates a sustainable revenue stream for protocol developers without needing a separate token.

02Best for
  • 01CosmWasm contracts with sustainable on-chain revenue
  • 02dApps that earn gas-rebate rewards
  • 03long-running protocol contracts (DEXs, lending) that benefit from usage-based rewards
  • 04deploying contracts with fee-grant flows
  • 05IBC-enabled CosmWasm services
03Install
  • pnpm add @archwayhq/arch3.js @cosmjs/proto-signing
  • cargo add archway-bindings cosmwasm-std cw-storage-plus
04Environment variables
VariableScopeDescription
ARCHWAY_RPC_URLClientArchway Tendermint RPC endpoint (e.g., `https://rpc.mainnet.archway.io:443`). Required for arch3.js client construction.
05Prompt snippet
Use `@archwayhq/arch3.js`, which extends `SigningCosmWasmClient` with reward-aware methods. Build a client with `SigningArchwayClient.connectWithSigner(rpcEndpoint, signer, { gasPrice: GasPrice.fromString('900000000000aarch') })`. Set a contract's reward recipient via `client.setContractMetadata(adminAddr, { contract_address, owner_address, rewards_address })`. Claim accumulated rewards with `client.withdrawContractRewards(rewardsAddr, contractAddrs, totalRecords)`. From Rust contracts use `archway-bindings`: emit `ArchwayMsg::SetMetadata` and read pending rewards with `ArchwayQuery::ContractMetadata { contract_address }` and `ArchwayQuery::OutstandingRewards { reward_address }`. Standard CosmWasm calls (`client.upload`, `client.instantiate`, `client.execute`) work as on any wasmd chain.
06Gotchas
  • Rewards accrue per BLOCK and must be explicitly withdrawn — they do NOT auto-stream. Forgetting to call `withdrawContractRewards` means rewards sit in the rewards-pool indefinitely; build a periodic withdrawal job.
  • The reward formula is gas-based, so contracts with low gas consumption per call earn proportionally tiny rewards. Heavy-compute contracts benefit most; design with this incentive in mind, but do not artificially inflate gas (block-gas-limit risk).
  • CosmWasm version compatibility: Archway pins specific `cosmwasm-std` versions per chain release (e.g., 1.5.x, 2.0.x). The `archway-bindings` crate version MUST match the chain version, or queries to Archway-specific modules return UnknownVariant errors.
  • Gas token is `aarch` (1 ARCH = 10^18 aarch — note this is 18 decimals, unlike most Cosmos chains which use 6). Off-by-12 amount bugs are common; always use BigInt arithmetic and never hard-code amounts as numbers.
  • Chain upgrades: Archway upgrades coordinate `wasmd`, `cosmos-sdk`, and `archway` module versions together. Bump `arch3.js` after every upgrade or new message types (e.g., callbacks module) won't be recognized.
  • IBC channel maintenance: Archway IBC channels follow the standard 14-day trusting period. If your reward-recipient address is on another chain (via PFM-routed withdrawals), light-client expiry on either side blocks claims until governance unfreezes.
  • Slashing on ARCH validators: 5% double-sign, 0.01% downtime — typical Cosmos params. The chain has had multiple parameter governance proposals; check `docs.archway.io/validators/staking` for current values before staking.
  • `callbacks` module: Archway lets contracts schedule themselves for execution at a future block height. Mis-priced callbacks (insufficient fee in the request) are silently dropped at execution time — always over-fund and refund the excess.
07Alternatives