Why DeFi needs TokenScript
Decentralized Finance (DeFi) demonstrates the power and maturity of the Ethereum ecosystem. While the user experience gradually improves, there remains a chasm between wallets and blockchains. This tends to confuse even the most sophisticated of Ethereum users.
Thankfully, TokenScript can bridge the chasm.
I tested Compound recently. This is the DeFi app everyone talks about. Though I use cryptocurrency and crypto-tokens, I’m not an Ethereum developer. So I tested Compound the easiest way possible – on my Chrome browser with MetaMask extension to connect to my wallet.
Testing Compound involved several steps:
- exchanging ETH against WBTC on UniSwap. Conducting exchanges in this way offers more yield. This is because UniSwap is another DeFi that allows me to exchange tokens directly from my wallet.
- creating cWBTC on Compound. This is a Compound token. It represents my rights to redeem WBTC, together with the interest accrued by the token.
- lending the WBTC for yield.
The whole process occurred with fluency. It illustrated how advanced Ethereum wallets and dApps are, the different ways in which smart contracts integrate, and how DeFi renders centralized services obsolete. At no stage did I relinquish my keys to a third party.
There’s a lot of information missing, however.
With that in mind, there are some things which drastically tarnish the user experience:
1. Metamask has no records regarding the UniSwap exchange. All I ever see is a simple transactions list. If I researched them on Etherscan, I might find the details. This is potentially problematic for tax declaration purposes.
2. When I created cWBTC, my WBTC MetaMask balance fell to zero. To see my cWBTC balance, I had to paste the cWBTC contract address into some field. Then I had about 90x as much cWBTC as I had WBTC. This baffled me.
3. Whenever I lend WBTC on Compound, I receive COMP tokens. This is known as “yield farming.” It’s a nice feature, but it leaves an unanswered question: where are the tokens? To see them in MetaMask, I again have to find the contract address, then paste it in some field. But since my account balance is zero, I have to claim the tokens first. As a result, MetaMask can’t see the COMP I earned, at all. This is the case even when it knows the smart contract address.
4. Ultimately, I still use a website. If the Compound website goes offline, I’m at a loss as to what to do. In theory, I own all the keys for my funds. But my wallet doesn’t understand the operations involved. Nor does it acknowledge the tokens I own. Consequently, I’m completely dependent on the Compound website to interpret what occurs on the blockchain, then craft a transaction for me.
I love DeFi and am really impressed by Compound. But the lack of clarity around the transactions that happened in my wallet is a significant drawback for a variety of reasons. Even if we, theoretically, have decentralization and non-custodial cryptocurrency wallets, practically and personally I feel dependent on centralized services. I’m certain I feel this way for one reason:
Smart wallets have no choice but to be dumb.
All DeFi dApps include the problems I’ve described. And I think that’s because smart wallets, it bears repeating, are dumb.
How, then, do I think a smart wallet should behave?
I believe a smart wallet should:
- Display all the relevant details of a transaction.
- Detect my ownership of cWBTC tokens and explain the ratio.
- Show how much interest I earn and have earned, and whether I can claim my COMP tokens.
- Know how to craft the transactions to lend and redeem my COMP token and provide a button for doing so.
And so on. But alas, MetaMask is dumb.
And that is not the fault of MetaMask. It is a great wallet. It enhanced the blockchain user experience on multiple fronts, and it serves as an impressive gateway to the Ethereum blockchain.
Nevertheless, MetaMask can’t be smart. It’s inherently limited in its understanding of the blockchain — and to be fair, every wallet is. This is because there’s no standardized layer between the blockchain and user agents. They’re just wallets.
MetaMask’s developers would need to perform a considerable amount of manual work to make MetaMask smart. They would need to format it so that it could read and understand smart contracts, describe them in the wallet UI, and craft the transaction schemes involved with the contracts.
It’s unreasonable to expect wallet developers to accomplish all that. Even if they could, it would blow MetaMask out of proportion and will pose a risk to the app’s performance. Furthermore, it would not be able to scale. Imagine the number of tokens and smart contracts that exist today and the ones that will pop up as DeFi becomes mainstream. The developers wouldn’t be able to timely implement all the required changes.
Instead, what we need is a layer between the blockchain and user agents. Something which allows smart contract authors and token issuers to explain smart wallets, smart contracts and tokens.
In that regard, it is this clarity that TokenScript provides. It’s the missing piece to replace websites with smart wallets, while maintaining seamless user experiences.
It’s a simple, yet powerful solution.
TokenScript is written and signed by the token issuer. Users can download it anywhere. We have a repository for them, but any website can serve it, just as any website can validate an author’s signature.
It also provides a common data layer. This way, if you have 10 tokens whose behaviour was dependant on Ether value, it wouldn’t be necessary for each of them to enquire the blockchain 10 times.
Wallets can store TokenScripts, then use them. As we said before, it’s a simple, yet powerful solution. And we’ve implemented TokenScript in AlphaWallet. It may be a work in progress, but we’ve made substantial progress. To date, we’ve created FIFA soccer tickets, digital car keys (i.e. car owner portals) for several automobile MNCs, smart DeFi tokens for major DeFi projects, as well as other smart tokens — such as the ones for ENS — all using TokenScript. You’ll find a few examples of TokenScript in our GitHub repository. In fact, we’ve already sketched out several use cases.
We sincerely believe that TokenScript is needed to unleash the power of tokenization and smart contracts. To obtain more information about TokenScript, or contribute to TokenScript, visit our GitHub repository, read its concept paper, and/or check out our community forums.