With the release of Taquito 6.3.2.beta.0, we are introducing a new API aimed at dApp/App developers. It’s called the Taquito Wallet API. The Wallet API intends to be used by applications that need to interact with Wallets.
The Wallet API is suitable for developers building user-facing applications that require interaction with the user’s Wallet to get a Tezos operation onto the Tezos blockchain. The Wallet API is for communicating with wallets. The existing “contract API” (Tezos.contract.*) should be used for backend applications and for building wallets themselves.
So what’s up with this new Wallet API?
The Wallet API offers more by doing less. It delegates wallet type duties to the Wallet, where they belong. The Contract API, on the other hand, does all the things a Wallet is intended to do.
As with most of Taquito, the Wallet API is designed as an interface so that it can use different wallet “providers”, including wallet transports.
We have three concrete implementations of the Wallet API today.
- Beacon-wallet Implements the emerging TZIP-10 Tezos Wallet Interaction Standard using Wallet Beacon SDK
- TezBridge-wallet, similar, but better than the Tezbridge Singer implementation.
- LegacyWallet — An implementation that can automatically forge, sign and inject. Useful for development and testing workflows.
Beacon-Wallet — The Tezos Wallet Interaction Specification
The Beacon Wallet provider will allow your Application to work with any wallet that supports the TZIP-10 standard. That’s a big deal!
We are particularly excited about the possibilities of TZIP-10, the upcoming Wallet Interaction Specification. TZIP-10 is a Tezos Improvement Proposal that specifies a standard way for dApps to interact with Wallets. The standard enables Tezos users to use their Wallet of choice with Tezos dApps. For dApp developers, by using the TZIP-10 provider, they maximize the reach of their product to all users of TZIP-10 Wallets.
The TZIP-10 provider builds on the Wallet Beacon SDK from AirGap. Taquito’s goal is to make adoption of TZIP-10 trivial. Some demos of this technology to come soon!
In the case of TezBridge, the Wallet API uses TezBridge’s structured API, as opposed to sending TezBridge forged operations to sign, as the “Contract API” does. The Wallet API enables richer UX, which is apparent in TezBridge’s case when the user sees all the details of the requested operation presented for signing instead of an unreadable string of forged operation bytes.
When to use the Taquito “Contract API” or the “Wallet API”
- Use the Contract API for backend node.js services or command-line tools.
- Use the Wallet API for developing web/desktop/mobile applications.
Let’s discuss what the existing Contract API does and doesn’t do.
The Contract API fulfils all the functional duties to get an operation applied to the blockchain, such as preparing, forging, signing (or delegation of signing) and injection/broadcasting.
These duties are well-matched to use-cases in the backend/server-side of the development stack where a wallet is not required.
The Contract API is also the appropriate API to build a wallet itself.
The Contract API is ideal for use-cases such as;
- Implementing pay-out processes for a Baker operation
- Funding/Withdrawl processes for an exchange/custodian
- Preparing and Forging operations in offline/air-gapped environments
- Custodial wallets
Using the Contract API for a user-facing application is not the best fit because the Contract API does too much in this context. This experience is observable when using TezBridge as a signer with the Contract API.
The Contract API sends a forged byte sequence to TezBridge signer. In this context, TezBridge is treated as a signer and not a wallet. Signers only deal with operation byte strings. The Contract API deprives the Wallet of its preparation, estimation and forging duties.
TezBridge can accept raw operation byte sequences and non-forged operations. The latter is a much better user experience because the end-user can review the details of the requested operation. TezBridge also has the ability to activate/reveal a new account, which is not possible when it is asked to sign bytes while using a brand new address (a source of a lot of frustration for users!)
The duties of a Wallet are much broader than the very narrow duty of signing operation byte sequences. That’s one reason why we built the Wallet API. It offers a better user experience by doing less. It allows Wallets to carry out all the duties expected of a Wallet.
The Wallet API introduces a new method to process operation confirmations. Observables. When the dApp sends the operation to the wallet, the dApp will “listen” for when the operation appears in a block. The Wallet API observable will “emit” a stream of events as they occur. Orphan/Uncle block detection is also surfaced when observing confirmations for an operation.
This stream of high fidelity real-time data gives the developers more possibilities to create compelling user experiences for Applications build on Tezos. We are very excited to see what the community puts this to use.
Taquito’s Wallet API is for Applications or dApps that require the user to sign operations.
- Developers can choose from TZIP-10, TezBridge, LegacyWallet or use a custom Wallet API provider
Taquito’s Contract API is for backend applications and building wallets themselves.
- Suitable for scenarios that do not require interaction with a users Wallet
- Offline forging and signing
- Baker payout processes
- Exchange or Institutional processes such as payouts or origination of smart contracts
Check out this blog post from Claude Barde to see how to create an app using the new Wallet API: https://medium.com/@claudebarde/build-a-tezos-dapp-using-taquito-and-the-beacon-sdk-692d7dc822aa