Create Solidity Project – 创建Solidity项目区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Create Solidity Project – 创建Solidity项目区块链毕设代写 是一篇很好的国外资料

Create Solidity Project

Generates a raw dependency project for developing smart contracts.

Create Solidity Project is tested on macOS and Linux.
If something doesn’t work, file an issue.

Quick Steps

Setting up a normal project

$ npx create-solidity-project project-name

Setting up a typescript project

$ npx create-solidity-project project-name --template typescript

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

Why should one use raw dependencies instead of frameworks?

  1. In the current phase of blockchain development, most of the tools are well tested for basic features but complex utils might have bugs since less devs might have used them. Using a framework, with dependencies in which bugs are found and fixed more frequently results in receiving late updates in case a particular internal dependency breaks and needs update. Android OS users can relate with this, updates released directly from Google are available instantly to users in Pixel or Motorola, while for brands like Samsung releases OS with mod at after a delay. It’s just a matter of choice of techies 😉
  2. Frameworks abstract inner functionality away from devs to make it smooth, but this results in lesser learnings of blockchain internals for beginner devs.

Things to consider

create-solidity-project is not a framework, it only copys basic files and installs raw dependencies, after that you are on your own. You will need to refer documentation of the particular dependency (links mentioned in created project’s README) for any further hacking in your project. If you are a learner and want to hack into internals your workflow, you can give this a try. If you have any questions, you can shoot them to me.

If you are instead looking for abstraction (easy tasks become easier), this tool is NOT for that. Using some frameworks can be ideal for this requirement. Some of them: Truffle, Waffle.

If you are familiar with create-react-app, using smart contract frameworks can be similar to relying on magic done by react-scripts while few developers prefer to use with raw dependencies (with npm run eject) so they can hack into it.

Javascript project

Dependencies:

  • solc
  • ethers
  • mocha
  • ganache-core
  • fs-extra

File structure:

├── build // gets generated after: npm run compile    └── SimpleStorage.json  ├── contracts    └── SimpleStorage.sol  ├── test    └── SimpleStorage.test.js  ├── node_modules ├── compile.js // compiles if contract files changed ├── helpers.js ├── .gitignore ├── .gitattributes ├── README.md └── package.json

Scripts:

  • npm run compile: compiles your contracts if they haven’t already.
  • npm run test: compiles contracts and runs the test scripts.

Typescript project

Dependencies:

  • solc
  • ethers
  • mocha
  • ganache-core
  • fs-extra
  • ts-node
  • typescript
  • typechain
  • @typechain/ethers-v5
  • @types/node
  • @types/mocha
  • @types/fs-extra

File structure:

├── build // gets generated after: npm run compile    ├── artifacts       └── SimpleStorage.json // compiled contract    └── typechain        ├── SimpleStorage.d.ts // contract type definatinons        └── SimpleStorageFactory.ts // contract factory (bytecode && abi)  ├── contracts    └── SimpleStorage.sol  ├── test    ├── suites       ├── index.ts // test import file       ├── Ganache.test.ts       └── SimpleStorage.test.ts    ├── utils       ├── index.ts       └── parseReceipt.ts // parses logs & contract internal txs    ├── global.ts // declare global vars (common stuff across tests)    ├── server.ts // start ganache server    └── index.ts // grand test import file  ├── node_modules ├── compile.ts // compiles if contract files changed ├── .gitignore ├── .gitattributes ├── README.md └── package.json

Scripts:

  • npm run compile => compiles your contracts if they haven’t already.
  • npm run test => compiles contracts and runs the test scripts.
  • npm run test:debug => runs tests in debug mode, this activates parseReceipt util to console log the contract events emitted and internal transactions executed.

Getting Started

  • npx csp new-project-name --template tsc.
  • Start by editing contracts/SimpleStorage.sol and test/SimpleStorage.test.js file. You can try adding methods to contract and access them using simpleStorageInstance.methodName() in test file.

Using parseReceipts to display the logs emitted and internal tx during the tests

// prints logs and internal txs if any occurred in DEBUG MODE await parseReceipt(simpleStorageInstance.methodThatEmitsLogsOrInternalTxs());

To run tests in debug mode: npm run test:debug.

