build-with-bite
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBuild with BITE
基于BITE构建
BITE Protocol provides threshold encryption on SKALE chains. Encrypts transaction data so mempool only sees encrypted bytes.
BITE Protocol在SKALE链上提供门限加密能力,可加密交易数据,因此mempool仅能看到加密后的字节流。
What is BITE?
什么是BITE?
- Encrypts +
toin transactionscalldata - Threshold decryption: 2t+1 of 3t+1 validators needed
- Works on all Solidity contracts (no contract changes needed)
- MEV-resistant
- 加密交易中的地址和
tocalldata - 门限解密:需要3t+1个验证者中的2t+1参与
- 兼容所有Solidity合约(无需修改合约代码)
- 抗MEV
Primitives
功能原语
| Primitive | Description | Chains |
|---|---|---|
| Encrypted TX | Encrypt | SKALE Base, SKALE Base Sepolia |
| CTX | Conditional Transactions | BITE V2 Sandbox 2 |
| 功能原语 | 描述 | 支持链 |
|---|---|---|
| 加密交易 | 加密 | SKALE Base, SKALE Base Sepolia |
| CTX | 条件交易 | BITE V2 Sandbox 2 |
Chain Requirements
链要求
Encrypted Transactions:
- SKALE Base (1187947933)
- SKALE Base Sepolia (324705682)
CTX:
- BITE V2 Sandbox 2 (coordinate with SKALE team)
加密交易支持链:
- SKALE Base (1187947933)
- SKALE Base Sepolia (324705682)
CTX支持链:
- BITE V2 Sandbox 2(需与SKALE团队协调)
SDK Usage
SDK使用
Install:
npm install @skalenetwork/bitetypescript
import { BITE } from '@skalenetwork/bite';
const bite = new BITE('https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha');
// Encrypt transaction
const encrypted = await bite.encryptTransaction({
to: "0xContractAddress",
data: "0xCalldata"
});
// Send with wallet - CRITICAL: set gas manually
const tx = await wallet.sendTransaction({
...encrypted,
gasLimit: 300_000
});安装命令:
npm install @skalenetwork/bitetypescript
import { BITE } from '@skalenetwork/bite';
const bite = new BITE('https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha');
// Encrypt transaction
const encrypted = await bite.encryptTransaction({
to: "0xContractAddress",
data: "0xCalldata"
});
// Send with wallet - CRITICAL: set gas manually
const tx = await wallet.sendTransaction({
...encrypted,
gasLimit: 300_000
});Get Decrypted Data
获取解密数据
typescript
const { data, to } = await bite.getDecryptedTransactionData(txHash);typescript
const { data, to } = await bite.getDecryptedTransactionData(txHash);Committee Info
委员会信息
typescript
const committees = await bite.getCommitteesInfo();
// length === 2 means rotation in progress (3 min window)typescript
const committees = await bite.getCommitteesInfo();
// length === 2 means rotation in progress (3 min window)Solidity (CTX)
Solidity(CTX)
Install:
forge install skalenetwork/bite-soliditysolidity
pragma solidity >=0.8.27;
import { BITE } from "@skalenetwork/bite-solidity/BITE.sol";
import { IBiteSupplicant } from "@skalenetwork/bite-solidity/interfaces/IBiteSupplicant.sol";
contract Secret is IBiteSupplicant {
bytes public message;
function reveal(bytes calldata encrypted) external payable {
BITE.submitCTX(
BITE.SUBMIT_CTX_ADDRESS,
msg.value / tx.gasprice,
encrypted,
new bytes[](0)
);
}
function onDecrypt(bytes[] calldata decrypted, bytes[] calldata) external override {
message = decrypted[0];
}
}安装命令:
forge install skalenetwork/bite-soliditysolidity
pragma solidity >=0.8.27;
import { BITE } from "@skalenetwork/bite-solidity/BITE.sol";
import { IBiteSupplicant } from "@skalenetwork/bite-solidity/interfaces/IBiteSupplicant.sol";
contract Secret is IBiteSupplicant {
bytes public message;
function reveal(bytes calldata encrypted) external payable {
BITE.submitCTX(
BITE.SUBMIT_CTX_ADDRESS,
msg.value / tx.gasprice,
encrypted,
new bytes[](0)
);
}
function onDecrypt(bytes[] calldata decrypted, bytes[] calldata) external override {
message = decrypted[0];
}
}Compiler Settings
编译器设置
For CTX contracts:
- Solidity >=0.8.27
- EVM istanbul
toml
solc_version = "0.8.27"
evm_version = "istanbul"CTX合约编译要求:
- Solidity版本 >=0.8.27
- EVM版本为istanbul
toml
solc_version = "0.8.27"
evm_version = "istanbul"Key Rules
核心规则
- Gas: Always set manually (default 300k) - estimateGas doesn't work with BITE
- Committee: 3t+1 nodes, 2t+1 to decrypt
- Rotation: SDK handles dual encryption automatically
- Sender: Always public (transaction is signed)
- Encrypted: address and
tocalldata - Public: sender, value, gas used
- Gas:始终手动设置(默认30万),estimateGas不适用于BITE
- 委员会:共3t+1个节点,需要2t+1个节点参与解密
- 轮换:SDK会自动处理双重加密
- 发送方:始终公开(交易已签名)
- 加密内容:地址和
tocalldata - 公开内容:发送方、交易金额、Gas使用量