如何在坚固的情况下在板块上创建每个用户的托管钱包?
我是区块链社区的新手,我必须实现一个Web 3.0项目。
在这个项目中,我们有一个ERC20,对于在我们平台上注册的每个用户,我必须创建一个与此用户相关的托管钱包。
用户A希望能够将令牌发送给用户B。
我在Google上没有找到任何具体的东西...所以我可能会朝错误的方向前进。
我的问题是:是否有可能在坚固的情况下使用智能合约进行这种类型的保管钱包,您能解释一下我如何吗?
I'm new in the blockchain community, and i have to realize a web 3.0 project.
In this project, we have an ERC20, and for each user who sign up on our platform, I have to create a custodial wallet attached to this user.
User A want to be able to send tokens to User B.
I didn't find something concrete on google... so I'm maybe going in the wrong direction.
My question is: Is it possible to do that type of custodial wallet with smart contract in Solidity, and can you explain me how ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在其他方面,您将需要3个智能合约:
decloywallet
的智能合约,只能通过某个地址调用部署者地址。这样做的是部署另一个合同的新实例walletproxy
,然后将地址存储在映射到UUID字符串中,您可以用来识别链链DB中的每个客户。factory.sol.sol.sol
合同中调用DeployWallet函数创建新钱包时所部署的合同,仅由某个地址call。它是每个用户的钱包,它只是一份代理合同,它使用delegatecall从Walletimplentation调用功能,因此将来,如果有任何更新,例如Walletimplentation v2 v2,它将始终可以访问它。棘手的部分也是以这样的方式编写它,使得只有某个地址可以调用所有已部署的钱包代理合同。参考合同:
我在被问及如何使用智能合约创建托管钱包时创建了以下合同。
youtube.com/watch?v=xxlWrumakvs“ rel =“ nofollow noreferrer”>实时会话我使用上述模式建立了一个简单的交换。您也可以在此处浏览完整的代码库 https://github.com/celotas/celotas/cxchange
In other to achieve this you will need 3 smart contracts:
deployWallet
that can only be called by a certain address, most likely the deployer address. What this does is deploy a new instance of another contractWalletProxy
and store the address in a mapping to a UUID string which you use to identify each customer in your off-chain DB.Factory.sol
contract, only callable by a certain address. It serves as a wallet for each user and it's only a proxy contract that uses delegatecall to call functions from WalletImplementation, so in the future, if there is any update like WalletImplementation V2 it will always have access to it. The tricky part is also writing it in such a way that only a certain address can call all of the deployed wallet proxy contracts.Reference Contracts:
I created the following contracts for the same demonstration purposes when asked how to create a custodian wallet using smart contracts.
I also did a live session where I built a simple exchange using the pattern described above. You can also go through the full codebase here https://github.com/CeloTAs/cXchange