More details

  • This project uses ethers.js, a Complete Ethereum library with wallet implementation in JavaScript. This makes it a great alternative to web3.js. You will want to keep ethers.js documentation handy.
  • You can customise to a specific solc version by doing npm i solc@0.5.10, but it’s not recommended. Note: solc@0.4.* will not work with this template, because it has a different compile.js structure. It is recommended that you upgrade your smart contract code to be able to be compiled by a solc@0.5.* and above compiler. You can check out breaking changes in 0.5.* and breaking changes in 0.6.*and upgrade your smart contracts accordingly.
  • If you wish to use web3.js instead, you can do it by uninstalling ethers.js using npm uninstall ethers, then you can install web3.js using npm i web3. Then you will have to change the tests files.

Acknowledgement

This tool is heavily inspired from facebook/create-react-app. Creators of this project are very much thankful to create-react-app‘s creators and contributors.


创建Solidity项目的快速步骤?

需要考虑的事项

Javascript项目

入门

使用parseReceipts显示测试期间发出的日志和内部发送

更多细节

确认

  • 在当前区块链blockchain开发阶段,大多数工具都是对基本特性进行了很好的测试,但是复杂的utils可能会有bug,因为很少有开发人员使用它们。使用一个框架,在依赖项中发现并更频繁地修复bug会导致在特定的内部依赖项中断并需要更新时接收更新。Android操作系统用户可以与此相关,直接从Google发布的更新可以立即提供给Pixel或Motorola的用户,而对于像三星这样的品牌来说,在延迟一段时间后就会发布带有mod at的操作系统。这只是技术人员的选择问题;)
  • 框架将内部功能从开发人员中抽象出来,以使其更加流畅,但这导致初学者对区块链blockchain内部知识的了解较少。
  • solc
  • 醚类
  • 摩卡
  • ganache核心
  • fs extra
  • npm运行编译:编译你的合同,如果它们还没有。
  • npm run test:编译契约并运行测试脚本。
  • solc
  • 以太网
  • 摩卡
  • ganache核心
  • fs extra
  • ts节点
  • typescript
  • 类型链
  • @typechain/ethers-v5

  • @types/fs extra
  • @types/fs extra
  • npm run compile=>如果合同没有,则编译合同已经。
  • npm run test=>编译协定并运行测试脚本。
  • npm运行测试:调试=>在调试模式下运行测试,这将激活parseReceipt util来控制台记录发出的契约事件和执行的内部事务。
  • npx csp新项目名称–模板tsc。
  • 从编辑合同开始/简单存储.sol和测试/SimpleStorage.test.js文件。您可以尝试向协定添加方法并使用impleStorageInstance.methodName()在测试文件中。
  • 本项目使用以太网.js,一个完整的以太坊eth库,使用JavaScript实现wallet。这使得它成为web3.js的一个很好的替代品。你会想要以太网.js文件方便。
  • 您可以通过执行npm i来定制特定的solc版本solc@0.5.10,但不建议使用。注:solc@0.4。*无法使用此模板,因为它具有不同的编译.js结构。建议您升级智能合约代码,以便能够由solc@0.5。*以及上面的编译器。您可以查看0.5.*和0.6.*中的中断更改,并相应地升级智能合约。
  • 如果希望改用web3.js,可以通过卸载以太网.js使用npm卸载以太网,然后可以使用npm i web3安装web3.js。然后你必须更改测试文件。在
  • 生成用于开发智能合约的原始依赖项项目。

    Create Solidity Project在macOS和Linux上进行测试。
    如果有问题,请提交问题。

    需要考虑的事项

    Javascript项目

    $ npx create-solidity-project project-name

    入门

    $ npx create-solidity-project project-name --template typescript

    (npx随npm 5.2+及更高版本提供,请参阅旧版npm的说明)

    使用parseReceipts显示测试期间发出的日志和内部发送

    1. 在当前区块链blockchain开发阶段,大多数工具都是对基本特性进行了很好的测试,但是复杂的utils可能会有bug,因为很少有开发人员使用它们。使用一个框架,在依赖项中发现并更频繁地修复bug会导致在特定的内部依赖项中断并需要更新时接收更新。Android操作系统用户可以与此相关,直接从Google发布的更新可以立即提供给Pixel或Motorola的用户,而对于像三星这样的品牌来说,在延迟一段时间后就会发布带有mod at的操作系统。这只是技术人员的选择问题;)
    2. 框架将内部功能从开发人员中抽象出来,以使其更加流畅,但这导致初学者对区块链blockchain内部知识的了解较少。

    更多细节

    create solidity project不是一个框架,它只复制基本文件并安装原始依赖项,然后您就可以自己动手了。您需要参考特定依赖项的文档(在创建的项目的自述文件中提到的链接),以便在您的项目中进行进一步的黑客攻击。如果你是一个学习者,想侵入你的工作流程的内部,你可以尝试一下。如果你有任何问题,你可以向我提问。

    如果您正在寻找抽象(简单的任务变得更容易),则此工具不适用于此。使用一些框架可以很好地满足这一需求。一些:松露,华夫饼。

    如果您熟悉create react app,那么使用智能合约框架可以类似于依靠react脚本实现的魔力,而很少有开发人员喜欢使用原始依赖项(npm run eject)以便他们可以侵入它。

    确认

    依赖项:

    • solc
    • 醚类
    • 摩卡
    • ganache核心
    • fs extra

    文件结构:

    ├── build // gets generated after: npm run compile    └── SimpleStorage.json  ├── contracts    └── SimpleStorage.sol  ├── test    └── SimpleStorage.test.js  ├── node_modules ├── compile.js // compiles if contract files changed ├── helpers.js ├── .gitignore ├── .gitattributes ├── README.md └── package.json

    脚本:

    • npm运行编译:编译你的合同,如果它们还没有。
    • npm run test:编译契约并运行测试脚本。

    Typescript project

    依赖项:

    • solc
    • 以太网
    • 摩卡
    • ganache核心
    • fs extra
    • ts节点
    • typescript
    • 类型链
    • @types/fs extra
    • @types/node
    • @types/fs extra
    • npm run compile=>如果合同没有,则编译合同已经。

    文件结构:

    ├── build // gets generated after: npm run compile    ├── artifacts       └── SimpleStorage.json // compiled contract    └── typechain        ├── SimpleStorage.d.ts // contract type definatinons        └── SimpleStorageFactory.ts // contract factory (bytecode && abi)  ├── contracts    └── SimpleStorage.sol  ├── test    ├── suites       ├── index.ts // test import file       ├── Ganache.test.ts       └── SimpleStorage.test.ts    ├── utils       ├── index.ts       └── parseReceipt.ts // parses logs & contract internal txs    ├── global.ts // declare global vars (common stuff across tests)    ├── server.ts // start ganache server    └── index.ts // grand test import file  ├── node_modules ├── compile.ts // compiles if contract files changed ├── .gitignore ├── .gitattributes ├── README.md └── package.json

    脚本:

    • npm run test=>编译协定并运行测试脚本。
    • npm运行测试:调试=>在调试模式下运行测试,这将激活parseReceipt util来控制台记录发出的契约事件和执行的内部事务。
    • npx csp新项目名称–模板tsc。

    Getting Started

    • 从编辑合同开始/简单存储.sol和测试/SimpleStorage.test.js文件。您可以尝试向协定添加方法并使用impleStorageInstance.methodName()在测试文件中。
    • 本项目使用以太网.js,一个完整的以太坊eth库,使用JavaScript实现wallet。这使得它成为web3.js的一个很好的替代品。你会想要以太网.js文件方便。

    Using parseReceipts to display the logs emitted and internal tx during the tests

    // prints logs and internal txs if any occurred in DEBUG MODE await parseReceipt(simpleStorageInstance.methodThatEmitsLogsOrInternalTxs());

    在调试模式下运行测试:npm run测试:调试。

    More details

    • 您可以通过执行npm i来定制特定的solc版本solc@0.5.10,但不建议使用。注:solc@0.4。*无法使用此模板,因为它具有不同的编译.js结构。建议您升级智能合约代码,以便能够由solc@0.5。*以及上面的编译器。您可以查看0.5.*和0.6.*中的中断更改,并相应地升级智能合约。
    • 如果希望改用web3.js,可以通过卸载以太网.js使用npm卸载以太网,然后可以使用npm i web3安装web3.js。然后你必须更改测试文件。在
    • If you wish to use web3.js instead, you can do it by uninstalling ethers.js using npm uninstall ethers, then you can install web3.js using npm i web3. Then you will have to change the tests files.

    Acknowledgement

    这个工具的灵感来源于facebook/create react app。这个项目的创建者非常感谢创建react应用程序的创建者和贡献者。

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

    www.interchains.cc

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

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

    提供最优质的资源集合

    立即查看 了解详情