# NIULAI 持有门槛接入指南 / Holder-gating integration

NIULAI 可作为轻量的社区通行门槛：第三方站点、线上创作活动或线下小聚可以读取 Base 主网上的 ERC-20 `balanceOf(address)`，检查某个地址是否达到持有门槛。

NIULAI can be used as a lightweight community-access threshold. A third-party site or event can read ERC-20 `balanceOf(address)` on Base Mainnet and check whether an address meets a chosen balance threshold.

## 公开配置 / Public configuration

- Network: Base Mainnet
- Chain ID: `8453`
- Token: `0x60ddA7f6E1d870c47534254B99064E1241041C44`
- Decimals: `18`
- Recommended threshold: `10,000 NIULAI`
- Threshold in base units: `10000000000000000000000`
- Machine-readable manifest: [niulai-token.json](https://niulai-claim.pages.dev/niulai-token.json)
- Token source: [BaseScan Verified / Exact Match](https://basescan.org/address/0x60ddA7f6E1d870c47534254B99064E1241041C44#code)
- Distributor source: not yet verified on BaseScan as of 2026-08-25 06:35 UTC

门槛是推荐值，不是合约强制规则。活动方可公开设定自己的门槛，但不应暗示持币必然获得收益、价格上涨或其他回报。

The threshold is a recommendation, not an onchain rule. Organizers may publish a different threshold, but should not imply that holding NIULAI guarantees profit, appreciation, or any other return.

## 最小 `viem` 示例 / Minimal `viem` example

```ts
import { createPublicClient, http, parseAbi } from "viem";
import { base } from "viem/chains";

const NIULAI = "0x60ddA7f6E1d870c47534254B99064E1241041C44";
const MINIMUM = 10_000n * 10n ** 18n;

const client = createPublicClient({
  chain: base,
  // Supply a reliable RPC transport for production use.
  transport: http(),
});

export async function hasNiulaiAccess(wallet: `0x${string}`) {
  const balance = await client.readContract({
    address: NIULAI,
    abi: parseAbi(["function balanceOf(address) view returns (uint256)"]),
    functionName: "balanceOf",
    args: [wallet],
  });

  return {
    eligible: balance >= MINIMUM,
    balance,
    checkedAtBlock: await client.getBlockNumber(),
  };
}
```

The example is read-only. It requires no token approval, no transfer, and no wallet signature. For production, use a reliable Base RPC endpoint and handle RPC timeouts, chain reorgs, and temporary failures without treating a failed request as a zero balance.

## 安全边界 / Security boundary

`balanceOf` 只能证明某个地址在某个区块高度的当前余额，不能证明页面访客控制该地址，也不能证明真实身份、历史持有或唯一人员。截图和复制的地址都可能被冒用。

`balanceOf` proves only the current balance of an address at a particular block. It does not prove that the visitor controls the address, and it does not establish real-world identity, holding history, or one-person-one-wallet uniqueness. Screenshots and copied addresses can be reused by someone else.

高安全活动应在服务端生成一次性随机数，让钱包签名，并校验域名、Chain ID、过期时间和重放保护；可采用 SIWE 等标准方式。不要要求代币授权，也不要要求转币来完成身份验证。

For higher-security access, generate a one-time server nonce, ask the wallet to sign it, and verify domain, chain ID, expiry, and replay protection. SIWE is one suitable standard. Never require token approval or a token transfer merely to authenticate a participant.

## 适用场景 / Suitable uses

- 创作工坊、线上主题投票、社区语音房的轻量门槛
- 线下小聚的入场预检，并由工作人员完成最终核验
- 第三方页面上的持有状态展示
- Lightweight access for workshops, theme polls, or community audio rooms
- Pre-checks for small in-person gatherings, followed by organizer verification
- A holder-status display on a third-party page

## 不适用场景 / Not sufficient for

- 法律身份证明、KYC、防刷领或“一人一号”
- 金融账户权限、高价值奖励发放或任何不可逆操作
- Legal identity, KYC, anti-Sybil enforcement, or one-person-one-wallet claims
- Financial-account authorization, high-value reward distribution, or irreversible actions

这份指南提供的是一个公开、可验证的技术起点，不是安全审计、身份服务或任何价值承诺。
