Depositing and Withdrawing XTZ in the Deku Sidechain
Recently we talked about Deku, a sidechain solution for Tezos by the Marigold team. Today let's find out how to use it.
Marigold published a short guide on how to deposit and withdraw money from Deku using TzPortal. Let’s follow it and explain some points.
Deku in a Nutshell
Deku is a Tezos sidechain. It has its own nodes, blocks, and consensus algorithm, but it relies on Tezos for security.
The main thing about sidechains is that they can be different from the main blockchain. For example, Deku uses a WASM virtual machine, and its throughput reaches 50,000 transactions per second.
So, here’s an example. Alice moves funds from Tezos into Deku, sends almost instant transactions and uses apps, and when needed, withdraws funds back into Tezos. That’s what sidechains are for.
How to Move XTZ to Deku
Deku has a special feature: the tokens in it exist in the form of tickets, i.e. tokens that are stored in your wallet, not in the issuer’s smart contract. Right now, you can’t manage your funds on Deku with regular wallets, so you have to use the terminal or TzPortal.
Before you start working with Deku you have to prepare yourself a bit.
- Create a Jakartanet account and get test XTZ on it. In Temple Wallet you have to click on the network selection button, select Jakartanet, and then request tokens from the Telegram bot called Tezos Faucet Bot;
- Install the Nix package manager to run the Deku client. Although Nix works on Windows, Linux, and macOS, only a Linux or macOS computer with an x86 or ARM (M1, M2) processor architecture would work for Deku;
- Clone the Deku repository from GitHub;
- Install Dune to build projects on OCaml.
Now we can get started. First, generate the keys for the address on Deku. To do that, you have to open the terminal, go to the Deku repository folder and execute the following commands:
echo ‘experimental-features = nix-command flakes’ >> /etc/nix/nix.conf
nix develop -c $SHELL
nix run .#deku-cli create-wallet
Nix will compile the source code for a few minutes the first time it runs. The result is a Deku wallet file in tz1…tzsidewallet format.
Now we have to go to the TzPortal site which is the graphical interface for working with Deku. Once there, connect your account to Jakartanet and upload the Deku wallet file. This will cause the deposit window to appear.
When you deposit, you will send tokens to a Deku smart contract with the address to which they are to be sent. The contract will block the funds and issue the corresponding tickets to the address in Deku.
Now you can send your tickets to another Deku address via the L2 Transfer button or transfer them back to L1, i.e. to your Jakartanet address.
To withdraw the tickets, you must first send a withdrawal transaction to the Deku contract on L2, and then provide proof of transaction to the contract on L1.
To do this, click the Withdraw button on the top panel, specify the number of tickets to withdraw, and click the orange button Withdraw. At the bottom you will see a message with the proof hash: make sure you have copied it.
Next, you need to press the L1 Claim button on the top panel, insert the proof, and press the orange Claim button. After a while, the contract will return the test XTZ to your wallet on Jakartanet.
What Working With Deku May Look Like in the Future
From the user’s point of view, there is a huge UX problem yet to be solved. Most likely, with the growing popularity of Deku and sidechains based on it, popular Tezos wallets will add a function for connecting additional sidechains, as it is implemented in Metamask. In the future, it’s likely that working with Deku will not be much different from transferring assets via cross-chain bridges.
Also, the popularization of L2 could lead to the popularization of L1 tickets. But again, there is a noticeable need to improve the user experience and add ticketing to the popular and familiar wallets.
Subscribe and never miss updates from the world of Tezos: