Skip to main content
Compiler requirements: Solidity >= 0.8.27, EVM version istanbul or lower.
The BITE Solidity SDK (@skalenetwork/bite-solidity) provides smart contract interfaces for creating Conditional Transactions (CTX), encrypting data onchain, and handling decryption callbacks.

Installation

Imports

BITE.submitCTX()

Creates a Conditional Transaction that requests decryption of encrypted data. The decrypted result is delivered to your contract’s onDecrypt callback in the next block.
Returns: The address of the ephemeral wallet that will call onDecrypt. Each call generates a unique address. Parameters:
  • precompileAddress: Use BITE.SUBMIT_CTX_ADDRESS (0x1B)
  • gasLimit: Gas for callback (in gas units, use msg.value / tx.gasprice)
  • encryptedArgs: Array of encrypted byte arrays to decrypt
  • plaintextArgs: Array of unencrypted byte arrays passed through to callback

Example

IBiteSupplicant.onDecrypt()

Callback that your contract must implement. Called by SKALE consensus with decrypted data in the block after submitCTX.
Security: Always restrict access to only authorized ephemeral wallets using a mapping(address => bool) pattern. See Security: Protect onDecrypt.

BITE.encryptTE()

Encrypts data using the network’s BLS threshold key. Only the validator committee can decrypt (via CTX callback).
Returns the encrypted data. The call will revert on error (see below error details). Error Codes:

BITE.encryptECIES()

Encrypts data for a specific viewer’s secp256k1 public key. Only the holder of the corresponding private key can decrypt off-chain.
Returns the encrypted data (encrypted under the given public key). The call will revert on error (see below error details). Error Codes:

PublicKey Struct

The public key is an uncompressed secp256k1 point (without the 0x04 prefix).

Constants

Resources