基于区块链的毕业设计Dark Forest Smart Contracts – 暗森林智能合约
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Dark Forest Smart Contracts – 暗森林智能合约 是一篇很好的国外资料
Dark Forest Smart Contracts
Development Guide
Installing Core Dependencies
- Node (v12.18.0)
- Yarn (Javascript Package Manager)
- Ganache CLI
Installing The Correct Node Version Using NVM
Dark Forest is built and tested using Node.js v12.18.0 and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash nvm install
After the installation is finished, you can run node --version
to verify that you are running v12.18.0
Installing Yarn & Other Dev Dependencies
Refer to Yarn’s official documentation for the installation guide.
After you have Yarn installed, run the following commands in the root director install the remaining dev depencies:
yarn global add ganache-cli yarn install
Smart Contract Development Setup
All of our smartcontract related code are located in the /eth
directory.
/eth/contracts
contains the smartcontract code written in solidity/eth/test
contains the test for the smartcontract written in Javascript
Installing Dependenciees
Navigate to the /eth
folder and run the following commands:
yarn add scrypt yarn install
Note: We run yarn add scrypt
as a hack too solve a node-gyp error that a lot of our developers have encountered.
Running Tests
yarn test
Deploying Contracts Locally
First, run oz init
in the eth
directory (press ENTER
to accept defaults – typechain support is irrelevant).
Next, open a separate terminal and run a local blockchain with ganache-cli
.
Finally, in your original terminal, run yarn run deploy:dev
.
暗森林智能合约
开发指南
安装核心依赖项
- 节点(v12.18.0)
- Yarn(Javascript包管理器)
- Ganache CLI
使用NVM安装正确的节点版本
黑森林是用js节点v12.18.0,可能无法在其他服务器上正常运行节点.js版本。我们建议使用NVM在多个节点.js您的计算机上的版本。
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash nvm install
安装完成后,您可以运行node–version来验证是否正在运行v12.18.0
安装;其他开发依赖项
有关安装指南,请参阅Yarn的官方文档。
安装完Yarn后,在根director中运行以下命令安装其余的dev依赖项:
yarn global add ganache-cli yarn install
智能合约开发设置
所有与smartcontract相关的代码都位于/eth目录中。
- /eth/合约包含以solidity编写的智能合约代码
- /eth/test包含用Javascript编写的smartcontract的测试
安装依赖项
导航到/eth文件夹并运行以下命令:
yarn add scrypt yarn install
注意:我们运行yarn add scrypt也是为了解决我们的许多开发人员遇到的node gyp错误。
运行测试
yarn test
在本地部署合约
首先,在eth目录中运行oz init(按ENTER键接受默认值-typechain支持不相关)。
接下来,打开一个单独的终端并使用ganache cli运行本地区块链blockchain。
最后,在原来的终端中,运行纱线运行部署:dev。
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Dark Forest Smart Contracts – 暗森林智能合约