Skip to content

AIBTC Covenant Inscription ยท R1

Stage: Live reference artifact. AIBTC Covenant Inscription R1 publishes an immutable rule text and pure calculations. Applications share this calculation standard to interpret an asset's selected fees, destinations and buyback plans.

Source and local examples

The R1 reference package brings together the frozen Solidity source, ABI, test vectors and a dependency-free Node implementation.

Run from the repository root with Node.js 22 or later:

node reference/r1/example.mjs
node reference/r1/check-vectors.mjs

The example calculates fees and the chosen rule-fee destination. The vector check compares the local implementation with the frozen reference cases. Both run offline, without a wallet, RPC connection or package installation.

Frozen identity

Identifier Frozen value
Display/version aibtc@R1 / 1
Frozen contract identifier AIBTCInscription
Reference contract 0xed976e7b95d099c60318ef848c73d584ee5eb08a
Chain IDs in the reference deployment manifest 1, 56, 8453
English text bytes 7340
SHA256 of exact English text 3c0b91af6cbfce5ea8eb8c6d1174c117ff34233695f480f5e6c9b3db7ddaa73b
Build-manifest identifier d89dc0b21bf43a91b1dce2e406b15986b5a93d543e2df6af5d1545cbb739d845
Runtime code hash recorded by the manifest 0xced45195c6414fda019589fd5959999a2e5ef58e986643b6e2dc620b672cd1e3

These identifiers are preserved from the frozen reference artifacts. They are not a fresh RPC verification of current chain state. No signer, deployment program, transaction constructor or application ledger is included here.

Bytes and binding

inscriptionText() returns the exact text reproduced below. INSCRIPTION_TEXT_SHA256 is SHA256 of its UTF-8 bytes, including the single final LF byte (0a), without a BOM or CRLF conversion. The Markdown heading, this explanation, code fences and other page content are not part of that hash. Copy only the complete code-block contents to recover the frozen text.

The same bytes appear in the frozen reference text file, the decoded Solidity text constant, and the release text field. Their digest is the manifest's statuteTextSha256 and the contract's text-hash constant. The build-manifest identifier is a separate SHA256: it hashes canonical compact JSON of the manifest body with manifestSha256 omitted and without the file's final LF. It must not be confused with the text hash or an EVM code hash. The runtime code hash in the table uses Keccak-256 of the EVM runtime bytecode; it is not the SHA256 of the English text or of this Markdown page.

A selected asset's public parameter line identifies this reference and its two parameters. The canonical line is ASCII with fixed field order and no whitespace, BOM, trailing delimiter or line-ending byte. For example:

aibtc@R1:0xed976e7b95d099c60318ef848c73d584ee5eb08a:T100:C0

This line selects T100 (100 basis points) and C0. It is not the complete reference text and carries no separate text-digest field. The contract identifier selects the immutable reference whose text hash can be compared independently. The reference build identity is retained above as additional provenance, rather than claimed as another field of the Bitcoin parameter line.

The line is carried in a zero-value OP_RETURN output using a minimal direct push. Its aibt prefix is distinct from AIBRC's AIBR marker; the core Deploy / Transfer interpreter does not execute the R1 economics. An executor applies those economics separately. R1 and X1 are mutually exclusive reference modes; X1's different meaning is documented in X1.

Complete frozen English text

The block below is reproduced byte for byte. Its reserved capability titles are part of the original immutable text, not newly activated capabilities.

aibtc@R1

01 [PARAMETERS] Fixed parameters.
The canonical line is aibtc@R1:0x<40 lowercase hex address>:T<tax bps>:C<destination bps>. It is one ASCII line without whitespace, a newline or leading zeroes in integers. Field order is fixed; unknown, missing or duplicate fields are invalid. The address identifies the selected immutable reference contract.
T is 0 or a multiple of 10 from 10 through 500, shared by BUY and SELL. 10000 bps is 100%; T10=0.1%, T100=1%. C0 sends the entire asset rule fee to buyback-and-lock; C10000 assigns it to the creator. T0 has only C0. Entire means the rule fee, not the platform fee. Asset parameters cannot change after creation.
isValidRule(T,C) returns whether this combination is valid: T<=500 and T%10=0; C is 0 or 10000; T=0 requires C=0. Invalid combinations return false. This interface neither reads nor registers assets.

02 [PURE_MATH] Fees and graduation.
Amounts are integer satoshis. ceilBps(a,b) accepts nonnegative amount a and basis points 0<=b<=10000, returning ceil(a*b/10000). With q=a div 10000 and r=a mod 10000, compute q*b+(r*b div 10000)+(r*b mod 10000 != 0 ? 1 : 0), without floating point or an overflowing intermediate a*b. Out-of-range b reverts.
effectiveTax = graduated at trade start ? T : 0.
totalFee = ceilBps(base,50+effectiveTax).
platformFee = ceilBps(base,50).
ruleFee = totalFee-platformFee.
Round the total fee up once, determine the platform fee first, and allocate the difference to the rule fee; never sum two separately rounded charges. Before graduation only the 0.5% platform fee applies. The graduation-triggering trade still uses the pre-graduation rule; the next ordinary trade activates the rule fee.

03 [PURE_MATH] quoteUserBuy(requestedTotal,executedTotal,T,postAtTradeStart).
Inputs are requested total, executed total, rule tax and whether graduation preceded trade start. Require requestedTotal>=1000, 0<executedTotal<=requestedTotal and valid T; postAtTradeStart=true additionally requires executedTotal=requestedTotal.
Use base=executedTotal and section 02 to return platformFee, ruleFee, totalFee, principal=base-totalFee and totalDebit=executedTotal; principal must be positive. No fee is added outside the request and unexecuted amounts incur no fee. Invalid inputs revert.
This pure function neither determines actual graduation or executed amount nor purchases assets. Input (1000,2,10,false), for example, returns (1,0,1,1,2): a fee result, not permission for partial execution.

