基于区块链的毕业设计ETHanos – 乙醇

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ETHanos – 乙醇 是一篇很好的国外资料

ETHanos

Thanos is back and he is in the Ethereum universe. He is searching for all 6 infinity stones (space, reality, power, mind, soul and time) on the Ethereum blockchain.

The InfinityStone contract has an owner and a name. The stone also has a state which can be ACQUIRED or UNTAKEN. Default state is UNTAKEN. The stone can be acquired, and whoever acquires it must pay a price (in ETH). In order to be acquired, the stone must have the status UNTAKEN. The stone can also be give(n)Away. Only the owner can call this function and the stone must have the status ACQUIRED.

The InfinityGauntlet contract on construction creates (via factory pattern) and owns 6 infinity stones and stores them on the contract. The contract is able to addStones to the gauntlet. The contract is also able to acquireStone and giveAwayStone.

Hardhat

Hardhat Network is used to run and debug Solidity locally, along with Typechain to provide TypeScript bindings for Ethereum smart contracts.

Solidity

Patterns applied:

  • Checks Effects Interactions

Waffle

External & public contract functions are covered by Waffle tests.

Local dev

  1. npm i
  2. npm run node starts Hardhat Network
  3. npm run deploy deploys the contracts & makes some transactions for testing

Advanced Sample Hardhat Project

This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem.

The project comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts. It also comes with a variety of other tools, preconfigured to work with the project code.

Try running some of the following tasks:

npx hardhat accounts npx hardhat compile npx hardhat clean npx hardhat test npx hardhat node npx hardhat help REPORT_GAS=true npx hardhat test npx hardhat coverage npx hardhat run scripts/deploy.ts TS_NODE_FILES=true npx ts-node scripts/deploy.ts npx eslint '**/*.{js,ts}' npx eslint '**/*.{js,ts}' --fix npx prettier '**/*.{json,sol,md}' --check npx prettier '**/*.{json,sol,md}' --write npx solhint 'contracts/**/*.sol' npx solhint 'contracts/**/*.sol' --fix

Etherscan verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that’s supported by Etherscan, such as Ropsten.

In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:

hardhat run --network ropsten scripts/sample-script.ts

Then, copy the deployment address and paste it in to replace DEPLOYED_CONTRACT_ADDRESS in this command:

npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"

Performance optimizations

For faster runs of your tests and scripts, consider skipping ts-node’s type checking by setting the environment variable TS_NODE_TRANSPILE_ONLY to 1 in hardhat’s environment. For more details see the documentation.


乙烷

塔诺斯回来了,他在以太坊eth宇宙中。他正在以太坊eth区块链blockchain上搜索所有6块无限之石(空间、现实、力量、心智、灵魂和时间)

InfinityStone合同有一个所有者和一个名称。这块石头也有一种状态,可以被获得,也可以被解开。默认状态为未启用。这块石头是可以获得的,任何获得它的人都必须付出代价(以太币)。为了获得,石头必须具有未被挖掘的状态。这块石头也可以送人。只有所有者才能调用此函数,并且石头必须具有已获取的状态

InfinityGauntlet建筑合同创建(通过工厂模式)并拥有6块infinity石头,并将其储存在合同中。这项合同可以使双方达成协议。该合同还可以获得石头和赠品石

安全帽

Hardhat Network用于本地运行和调试Solidity,以及Typechain,为以太坊eth智能合约提供TypeScript绑定

华夫格

外部&华夫格测试涵盖了公共合同功能

  • npm运行节点启动安全帽网络

本地开发

该项目演示了一个高级的安全帽用例,集成了生态系统中与安全帽一起常用的其他工具

高级样本安全帽项目

  1. npm运行部署部署合同和;进行一些事务以进行测试
  2. npm run node starts Hardhat Network
  3. npm run deploy deploys the contracts & makes some transactions for testing

以太扫描验证

该项目附带了一个示例合同、该合同的测试、部署该合同的示例脚本,以及一个简单列出可用帐户的任务实现示例。它还附带了各种其他工具,这些工具预先配置为与项目代码一起使用

尝试运行以下一些任务:

要尝试Etherscan验证,首先需要将合同部署到Etherscan支持的以太坊eth网络,如Ropsten

npx hardhat accounts npx hardhat compile npx hardhat clean npx hardhat test npx hardhat node npx hardhat help REPORT_GAS=true npx hardhat test npx hardhat coverage npx hardhat run scripts/deploy.ts TS_NODE_FILES=true npx ts-node scripts/deploy.ts npx eslint '**/*.{js,ts}' npx eslint '**/*.{js,ts}' --fix npx prettier '**/*.{json,sol,md}' --check npx prettier '**/*.{json,sol,md}' --write npx solhint 'contracts/**/*.sol' npx solhint 'contracts/**/*.sol' --fix

性能优化

检查效果交互

npm i

  • npm运行节点启动安全帽网络
  • npm运行部署部署合同和;进行一些事务以进行测试
  • 在此项目中,将.env.example文件复制到名为.env的文件中,然后对其进行编辑以填充详细信息。输入Etherscan API密钥、Ropsten节点URL(例如来自Alchemy)以及将发送部署事务的帐户的私钥。有了有效的.env文件后,首先部署合同:

    ,然后复制部署地址并将其粘贴到命令中以替换部署的合同地址:

    hardhat run --network ropsten scripts/sample-script.ts

    ,以便更快地运行测试和脚本,考虑跳过TS节点的类型检查,将环境变量TSGNoDEYTANSPILIL仅设置为HyHAT环境中的1。有关更多详细信息,请参阅文档

    npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"

    Performance optimizations

    For faster runs of your tests and scripts, consider skipping ts-node’s type checking by setting the environment variable TS_NODE_TRANSPILE_ONLY to 1 in hardhat’s environment. For more details see the documentation.

    部分转自网络,侵权联系删除区块链源码网

    www.interchains.cc

    https://www.interchains.cc/25112.html

    区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
    区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ETHanos – 乙醇

    提供最优质的资源集合

    立即查看 了解详情