-
Notifications
You must be signed in to change notification settings - Fork 2
Smart Wallet
The Smart Wallet is core to what allows this concept to work. This is because funds are not actually sent between addresses until the entire Chain Line transaction is complete - they are instead marked as "reserved" and are refundable if certain conditions are met. This opens up possibilities to do things with smart contracts that we otherwise would not be able to do.
Permission to make any withdrawal of funds is either granted or denied by the central "hub" contract which each verification script calls upon processing a withdrawal from a user's wallet. If there are actively reserved funds held on the account and the withdrawal amount exceeds the available balance ("effective balance") the request is rejected and the transaction cannot proceed.
Chain Line users must use an address associated with a Smart Wallet script in order to perform invocations of its smart contract. This is because the Chain Line hub contract requires this "reserved funds" capability in order to work.
The main features of the wallet are as follows:
-
GAS transactions work like any other wallet. The mechanism of reserving funds is hidden from the user - they don't have to know the intricate details of how it works.
-
The Hub "validates" the user wallets as they interact ("invoke") the contract. It does this by building the expected copy of the script, hashing it, and comparing that hash with the script hash of the caller.
-
The above combined with a "witness check" ensures that the user is using a wallet with a capability to reserve funds in it. This allows them to use the Chain Line Hub contract.
-
The script is created dynamically in the Chain Line client when a user creates a wallet.
-
NEO transactions are largely untested but are expected to work as normal without a capability to reserve part of the balance.