Documentation Index
Fetch the complete documentation index at: https://docs.skale.space/llms.txt
Use this file to discover all available pages before exploring further.
The BITE TypeScript SDK (
@skalenetwork/bite) lets applications and wallets encrypt EVM transactions using threshold encryption. It works with any SKALE chain that has Programmable Privacy enabled.
Installation
The SDK works with any SKALE chain with Programmable Privacy. Currently, it is available on SKALE Base Mainnet and Testnet only.
Quick Start
API Reference
new BITE(endpoint)
Creates a BITE instance configured with a JSON-RPC endpoint.
Parameters:
endpoint: string— JSON-RPC endpoint
bite.encryptTransaction(tx)
Encrypts a transaction using BLS threshold encryption. The encrypted transaction will have its to field set to the magic address.
Parameters:
tx: { to: string; data: string; gasLimit?: number }— Standard hex strings
Promise<Transaction> — Encrypted transaction safe to submit to eth_sendTransaction
Encryption Process:
- RLP encodes original
dataandtofields - Encrypts encoded data using AES with randomly generated key
- Encrypts AES key using BLS threshold encryption
- Creates final payload:
[EPOCH_ID, ENCRYPTED_BITE_DATA]
- Single Committee: AES key encrypted with current BLS public key
- Dual Committee: During rotation, AES key encrypted twice (current + next committee keys)
BITE.encryptTransactionWithCommitteeInfo(tx, committees)
Static method that encrypts using provided committee info, avoiding internal RPC call.
Parameters:
tx: object— Transaction withdataandtofieldscommittees: Array— Committee info objects (fromgetCommitteesInfo)
Promise<Transaction>— Encrypted transaction
bite.encryptMessage(message)
Encrypts a raw hex-encoded message using BLS threshold encryption.
Parameters:
message: string— Hex string to encrypt (with or without0xprefix)
Promise<string> — Encrypted hex string in RLP format with epoch and encryption data
Example:
bite.getDecryptedTransactionData(transactionHash)
Retrieves decrypted transaction data after consensus finality using bite_getDecryptedTransactionData JSON-RPC method.
Parameters:
transactionHash: string— The transaction hash
Promise<object> — JSON with data and to keys containing original decrypted fields
Example:
This method works only for encrypted transactions that have already been processed and decrypted by the network. If the transaction does not exist, or if decrypted data is unavailable, the call throws an error.
bite.getCommitteesInfo()
Fetches committee information using bite_getCommitteesInfo JSON-RPC method.
Returns: Promise<Array> — Array of 1-2 committee objects:
commonBLSPublicKey: 256-char hex (128-byte BLS public key)epochId: Integer epoch identifier
- 1 element: Normal operation (single active committee)
- 2 elements: Committee rotation period (scheduled for next 3 minutes)
Transaction Structure
Encrypted Transaction Format
Encryption Payload Structure
The encrypteddata field contains RLP-encoded array:
EPOCH_ID— Current committee epochENCRYPTED_BITE_DATA— AES-encrypted payload with BLS-encrypted AES key
Best Practices
Gas Limit Management
Browser Polyfills
When using the SDK in the browser, you may need to polyfillBuffer:
vite.config.ts:
webpack.config.js:
Committee Rotation Monitoring
Common Use Cases
Private Token Transfers
Confidential Contract Interactions
Cached Committee Encryption
Resources
- GitHub: github.com/skalenetwork/bite-ts
- BITE Solidity SDK: npm: @skalenetwork/bite-solidity
- Programmable Privacy Intro: Overview
