dvcrn/openclaw-skills-marketplace/afrexai-web3-engineering

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Web3 & Blockchain Engineering

Install

npx vskill@latest install dvcrn/openclaw-skills-marketplace/afrexai-web3-engineering

SKILL.md

Web3 & Blockchain Engineering

Complete methodology for evaluating, designing, building, securing, and operating blockchain-based systems. Covers smart contract development, DeFi protocol design, token economics, security auditing, and production operations.

Zero dependencies. Framework-agnostic. Works with any blockchain, any language, any AI agent.

Phase 1: Should You Use Blockchain?

The Database Test

Before writing a single line of Solidity, answer honestly:

yaml
blockchain_evaluation:
problem: "[describe the core problem]"
requirements:
multiple_untrusting_parties: true/false # >1 org needs shared truth
no_trusted_authority: true/false # no single party everyone trusts
immutability_critical: true/false # history must be tamper-proof
censorship_resistance_needed: true/false # no entity should block access
value_transfer_required: true/false # moving assets between parties
transparency_required: true/false # all parties need verifiable state
disqualifiers:
single_org_controls_data: true/false # → use a database
data_deletion_required: true/false # → GDPR conflict, careful
high_throughput_low_latency: true/false # → >10K TPS? consider L2 or database
users_cant_manage_wallets: true/false # → account abstraction or custodial
trusted_authority_exists: true/false # → database with audit log
score: "[count true requirements - count true disqualifiers]"
verdict: "blockchain / hybrid / database"

Decision rules:

  • Score ≤ 0 → Use PostgreSQL with audit logs
  • Score 1-2 → Hybrid (anchoring/notarization on-chain, logic off-chain)
  • Score 3+ → Blockchain is justified
Platform Selection Matrix
PlatformTPSFinalityGas CostBest For
Ethereum L1~30~12 min$1-50+Settlement, high-value DeFi
Arbitrum~4,000~1 sec (soft)$0.01-0.10DeFi, general dApps
Optimism~2,000~2 sec (soft)$0.01-0.15Public goods, governance
Base~2,000~2 sec (soft)$0.001-0.05Consumer apps, social
Polygon PoS~7,000~2 sec$0.001-0.01Gaming, mass-market
Solana~65,000~400ms$0.00025High-frequency, DePIN
Avalanche C~4,500~1 sec$0.01-0.10Enterprise, subnets
BNB Chain~2,000~3 sec$0.01-0.05Retail, low-cost
Bitcoin L1~7~60 min$0.50-5+Store of value, settlement
Bitcoin L2 (Lightning)~1M+instant<$0.01Micropayments, P2P

Selection decision tree:

  1. Store of value / settlement only? → Bitcoin
  2. Micropayments / instant P2P? → Lightning Network
  3. Need EVM compatibility? → Yes: continue. No: consider Solana, Cosmos
  4. High-value DeFi / maximum security? → Ethereum L1
  5. General dApp with low gas? → Arbitrum or Base
  6. Mass-market consumer? → Base or Polygon
  7. Enterprise with custom rules? → Avalanche subnets or Hyperledger

Phase 2: Smart Contract Architecture

Design Principles
  1. Minimize on-chain state — Storage is expensive. Put data on-chain only if it needs consensus
  2. Fail loudly — Use require() / revert() with descriptive messages, never silent failures
  3. Immutability by default — Upgradeability adds attack surface. Only use if genuinely needed
  4. Separation of concerns — One contract per responsibility
  5. Gas-conscious design — Every operation costs money. Optimize hot paths
Contract Architecture Patterns
yaml
architecture_brief:
project: "[name]"
type: "DeFi / NFT / DAO / Token / Marketplace / Infrastructure"
contracts:
core:
- name: "[MainContract]"
responsibility: "[single clear purpose]"
state_variables: ["list key storage"]
external_calls: ["contracts it calls"]
periphery:
- name: "[Router/Helper]"
responsibility: "[user-facing convenience]"
libraries:
- name: "[MathLib/SafeLib]"
responsibility: "[shared pure functions]"
upgrade_strategy: "immutable / transparent-proxy / UUPS / diamond / beacon"
access_control: "Ownable / AccessControl / Timelock+Multisig / DAO"
Upgrade Pattern Decision
PatternComplexityGas OverheadStorage Layout RiskBest For
ImmutableNoneNoneNoneSimple contracts, tokens
Transparent ProxyMedium+gas per callHighStandard upgradeable
UUPSMediumLower than transparentHighGas-efficient upgradeable
Diamond (EIP-2535)HighMediumHighLarge modular systems
BeaconMediumMediumHighMany identical instances

Rule: If you can avoid upgradeability, do it. If you must upgrade, use UUPS with timelock + multisig governance.

