基于区块链的毕业设计ethereum-smart-contract-exercise – 以太坊智能合约练习
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ethereum-smart-contract-exercise – 以太坊智能合约练习 是一篇很好的国外资料
ethereum-smart-contract-exercise
Sample Ethereum smart contract for the Security class seminar at UNIBO
Install
To install the project, clone the repository and install the node dependencies
git clone https://github.com/ale8193/ethereum-smart-contract-exercise.git cd ethereum-smart-contract-exercise npm install
Test run
To run the test execute
npm run test
Deploy a contract on rinkeby
Firstly, set the environment variables by creating the .env
file (or renaming the .env.sample
file) with the following content:
MNEMOMIC=<YOUR_METAMASK_MNEMOMIC> INFURA_NODE_URL=https://rinkeby.infura.io/v3/<YOUR_APP_TOKEN>
The MNEMOMIC
is the set of words given to you by metamask when you create a new account.
The INFURA_NODE_URL
is the token to Ethereum Rinkeby network for deploying the smart contract. You can get it by logging to the infura.io, then create a project and select the key for the Rinkeby network.
Finally, deploy the contract by running:
node deploy.js
Optional start the frontend
Firstly, you need to install the node dependencies also for the frontend, so run:
cd frontend npm install
Secondly, set the environment variables by creating the .env
file inside the frontend
folder (or renaming the frontend/.env.sample
file) with the following content:
REACT_APP_LOTTERY_ADDRESS=<YOUR_DEPLOYED_SMART_CONTRACT_ADDRESS>
The YOUR_DEPLOYED_SMART_CONTRACT_ADDRESS
is the address of the contract deployed on the Rinkeby network
Finally, run the start script inside the frontend
folder
npm start
updated contract and frontend
以太坊eth智能合约练习
UNIBO安全类研讨会的以太坊eth智能合约示例。环境样品文件)包含以下内容:
安装
助记符是创建新帐户时metamask给您的一组单词。
git clone https://github.com/ale8193/ethereum-smart-contract-exercise.git cd ethereum-smart-contract-exercise npm install
测试运行
INFURA_NODE_URL是以太坊ethRinkeby网络的令牌,用于部署智能合约。您可以通过登录到infura.io公司,然后创建一个项目并为Rinkeby网络选择密钥。
npm run test
在rinkeby上部署契约
最后,通过运行来部署契约:
MNEMOMIC=<YOUR_METAMASK_MNEMOMIC> INFURA_NODE_URL=https://rinkeby.infura.io/v3/<YOUR_APP_TOKEN>
首先,您还需要为前端安装节点依赖项,因此请运行:
其次,通过在frontend文件夹中创建.env文件(或重命名frontend/)来设置环境变量。环境样品文件)包含以下内容:
您的部署的智能合约地址是部署在Rinkeby网络上的合约地址,在前端文件夹中运行启动脚本
node deploy.js
可选启动前端
Firstly, you need to install the node dependencies also for the frontend, so run:
cd frontend npm install
Secondly, set the environment variables by creating the .env
file inside the frontend
folder (or renaming the frontend/.env.sample
file) with the following content:
REACT_APP_LOTTERY_ADDRESS=<YOUR_DEPLOYED_SMART_CONTRACT_ADDRESS>
The YOUR_DEPLOYED_SMART_CONTRACT_ADDRESS
is the address of the contract deployed on the Rinkeby network
Finally, run the start script inside the frontend
folder
npm start
updated contract and frontend
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ethereum-smart-contract-exercise – 以太坊智能合约练习