solidity_practice – 坚固性练习区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,solidity_practice – 坚固性练习区块链毕设代写 是一篇很好的国外资料

solidity_practice

practicing using git while learning about smart contracts written in solidity

DOCUMENTING THE PROCESS: USING VS CODE FOR EDITING!

  1. generated a new Node project, creating a package.json file, adding no specific information

Additional comments: A bit confused with the git usage, managed to get it up and running properly in VS Code

  1. installed a solidity compiler as an npm package using npm install –save solc

Additional comments: Also created a compile.js which will be used to compile the solidity code. Not using the compiler that supplied in the VS extension for solidity, I have it installed for linting. There’s an issue with solidity + node modules. The tutorial I’m using uses 0.4.17. – trying to somehow compile with that version. It needs these lines of code: const path = require(‘path’); //file path const fs = require(‘fs’); //source const solc = require(‘solc’); //solidity module

const practicePath = path.resolve(__dirname, ‘contracts’, ‘practice.sol’); const source = fs.readFileSync(practicePath, ‘utf8’); Using my version instead of ‘latest’, “v0.4.17+commit.bdeb9e52”:

solc.loadRemoteVersion(‘latest’, function(err, solcSnapshot) { if (err) { // An error was encountered, display and quit } else { // NOTE: Use solcSnapshot here with the same interface solc has } });

Except for that, turns out I have to change a couple of other things – compile.js should use different syntax. Not going to follow the tutorial exactly how it’s layed out, I’ll just use the latest versions!

  1. TESTING SETUP : installed the following – npm install –save mocha ganache-cli web3

Additional comments: npm install –global –production windows-build-tools –> tutorial suggests this for web3 on windows, not sure it’s needed anymore Using ganache for a local test network – deployment of bytecode ABI fed into Web3, Mocha testing framework (added mocha in package.json) under scripts->test Run by typing “npm run test” in cmd

  1. Mocha information beforeEach for deploying a new contract, it for manipulating and making assertions

beforeEach( async() => { //async + await, better than promises //get a list of all accounts accounts = await web3.eth.getAccounts()

//use one of those accounts to deploy //the contract });

  1. Attempting to connect to a test network using infura api, need to install truffle hd wallet provider

Additional comments: npm install –save truffle-hdwallet-provider Deprecated, going forward with it. constructor for HDwalletprovider takes two arguments, acc mnemonic and url of what network to connect to – infura network ropsten link

  1. CONTRACT DEPLOYED SUCESSFULLY! Link: https://ropsten.etherscan.io/address/0x23C80234102febDdCbf2d70A3DD676ff50ba0837

solidity_practice

在学习solidity编写的智能合约的同时练习使用git

记录过程:使用VS代码进行编辑!

  1. 生成了一个新的节点项目,创建了一个包.json文件,不添加任何特定信息

附加注释:与git的用法有点混淆,设法使其在VS代码中正常运行

  1. 使用npm install–save solc将solidity编译器作为npm包安装:在每次部署新契约之前安装以下-npm install–save mocha ganache cli web3

附加注释:还创建了一个编译.js它将用于编译solidity代码。我没有使用在solidity的VS扩展中提供的编译器,而是为linting安装了它。solidity+节点模块有问题。我使用的教程使用0.4.17。-试着用那个版本编译。它需要以下代码行:const path=require(’path’);//文件路径const fs=require(’fs’);//source const solc=require(’solc’);//solidity module

const practicePath=路径.解析(u dirname,’合同’,’实践.sol’);常量源=fs.readFileSync(practicePath,’utf8’);使用我的版本而不是’latest’,“v0.4.17版+提交.bdeb9e52“:

solc.loadRemoteVersion(’latest’,function(err,solcSnapshot){如果(err){/遇到错误,则显示并退出}else{/注意:在这里使用solc具有的相同接口的solcSnapshot);

除此之外,我还必须更改其他一些东西-编译.js应该使用不同的语法。不打算完全按照教程的布局,我只使用最新版本!

  1. mocha信息,它用于操纵和做出断言

其他注释:npm install–global–production windows build tools–gt;教程建议在windows上的web3上使用此方法,但不确定是否需要使用ganache进行本地测试网络-字节码ABI的部署(已在中添加Mocha包.json)键入“运行脚本”下的“运行脚本”beforeach(async()=>{//async+await,better promises//get a list of all accounts accounts=await web3。eth.getAccounts公司()

  1. 试图使用infuraapi连接到测试网络,需要安装truffle hd wallet provider

//使用其中一个帐户部署//合同};

其他注释:npm install–save truffle hdwallet provider已弃用,继续前进。HDwalletprovider的构造函数接受两个参数,acc助记符和要连接到哪个网络的url-infura network ropsten link

  1. 合同部署成功!链接:https://ropsten.etherscan.io/address/0x23C80234102febDdCbf2d70A3DD676ff50ba0837在

Additional comments: npm install –save truffle-hdwallet-provider Deprecated, going forward with it. constructor for HDwalletprovider takes two arguments, acc mnemonic and url of what network to connect to – infura network ropsten link

  1. CONTRACT DEPLOYED SUCESSFULLY! Link: https://ropsten.etherscan.io/address/0x23C80234102febDdCbf2d70A3DD676ff50ba0837

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情