DeFi Boom Coming: Internet Computer Smart Contracts Can Now Transfer ICP Tokens

The upgrade combines the world’s most powerful blockchain with a wave of DeFi innovation, unlocking the next evolution of DeFi.

Canister smart contracts on the Internet Computer blockchain have always been able to receive and hold ICP utility tokens, but ICP tokens have not been transferable via canisters — until today. The Internet Computer community actively shapes how the blockchain’s technical features and upgrades are adopted and automatically implemented, and community feedback has clearly emphasized that enabling canister smart contracts to transfer ICP utility tokens was always a high priority, especially to ignite advanced DeFi on the Internet Computer ecosystem.

It’s now a reality: canisters can freely hold and transfer ICP tokens. To enable this feature, the community overwhelmingly logged 18.918% approval (58,620,582 voting power) against 0.004% rejection (13,052 voting power) to adopt NNS Proposal #30946. Due to an unrelated technical issue in subnet “pjljw”, the Foundation voted against the initial proposal at the last minute, but subnet “pjljw” is back to normal operation and the Foundation resubmitted NNS Proposal #31471 today with a vote in favor. The adoption upgrades the ledger to enable canisters to transfer ICP tokens. This important development combines the world’s fastest and most powerful blockchain with a wave of DeFi experimentation, unlocking the next evolution of DeFi.

Motion Proposal to Integrate Bitcoin With the Internet Computer Adopted by Community

At a basic level, for example, a canister can now send ICP tokens to the cycles minting canister in order to sustain its operation. OpenChat will soon allow users to send ICP tokens to one another via instant messages. An array of dapps and marketplaces will implement different integrations for moving or trading ICP tokens via canisters, creating a wealth of possibilities. (Note: We continue to harden the Internet Computer, but it is still in Beta and things can go wrong. We strongly advise users to send only small amounts of ICP tokens. Moreover, when users want to send large amounts of ICP tokens in the future, we have provided guidance to check canister controllers and inspect the source code before sending tokens. See details further below.)

This also marks the arrival of decentralized exchanges that run entirely on a sovereign blockchain, with zero cloud nodes helping to run a given DEX, and cloud providers no longer hosting front-end interfaces and gatekeeping users. Imagine Uniswap running completely on-chain. A community developer recently unveiled a Uniswap front end on the Internet Computer, showing how conventional DeFi solutions can fully run on blockchain technology.

Exchanges that are already building end to end on the Internet Computer include ICPSwap, DFinance, and InfinitySwap. Even centralized exchanges such as Coinbase, Binance, and Crypto.com can be brought entirely on-chain. “A problem with ‘http://Crypto.com’ is implying that crypto should run on centralized websites,” New York Law School professor Houman Shadab recently noted. “Crypto websites should run on decentralized networks like the Internet Computer.”

With other roadmap features in progress, such as the Internet Computer’s direct integration with the Bitcoin network and the Service Network System for tokenizing dapps, this big development for canisters heralds a new stage of open innovation in DeFi — and the beginning of the Web3 finance revolution.

Technical review

Looking closely at the details, the proposal that the community adopted today goes beyond enabling canisters to transfer ICP tokens. On the Internet Computer, entities have identifiers called principals, such as ryjl3-tyaaa-aaaaa-aaaba-cai (the ledger canister principal). There are different types of principals: users have self-authenticating principals, and canisters do not. Previously, only self-authenticating principals could send ICP tokens, which meant that users could transfer ICP but canisters had to be explicitly whitelisted to do so. With the adoption of this change, all principals are allowed to transfer ICP. The only exception is the anonymous principal, which is assigned to users who do not authenticate to the Internet Computer.

You should be careful before you let a canister smart contract handle your ICP tokens. As noted, the Internet Computer is still in Beta. Users need to beware that, unlike other blockchains where smart contracts can only be immutable (unable to be changed), canisters on the Internet Computer can be mutable or immutable. Each canister has a list of controllers who are allowed to modify the code. This is advantageous for a developer who is building a dapp, because they can improve the dapp over time without having to deploy new contracts. But it is also a risk: a canister smart contract may look benign, but the controller could cheat and update the code of the canister to do something unexpected with the ICP tokens it receives.

Users must be alert to the dangers of rug-pull operations, where malicious developers might set up a canister with benign behavior and get people to transfer ICP tokens to it, and then change the canister code to steal the tokens. If you are using large amounts of tokens, be sure to only interact with immutable canisters or canisters that have trustworthy controllers.

There are several ways a developer can make a canister immutable — for example, by deleting the controllers or setting it to be controlled by a black-hole canister that is guaranteed to not change the code. Moreover, in addition to checking the controller of the canister for immutability or trustworthiness, users may also want to verify the source code of the canister to ensure it has the right behavior. For more information, see the guidance on how to gain trust in a canister and for developers to create verifiable open-source canister smart contracts.

Additional functionality and roadmap

This version of the newly released ledger canister includes Candid methods for transferring ICP tokens between accounts and for getting account balances. These suffice to enable verification of incoming transfers: the sender and receiver of a transfer agree beforehand on a fresh subaccount for the transaction. The specific subaccount can encode, for example, additional parameters. The recipient can then verify the balance of the subaccount to ensure that the correct transfer took place.

Upcoming releases of the ledger canister will include Candid methods for fetching specific transactions; these will enable alternative verification methods that transfers have indeed occurred.

Two upgrades relevant to canisters being able to transfer ICP tokens are the redesign of the flows for converting ICP tokens into cycles (for improved functionality and security), and providing useful abstractions (e.g. libraries and/or additional canisters) that help to seamlessly integrate with the ledger canister. These features are currently in the planning stage.
____

Start building at smartcontracts.org and join our developer community at forum.dfinity.org.

DeFi Boom Coming: Internet Computer Smart Contracts Can Now Transfer ICP Tokens was originally published in The Internet Computer Review on Medium, where people are continuing the conversation by highlighting and responding to this story.

Publication date: 
11/25/2021 - 19:00
Author: 
Disclaimer

The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.