banner
0xMech

0xMech

Focus on various AI application sharing, Blockchain learners, web3 new leeks
twitter

Encrypted Heritage (Part 2) - Practical Application of Smart Contracts

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 code, so all the code is completed by Claude. Therefore, this blog post will also provide a brief introduction to 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 does not require as high of a network requirement as ChatGPT. Interested users can download the Slack work software to experience the Claude application inside. https://slack.com/intl/zh-sg/downloads/windows
slackdownload.png
slackapplication.png

Next is the principle of this smart contract. The inheritor needs to deposit tokens into the inherited account address and interact with this contract. They need to deposit the tokens into this contract address and fill in the inheritor's wallet address. It is also required to interact with this contract at least once 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 cannot interact with other on-chain contracts, 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 that this contract is only a rudimentary form of the delegacy principle and is not perfect. It is only used for practical demonstrations 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 involves crypto assets, 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 quickly get started.
Metamask.png

Next is adding the network. In theory, any on-chain assets that support 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's blockchain browser (https://mumbai.polygonscan.com/), and find the "add Mumbai network" button at the bottom.
addnetwork.png 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 picture, and fill in your own address.
receivefaucet.png

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.
remixIDE.png
Click on "New File" and set the file name to use. Then paste the code written by Claude for me into the editing box. The code has been open-sourced in 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 in it. 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.
deploymentanderror.png
transaction.png

Several shortcomings:

  1. 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.
  2. This simple demonstration project can only be used on one blockchain at a time. Assets on different blockchains cannot achieve unified inheritance.
  3. The operation is cumbersome. For crypto holders who only want to achieve inheritance, this inheritance method is too complicated.
  4. The liquidity of funds is poor. In order to ensure security, the contract I set up does not allow the inheritance to be moved. Once the assets enter this contract, they become dead money and cannot participate in token trading or participate in DeFi appreciation and staking mining projects.

Reflection and outlook:
Unexpected events can happen in life, and how to avoid 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 introduced digital asset inheritance functions. For example, Apple allows users 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 to decentralized servers for permanent storage. This will allow anyone to achieve unified inheritance of various on-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 project direction and don't mind, I welcome email exchanges.
e-mail: [email protected]

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.