The previous article briefly introduced crypto and smart contracts, and proposed several solutions for inheriting crypto assets as legacies. Today, I will demonstrate how to complete the decentralized legacy (delegacy) project through smart contracts. I personally do not know how to write code, so all the code is completed by Claude. Therefore, this blog post will also briefly introduce Claude.
Claude is an LLM created by a former employee of OpenAI and can be seen as an alternative to ChatGPT. It is very powerful and has lower network requirements than ChatGPT. Interested friends can download the Slack work software to experience the Claude application inside. https://slack.com/intl/zh-sg/downloads/windows
Next is the principle of this smart contract. The inheritor needs to deposit tokens into the inherited account address and then interact with this contract. The tokens are then stored in this contract address and the inheritor's wallet address is filled in. It is also necessary to ensure that there is at least one interaction with this contract every six months. Otherwise, it will be determined that the inheritor has passed away, and the contract will automatically transfer the tokens to the inheritor. For security reasons, this address should not interact with other contracts on the chain, and the tokens can only be transferred in but not out. Otherwise, the inheritance program will be automatically executed and cannot be revoked.
I want to emphasize here that this contract is only a rudimentary form of the delegacy principle and is not perfect. It is only used for practical demonstration and cannot be deployed in practice. I will briefly analyze the specific problems at the end of the article.
Alright, let's start the practical demonstration.
First of all, since it is a crypto asset, you must have an encrypted wallet. I assume that friends who are reading this article already have a wallet. If not, you can search for the usage of Metamask on Baidu and you will quickly get started.
Next is adding a network. Theoretically, any chain asset that supports EVM (Ethereum Virtual Machine) can complete the delegacy project through this smart contract. Below, I will use the Polygon testnet (Polygon Mumbai network) to demonstrate this project. Open the official website of Polygon Mumbai blockchain browser (https://mumbai.polygonscan.com/), and find the "add Mumbai network" button at the bottom.
Wait for the wallet to pop up and add the network and switch to this network.
Next is to receive test tokens through the Faucet website (https://faucet.polygon.technology/). Deploying contracts on the network requires paying gas fees, and test tokens on the testnet can be obtained for free to test the contract. After opening the official website, select the network and token name as shown in the figure, and fill in your own address.
Next is to deploy the contract, which requires the use of the remix IDE tool (https://remix.ethereum.org/). This is an online editing and compiling solidity tool, which is very convenient for contract developers.
Click on "New File" and set the file name to start using it. Then paste the code written by Claude for me into the editing box. The code has been open-sourced on my GitHub project (https://github.com/taipeitalk). You can take a look at it. After writing the code, click on "SOLIDITY COMPILER" and select the appropriate compiler version for compilation. After the compilation is completed, go to the "DEPLOY & RUN TRANSACTIONS" tab and set the "ENVIRONMENT" to "injected provider - Metamask". Finally, simply set the address and click "Deploy" to see the deployed contract in the "Deployed Contracts" on the left. You can test the functions inside. With this, the simple delegacy practical demonstration is completed. If there are any errors, you can send them to Claude for modification, and after the function call is completed, you can also view the transaction on the blockchain browser.
Several shortcomings:
- This method is only applicable to tokens that support EVM. Other tokens can use MPC technology to transfer the private key to different inheritors, especially for crypto like BTC that does not support smart contracts.
- This simple demonstration project can only be used on one chain at a time, and assets on different chains cannot achieve unified inheritance.
- The operation is cumbersome. For crypto holders who only want to achieve inheritance, this method is too complicated.
- The liquidity of funds is poor. In order to ensure security, the contract I set does not allow the inheritance to be moved. Once the assets enter this contract, they become dead funds and cannot participate in token trading, as well as DeFi appreciation and staking mining projects.
Reflection and outlook:
Unexpected events can happen in life, and how to mitigate risks is a question we must consider. In the real world, we can use traditional wills to achieve inheritance, and many companies in the Web2 world have also launched digital asset inheritance functions. For example, Apple allows you to designate inheritance recipients. However, in the Web3 world, such a mature inheritance method has not yet appeared, and the reasons are the ones I mentioned above, as well as other reasons.
Delegacy is the project I want to implement at the moment. By integrating existing technical routes and resources, I want to create a complete delegacy project and deploy it on decentralized servers for permanent storage, allowing anyone to achieve unified inheritance of various chain assets through simple interactions on decentralized web pages.
The outlook is promising, but I am still a technical novice. Completing such a project requires starting from scratch. If any technical experts are interested in this direction of the project and don't mind, I welcome email communication.
e-mail: [email protected]