Payload Encoding
Last updated
Last updated
Transactions on Brollup are referred to as entries. An entry either calls a smart contract or deploys a new contract.
Brollup employs a compact payload encoding structure with bit-level commitments to efficiently store entries. Entries are sequentially encoded within the payload, followed by the aggregate signature.
Brollup aggregate signatures by summing the signature nonces and commitments, similar to how ZK rollups aggregate signatures using ZKPs. This aggregation occurs during the entry signing session in coordination with the operator.
The payload is split into 520-byte chunks and stored directly in the witness;
Entries contain the following fields in the payload encoding:
account index
contact index
method call
calldata
Accounts are indexed by their rank, which is determined by how frequently they transact. First two bits of the account index maps to four different index tiers;
00 -> this an unregistered account, followed by the 256-bits x-only npub. 01 -> this a registered frequent account, top-65025 on the rank. followed by the 16 bits index number. 10 -> this a registered non-frequent account, between 65025–16646400 on the rank. followed by the 24 bits index locator number. 11 -> this a registered non-frequent account, between 16646400–4244897025 on the rank. followed by the 32 bits index locator number.
account index is followed by the contract index;
Contracts are indexed by their rank, which is determined by how frequently they are called. First two bits of the contract index maps to four different index tiers;
00 -> this is a contract deployment, followed by the contract bytecode starting with the varint prefix. 01 -> this is a frequent contract, top-64 on the rank. followed by the 6-bit index number. 10 -> this is a non-frequent contract, between 64–65089 on the rank. followed by the 16 bits index locator number. 11 -> this is a non-frequent contract, between 65089–1061208000 on the rank. followed by the 30 bits index locator number.
contract index is followed by the method call, if it is not 0b00.
Method calls are indexed based on their written order when the IDE compiles the contract into bytecode. First bit of the method call maps to two different index tiers;
0 -> index of the called method is #4 or less, followed by the 2-bit index number. 1 -> index of the called method is between #4 — #20, followed by the 4-bit index locator number.
method call is followed by the calldata.