Solidity Development Standards
solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
// — IMPORTS: Use named imports, pin versions —
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
/// @title VaultV1
/// @notice Single-asset vault with deposit/withdraw
/// @dev Uses SafeERC20 for all token transfers
contract VaultV1 is ReentrancyGuard {
using SafeERC20 for IERC20;
// — STATE: Group by slot for packing —
IERC20 public immutable asset; // slot 0
uint128 public totalDeposits; // slot 1 (packed)
uint128 public totalShares; // slot 1 (packed)
mapping(address => uint256) public shares;
// — EVENTS: Index searchable fields —
event Deposited(address indexed user, uint256 amount, uint256 shares);
event Withdrawn(address indexed user, uint256 amount, uint256 shares);
// — ERRORS: Custom errors save gas vs strings —
error ZeroAmount();
error InsufficientShares(uint256 requested, uint256 available);
constructor(IERC20 _asset) {
asset = _asset;
}
/// @notice Deposit assets, receive proportional shares
/// @param amount Asset amount to deposit
/// @return mintedShares Shares minted to caller
function deposit(uint256 amount) external nonReentrant returns (uint256 mintedShares) {
if (amount == 0) revert ZeroAmount();
// Calculate shares BEFORE transfer (prevent manipulation)
mintedShares = totalDeposits == 0
? amount
: (amount * totalShares) / totalDeposits;
// Effects before interactions (CEI pattern)
totalDeposits += uint128(amount);
totalShares += uint128(mintedShares);
shares[msg.sender] += mintedShares;
// Interaction last
asset.safeTransferFrom(msg.sender, address(this), amount);
emit Deposited(msg.sender, amount, mintedShares);
}
}
Coding Standards Checklist
  • [ ] NatSpec on every public/external function
  • [ ] Custom errors instead of require strings (saves ~50 gas each)
  • [ ] Events for every state change
  • [ ] CEI pattern (Checks-Effects-Interactions) on every external call
  • [ ] nonReentrant on functions with external calls
  • [ ] immutable / constant where possible
  • [ ] SafeERC20 for all token transfers
  • [ ] No tx.origin for auth (phishing vector)
  • [ ] Explicit visibility on all functions and state variables
  • [ ] Storage variable packing (group smaller types together)

Phase 3: Token Economics (Tokenomics)

Token Type Decision
TypeStandardUse CaseRegulatory Risk
Utility tokenERC-20Access, governance, gasMedium
Governance tokenERC-20 + votingProtocol controlMedium
Security tokenERC-1400/3643Equity, revenue shareHIGH — requires compliance
NFT (unique)ERC-721Collectibles, identity, accessLow-Medium
Semi-fungibleERC-1155Gaming items, editionsLow
Soulbound (SBT)ERC-5192Credentials, reputationLow
StablecoinERC-20 + pegPayments, DeFi collateralHIGH — regulatory scrutiny
Token Design Framework
yaml
tokenomics:
token_name: "[Name]"
symbol: "[SYM]"
standard: "ERC-20 / ERC-721 / ERC-1155"
total_supply: "[fixed / capped / inflationary]"
distribution:
team: "[%] — [vesting schedule]"
investors: "[%] — [vesting schedule]"
community: "[%] — [distribution mechanism]"
treasury: "[%] — [governance-controlled]"
ecosystem: "[%] — [grants, incentives]"
liquidity: "[%] — [DEX pairs, market making]"
vesting:
team_cliff: "12 months minimum"
team_linear: "24-48 months after cliff"
investor_cliff: "6-12 months"
investor_linear: "12-36 months"
value_accrual:
mechanism: "[fee sharing / buyback-burn / staking yield / utility demand]"
fee_structure: "[% of protocol revenue → token holders]"
burn_mechanism: "[deflationary pressure source]"
governance:
voting_power: "1 token = 1 vote / quadratic / conviction"
quorum: "[% of supply needed]"
timelock: "[delay between vote and execution]"
inflation_schedule:
year_1: "[%]"
year_2: "[%]"
long_term: "[target %/year]"
sustainability_test:
without_new_buyers: "Does the token have utility even if price = 0?"
revenue_source: "Where does yield come from? (real yield vs emissions)"
death_spiral_risk: "Can selling pressure create feedback loop?"
Tokenomics Red Flags
Red FlagWhy It's BadFix
>20% team allocationCentralization, dump riskCap at 15-20%, long vesting
No cliff periodImmediate sell pressure12-month cliff minimum
Inflationary without utilityToken printing → zeroEmissions tied to real revenue
"Yield" from new depositsPonzi economicsReal yield from fees only
Governance without timelockAdmin can rugTimelock + multisig mandatory
100% unlocked at launchMassive sell pressureStaged unlock over 2-4 years

Phase 4: DeFi Protocol Design

Core DeFi Primitives
PrimitiveWhat It DoesKey RiskExamples
AMM (DEX)Trustless token swapsImpermanent lossUniswap, Curve
LendingOvercollateralized loansLiquidation cascadesAave, Compound
StablecoinPrice-stable tokenDepeg riskMakerDAO, Ethena
Yield aggregatorOptimize yield farmingSmart contract risk stackingYearn
PerpetualsLeveraged derivativesLiquidation, oracle manipulationGMX, dYdX
Liquid stakingStake + maintain liquiditySlashing, depegLido, Rocket Pool
BridgesCross-chain transfersBridge exploits (billions lost)LayerZero, Wormhole
RestakingRe-use staked assetsCascading slashingEigenLayer
AMM Design (Uniswap V2/V3 Pattern)
Constant Product: x * y = k
Price Impact: Δy = y - k/(x + Δx)
Slippage: (expected_price - actual_price) / expected_price
V3 Concentrated Liquidity:
- LPs choose price range [Pa, Pb]
- Capital efficiency: up to 4000x vs V2
- Trade-off: must actively manage positions
DeFi Security Invariants

Every DeFi protocol MUST maintain these:

  1. Solvency — Total assets ≥ total liabilities (always)
  2. No free tokens — No path creates tokens from nothing
  3. Monotonic shares — Depositing increases shares, withdrawing decreases
  4. Oracle freshness — Price data is within acceptable staleness window
  5. Liquidation viability — Undercollateralized positions can always be liquidated
  6. Access control — Admin functions behind timelock + multisig
  7. Withdrawal guarantee — Users can always withdraw their assets (no lock-up without consent)

Phase 5: Security Auditing

Vulnerability Taxonomy

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
24
Repository forks
9
7-day trend score
16

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dvcrn/openclaw-skills-marketplace/afrexai-web3-engineering/badge)](https://verified-skill.com/skills/dvcrn/openclaw-skills-marketplace/afrexai-web3-engineering)

Something wrong with this skill or its page? Tell us.