What is a Smart Contract?
A smart contract is a program that lives on-chain. Once deployed, it runs exactly as written — no company or person controls it. Anyone can call it, and the outcome is transparent and verifiable. NEXUS smart contracts run on Zcash today. The same contract code will work identically when Bitcoin and Dogecoin join the unified execution layer. On NEXUS, smart contracts can:- Hold and transfer vZEC (live), vSAT and vDOGE (coming soon)
- Run any logic — token balances, swap pools, lending, NFTs
- Call other contracts — composable DeFi
- Read Zcash L1 data — e.g. block height, deposit confirmations
How it Works (No Code Required)
What Can Contracts Do?
Store data permanently
Store data permanently
Contracts have persistent storage — like a database that lives on-chain forever.
A token contract stores balances. An AMM stores liquidity pool reserves.
No server, no database bill — it just exists.
Move funds
Move funds
Contracts can hold and move vSAT (Bitcoin), vZEC (Zcash), and vDOGE (Dogecoin).
A swap pool holds both sides of a trading pair. A lending protocol holds collateral.
Funds only move when contract logic says they can.
Call other contracts
Call other contracts
Contracts can call each other — this is how DeFi composes.
A yield vault can call an AMM to swap, which calls a token to transfer.
Everything happens atomically in one transaction.
Emit events
Emit events
Contracts emit events when things happen (e.g. “Transfer: Alice sent 10 to Bob”).
Wallets, explorers, and indexers listen for these events off-chain.
Read L1 chain data
Read L1 chain data
Contracts can read Bitcoin block height, Zcash confirmations, and Dogecoin data directly.
This enables time-locks, oracle-free conditions, and cross-chain logic.
Gas: Paying for Computation
Every operation in a contract costs gas — a small fee proportional to how much work the network does. Gas prevents runaway loops and spam. You set a gas limit when submitting a transaction; if your contract uses more, it reverts.| Operation | Relative Cost |
|---|---|
| Read stored data | Low |
| Write stored data | Medium |
| Cryptographic hash | Very low |
| Call another contract | Medium + subcall cost |
Built-in Protections
NEXUS contracts have safeguards built into the SDK:- Reentrancy guard — prevents the classic DeFi reentrancy attack automatically
- Safe math — arithmetic overflows revert the transaction instead of wrapping
- Require checks — any failed condition reverts the entire transaction (no partial state)
Ready-Made Templates
You don’t have to start from scratch. The nexus-contract-template includes production-ready examples:| Example | What it gives you |
|---|---|
| Counter | Minimal working contract with nexus_fn! |
| NEP-20 | Fungible token (like ERC-20) |
| WVZEC | Wrapped native vZEC for AMM compatibility |
| AMM Pair | Core swap logic (SatsAMM) |
For Developers
If you want to write contracts, see:- Contracts Overview — full SDK reference with code examples
- Deploy a Contract — step-by-step deployment guide
- NEP-20 Token Standard — fungible token reference