简体   繁体   English

通过前端反应表单创建和部署智能合约

[英]Creating and deploying a smart contract through a front end react form

I want to know if it's possible to create and deploy a smart contract using a front end form with React and I don't seem to be able to find a clear answer for this question online.我想知道是否可以使用带有 React 的前端表单创建和部署智能合约,我似乎无法在网上找到这个问题的明确答案。

In other words, instead of hard coding their own solidity smart contract, a user would simply have to fill a form which (on submit) will send the filled data to the back end where we'll use them to complete the smart contract code and then deploy it with truffle/hardhat.换句话说,用户无需对自己的solidity智能合约进行硬编码,只需填写一个表单,该表单(在提交时)会将填写的数据发送到后端,我们将使用它们来完成智能合约代码和然后用松露/安全帽部署它。 I looked through the docs and similar questions but most of them are talking about the case where you have an already deployed smart contract and how can it interact with your React app (which isn't what I'm looking for in this case).我查看了文档和类似的问题,但其中大多数都在谈论您已经部署了智能合约的情况以及它如何与您的 React 应用程序交互(这不是我在这种情况下要寻找的)。

Any help is much appreciated任何帮助深表感谢

I would take a look at OpenZeppelin's contract wizard https://docs.openzeppelin.com/contracts/4.x/wizard .我会看看 OpenZeppelin 的合约向导https://docs.openzeppelin.com/contracts/4.x/wizard This essentially does exactly what you are trying to implement, so I would start by looking at this.这基本上完全符合您要实现的功能,因此我将从查看此开始。 To accomplish this, you would need a way to create/edit a local Solidity file somehow based on what the user chooses.为了实现这一点,您需要一种基于用户选择的方式以某种方式创建/编辑本地 Solidity 文件。 From there it would be just as easy as clicking a button to compile/deploy the contract onto a specific network.从那里开始,就像单击按钮将合约编译/部署到特定网络一样简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM