Overview

This section describes how to build transactions from Smart wallet. It supports two types of transactions: activation and spending.

Activation is a costly one-time computation (Plutus script) that involves a ZK proof that the user owns a correctly signed JWT issued by Google. This transaction mints a token that is used to validate the spending transaction. Each time the user logs in on a new device, a new activation transaction must be performed on that device. A wallet can have multiple activation tokens at the same time. If the user loses the private key on a device (e.g. by wiping browser data or using another browser), an activation transaction is required on that device.

A spending transaction is a lightweight Plutus script that verifies if the signatory has a corresponding activation token in transaction inputs. Moreover, it forwards the checks to a withdrawal script. The reason behind this is efficiency. If a wallet has 10 UTxOs that are being spent, for each of these 10 UTxOs, Plutus script would get executed. If we had all the logic inside this spending script itself, then that logic would get executed 10 times. We however, save ourselves with redundant computation by delegating checks to a withdrawal script and good thing about withdrawal script is that it's logic is executed once.