Dfns now supports the Internet Computer as a Tier 1 Blockchain as well as its native token ICP.
We’re excited to announce that Dfns now supports the Internet Computer and its native token, ICP, as a Tier 1 blockchain. This marks a new chapter for developers, fintech innovators, and financial institutions who can now harness the power of the ICP blockchain with the added security and functionality of Dfns’ Multi-Party Computation (MPC) wallets. In this post, we’ll break down what this integration entails, how it works, and what opportunities it unlocks for users.
What is the Internet Computer?
The Internet Computer Protocol (ICP) redefines the public internet by transforming it into a global computing platform. Unlike traditional systems that rely on centralized IT infrastructure like cloud providers, ICP enables developers to build and run software directly on the public internet. This approach provides high efficiency, security, and scalability. From decentralized finance (DeFi) applications to social networks, gaming platforms, and enterprise solutions, Internet Computer supports a broad range of projects that can operate seamlessly at web speed. Its native token, ICP, plays a crucial role in securing and interacting with the network.
Key tickers and concepts in ICP
Before we dive into how the Dfns integration works, let’s familiarize ourselves with some key terms:
- ICP: Native token of the Internet Computer blockchain.
- ICRC1: ICRC-1 is a standard for creating and managing fungible tokens on the Internet Computer. It’s not tied to a specific ledger but provides a set of rules that different ledgers can adopt.
- Canister: Canisters are the core components of the Internet Computer. They work like smart contracts in other blockchain systems but offer more features. Canisters store both data and code, and they communicate by sending messages to each other. There are various types of canisters, like the ledger canister, which keeps track of accounts and records all transfers in a transaction ledger that can only be added to, not changed.
- Ledger: A ledger records transactions in a series of connected blocks, with each block linking to the one before it. This creates a blockchain that cannot be changed without altering all previous blocks. On the Internet Computer, two types of ledgers are mainly used: the ICP ledger canister and ICRC-1 ledgers. The ICP ledger’s main functions are to record, burn, mint, approve, and most commonly transfer transactions related to the ICP token.
How Dfns enhances ICP with wallets
By integrating the Internet Computer Protocol as a Tier 1 blockchain, Dfns enables developers to interact with the ICP using MPC wallets—offering enhanced security, decentralization, and user-friendly functionality. Here’s what developers can do with this integration:
- Transfer ICP: Easily transfer ICP tokens securely.
- Broadcast Transactions: Broadcast ICP transactions on-chain.
- Check Balances: View ICP balances within the Dfns wallet.
- Create ECDSA Signatures: Generate signatures for secure ICP transactions.
- Interact with Canisters: Engage with smart contracts on ICP using MPC wallets.
- Webhooks: Stay updated with blockchain events using ICP's data indexing.
This integration brings ICP's capabilities to the Dfns platform in a way that enhances security while simplifying the user experience.
How the integration works
Dfns’ ICP integration leverages the Rosetta API, an open-source project initiated by Coinbase to standardize blockchain interactions. The Internet Computer chose to implement this standard API to ease interaction with their native ICP ledger and with their various ICRC-1-compatible ledger (like OGY, ckBTC,...). Rosetta provides two key APIs:
- Data API: Used to fetch data like blocks and transactions.
- Construction API: Used to create, sign, and broadcast transactions.
By using Rosetta, Dfns supports ICP and ICRC-1 tokens with ease. For users who want more control, Dfns provides endpoints that allow for different levels of interaction:
- Transfer: The simplest way to transfer funds.
- Broadcast: Users prepare their own transactions and Dfns signs and broadcasts them.
- Sign: Users create the entire transaction and Dfns signs it, leaving the final steps to the user.
For those who prefer to build their own integration, Dfns offers step-by-step guidance on setting up an ICP/Rosetta node, preparing transactions, and handling ICP and ICRC-1 tokens differently where needed.
Choosing the Rosetta implementation primarily impacts the last two endpoints: Broadcast
and Sign
. We expect that transactions submitted for signing or broadcasting will be constructed using the standard Rosetta process. But don't worry! Rosetta offers a convenient way to build your transaction through the construction/payloads endpoint of its Construction API. Typically, you just need to provide some transaction metadata, and Rosetta will handle the rest.
Build your own integration
For users who want more control and prefer using the Broadcast and Sign endpoints, we've provided detailed setup instructions below. We'll also explain the differences between ICP and ICRC1 integration.
Setup your ICP/Rosetta node
To sign or broadcast Rosetta-formatted transactions, you'll need a Rosetta node to create them. Setting up an ICP Rosetta node is simple and easy to manage. You can follow this step-by-step guide in the documentation to get started.
Prepare your transaction
Once your Rosetta node is set up, you're ready to start building transactions! To create a Rosetta transaction, use the construction/payloads
endpoints and provide the necessary metadata so Rosetta knows how to construct the transaction.
- Network Identifier: This tells Rosetta which blockchain you're interacting with. For ICP, the network ID is always
00000000000000020101
. - Public Key: You must provide your public key and specify the curve you intend to use. For our purposes, this will always be
secp256k1
. - Operations: These are Rosetta's atomic blockchain actions. You need to specify exactly what Rosetta should do on the blockchain. For a simple ICP transaction, you’ll need to:some text
- Withdraw funds from the sender
- Deposit funds to the recipient
- Pay the transaction fees
When combined, the transaction body for a native ICP transaction will look like this:
curl --location '0.0.0.0:8081/construction/payloads' --header 'Content-Type: application/json' --data '{
"network_identifier": {
"blockchain": "Internet Computer",
"network": "00000000000000020101" <-- ICP identifier
},
"public_keys": [
{
"hex_bytes": "PUB_KEY",
"curve_type": "secp256k1"
}
],
"operations": [
{
"operation_identifier": {
"index": 0
},
// First we tell rosetta to withdraw funds from sender
"type": "TRANSACTION",
"account": {
"address": "sender"
},
"amount": {
"value": "-10", <-- Note that the value is negative
"currency": {
"symbol": "ICP",
"decimals": 8
}
}
},
{
"operation_identifier": {
"index": 1
},
// Then we tell rosetta to deposit funds to recipient
"type": "TRANSACTION",
"account": {
"address": "Recipient"
},
"amount": {
"value": "10", <-- Note it's positive this time
"currency": {
"symbol": "ICP",
"decimals": 8
}
}
},
{
"operation_identifier": {
"index": 2
},
// Finally pay the fees
"type": "FEE",
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
"amount": {
"value": "-10000",
"currency": {
"symbol": "ICP",
"decimals": 8
}
}
}
]
}
Calling this endpoint will return you an object that will contain an unsigned_transaction
. This is the hex you need to give us to sign/broadcast
your transaction. You can find the construction/payload
documentation here.
For the bravest, if you want to broadcast by yourself your transaction after we signed it, you will need to call the Rosetta endpoint construction/submit
. More information can be found here
Note: When building the transaction, you used the operation type TRANSACTION, which is specific to the ICP ledger. For ICRC1, the operation type differs. Additionally, in the ICP Ledger, sender and recipient are identified using an "AccountId." In ICRC1, however, they are identified using a "Principal ID."
For ICRC1 integrations
ICP integration and ICRC1 are pretty similar. However some differences can be observed when it comes to building a transaction
Setup your ICRC1 Rosetta node
Just like ICP, when you want to connect a specific ICRC1 ledger, you will need to set up a rosetta node that will connect to this ledger. It’s still as simple as the ICP one. You can follow this documentation for a step-by-step guide on how to get it up and running.
Prepare your transaction
Again, it’s pretty similar to the ICP process. We still need to use construction/payloads, with the same metadata (i.e. network_identifier
, public_key
, operations
) but with some differences:
- For the network identifier, we will use this time the CanisterId to tell Rosetta to connect to a specific ICRC1 Ledger. For example for OGY, the canister ID is
lkwrt-vyaaa-aaaaq-aadhq-cai
see this . As you might have understood, you will need to have a Rosetta node per ICRC1 token. - The Operation Type will differ from the ICP one. In ICP, it was
TRANSACTION
.For an ICRC1 ledger, the operation type is calledTRANSFER
. - Fees: You don’t have to specify a
FEE
operation when doing an ICRC1 transfer. Indeed, when a ICRC1 ledger is built, the fees configuration is hard-coded. The ledger will calculate the fees for you. - The “address” format is different from ICP to ICRC1 ledger. The first one is using an account ID, the second one is using a principal ID
Here is an example of construction/payloads
call for ICRC1
curl --location '0.0.0.0:8082/construction/payloads' --header 'Content-Type: application/json' --data
'{
"network_identifier": {
"blockchain": "Internet Computer",
// Canister ID!
"network": "lkwrt-vyaaa-aaaaq-aadhq-cai"
},
"public_keys": [
{
"hex_bytes": "PUBKEY",
"curve_type": "secp256k1"
}
],
"operations": [
{
"operation_identifier": {
"index": 0
},
// We use TRANSFER instead of TRANSACTION
"type": "TRANSFER",
"account": {
"address":"SENDER_PRINCIPAL_ID"
},
"amount": {
"value": "-10",
"currency": {
"symbol": "8",
"decimals": 8
}
}
},
{
"operation_identifier": {
"index": 1
},
"type": "TRANSFER",
"account": {
"address": "RECEIVER_PRINCIPAL_ID"
}
},
"amount": {
"value": "10",
"currency": {
"symbol": "8",
"decimals": 8
}
}
}
// No FEE Operation!
],
}'
Secure access to ICP
The Dfns-ICP integration opens up a wealth of possibilities for developers, fintechs, and financial institutions. With the added security of MPC wallets, institutions can confidently explore blockchain applications, from secure fund transfers to sophisticated smart contract interactions. Our goal is to provide seamless, secure blockchain access for developers, allowing them to focus on innovation while we handle the complexity of blockchain interactions.