Skip to Content
Future workScalingInter-head transactions

Inter-head transactions

One desirable property of Gummiworm is the ability to horizontally scale: as new business use cases arrive or demand rises, you can always spin up additional heads to handle the traffic. However, this has the downside that user funds become isolated; If users want to exchange tokens via Sugar Rush and then provide them as collateral on an L2 lending protocol, they must withdraw and deposit in the interim.

However, a planned Gummiworm feature, known as “inter-head transactions”, alleviates this usability concern, and allows users to submit transactions that settle across different heads.

When a user wishes to transact across heads, they build a request that includes several L2 transactions, one for each head they are transacting across.

Each head is inter-head aware, and so the transactions are allowed to not balance. They validate that, under the assumption that something else covers deficits and absorbs surplus, would this transaction be valid.

If so, then the L2 ledger responds to Gummiworm indicating that a new compartment with its own evacuation map should be created. This compartment represents a temporary lock on the funds, ensuring they can’t be spent in other transactions by the L2 ledger. It has its own evacuation map for any funds that are in surplus. It also records any obligations, deficits that must be fulfilled for the compartment to be closed (and an L2 payload describing how the L2 ledger will route them when they are fulfilled).

The creation of this compartment manifests as the creation of an L1 effect, whereby the surplus assets are paid into a separate utxo, pending settlement across heads. This separate utxo ensures that we can wait for settlement of any cross-head transactions without stalling consensus for the rest of the head activity.

The network of coil nodes then opens communication with each other, and forms an ephemeral, joint coil network, requiring consensus from all head peers from each participating head, and quorums from each coil network (which may or may not have heavy overlap).

Each head then constructs a transaction that spends the partitioned utxo, paying the funds into a multisig controlled by the ephemeral meta-coil. Before signing this transaction, they secure a post-dated refund transaction which recovers the respective funds.

After submitting this transaction, the meta-coil can build a transaction that spends each of the utxos at the joint head address, and re-partitions them among the peers, such that each head sheds its surplus and covers its deficits.

Each peer then signs this transaction, and once the quorum is met, settles it on chain.

As each head observes the settlement of this transaction, they then wait for finality (similar to a deposit) and absorb it to close out the compartment.

As an optimization, if the coils for each head overlap such that the honesty assumptions of each would imply it is impossible to contradict each transaction, some of the above steps can be omitted, drastically shortening the time to settle these effects.

Last updated on