[英]Can you deploy a smart contract from a webpage?
I am trying to deploy a smart contract from a webpage.我正在尝试从网页部署智能合约。 I am using react for frontend and I wrote a smart contract in solidity, but the contract is deployed only when I run the truffle commands in terminal.我在前端使用 react 并且我编写了一个可靠的智能合约,但是只有当我在终端中运行 truffle 命令时才会部署合约。 I want to deploy the contract when the user clicks a button.我想在用户单击按钮时部署合同。
How can I do that?我怎样才能做到这一点?
You can do a deployment transaction from frontend using web3.js or ethers.js library.您可以使用 web3.js 或 ethers.js 库从前端进行部署事务。 How to deploy a contract using these libraries, please refer to the documentation of deploy function .如何使用这些库部署合约,请参考 deploy function 的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.