04 [PURE_MATH] quoteUserSell(G,T,postAtTradeStart).
Inputs are gross BTC output G, rule tax and whether graduation preceded trade start. Require G>=1000 sats and valid T. Use base=G and section 02 to return platformFee, ruleFee, totalFee and net=G-totalFee. Invalid inputs revert; net>=1000 is not required. This function neither computes AMM prices nor executes a sale.

05 [PURE_MATH] Example vectors.
After graduation at T10, base / platformFee / ruleFee / totalFee / AMM principal or SELL net are:
1000 / 5 / 1 / 6 / 994
1001 / 6 / 1 / 7 / 994
1200 / 6 / 2 / 8 / 1192
1201 / 7 / 1 / 8 / 1193
At base=1000, T0 gives 5 / 0 / 5 / 995.
At base=1000, T500 gives 5 / 0 / 5 / 995 before graduation and 5 / 50 / 55 / 945 after graduation.
Across these rounding boundaries, increasing base does not reduce user output; the rule fee can decrease by one satoshi.

06 [PURE_MATH] routeRuleFee(ruleFee,C).
Inputs are a nonnegative rule fee and destination C. C10000 returns creatorAmount=ruleFee and buybackAmount=0; C0 returns creatorAmount=0 and buybackAmount=ruleFee; other C values revert. It only computes destination amounts, transferring no funds and allocating no accounts. A zero rule fee returns two zeroes.

07 [BUYBACK] planBuyback(V,N) and lock meaning.
Inputs are executor-supplied available buyback balance V and current event sequence N. Outputs are shouldExecute, spend, nextSequence, platformFee and ruleFee.
V<1000 returns (false,0,0,0,0); V>=1000 returns (true,V,N+1,0,0). Revert for N+1 overflow only when that result is required. A balance of 50000 specifies one full 50000-sat buyback, not split purchases, exempt from platform fee, rule fee and the ordinary-user minimum. Purchased quantity follows the asset's normal AMM BUY mathematics and is not calculated here.
Buyback-and-lock means acquired AIBRC is permanently inbound only, with no sale, transfer out, withdrawal or administrator release. Total supply is unchanged; this is not burning.
The function only returns a plan. It neither verifies balances, allocates event slots, schedules or executes trades, nor locks assets. Its result proves no executed buyback and grants no caller a tax exemption.

08 [RESERVED_DIRECTORY] Reserved directory.
All fifteen entries are RESERVED_DOCUMENTATION_ONLY: X402 (x402 payments); AGENT (AI Agent); LLM (language-model integration); DAO (governance); STOCK (stocks/RWA); EXTERNAL_RECEIPT (external receipts); EXTERNAL_WALLET_CLAIM (external wallet claims); CERTIFIED_EXTERNAL_CONTRACT (certified external contracts); DIVIDEND (dividends); AUTO_LP (automatic liquidity); AIRDROP (airdrops); MISSION (mission vault); ORBIT (satellite tokens); BRIDGE (bridges); ORACLE (oracles).
These names state only possible future topics, not implemented business functions, valid R1 parameters, automatically enabled capabilities or compatibility promises. STOCK is not a securities issuance, trading, custody or licensing promise.

09 [VERSION] Version and scope.
Only new assets explicitly created with this version and contract address use these rules; legacy assets and LP rights are unchanged. The address and public content identify an immutable version; neither the version nor asset parameters can later be substituted. Future extensions require a new version, new address and new assets with explicit new parameters. Existing assets never acquire undeclared capabilities through a software upgrade.

10 [BOUNDARY] Implementation and trust boundary.
AIBTCInscription is an immutable rule and pure-calculation reference with no business state. It does not custody BTC or AIBRC, read external-chain state, execute trades or claims, or automatically enforce executor compliance.
An executor applies the same mathematics to fixed parameters without requiring per-trade EVM calls; actual parameters, execution and custody remain the executor's responsibility. Anyone may independently recalculate results. A pure return value proves no completed trade, payment or asset lock. How parameters are recorded, transactions submitted, funds held or execution evidenced is outside this contract. This version implements neither actual asset burning nor the business capabilities in the reserved directory.

11 [READ_API] Read-only information interfaces.
VERSION returns 1; PLATFORM_FEE_BPS returns 50; MIN_USER_GROSS_SATS and BUYBACK_TRIGGER_SATS each return 1000. inscriptionText() returns this complete text; INSCRIPTION_TEXT_SHA256 returns the SHA-256 of its UTF-8 bytes.
reservedCapabilityCount() returns 15. For 0<=index<15, reservedCapabilityAt(index) returns id, title and RESERVED_DOCUMENTATION_ONLY in section 08 order; out-of-range indices revert.
Numeric interfaces use uint256; unrepresentable results revert rather than wrap. There is no write interface for changing rules or parameters, and no executable business interface for the reserved directory.

Interpretation boundary

The complete text specifies parameters, rounding, fee routing, pure reference functions, buyback-and-lock meaning and reserved topics. Section 10 explains that execution and custody remain an executor's responsibility. A pure function result does not prove a trade, payment or lock occurred. The reference package provides the frozen text, source, ABI and local calculation tools; applications supply the execution machinery that carries out those rules.