建个私人网站怎么做,专业网络工程师培训,女性门户网站源码,郑州网站推广培训配置区块链网络
启动Ganache软件 使用VScode打开项目的wordspace 配置对外访问的RPC接口为7545#xff0c;配置项目的truffle-config.js实现与新建Workspace的连接。 创建项目
创建一个新的目录
mkdir MetaCoin
cd MetaCoin下载metacoin盒子
truffle unbox metacoincontra…配置区块链网络
启动Ganache软件 使用VScode打开项目的wordspace 配置对外访问的RPC接口为7545配置项目的truffle-config.js实现与新建Workspace的连接。 创建项目
创建一个新的目录
mkdir MetaCoin
cd MetaCoin下载metacoin盒子
truffle unbox metacoincontracts/:Solidity 合约目录
migrations/:可编写脚本的部署文件的目录
test/:用于测试应用程序和合约的测试文件目录
truffle-config.js:松露配置文件
编译合约
truffle compile --all编写测试用例
基本用法
artifacts.require()
引入合约的名称返回抽象合约
const HelloWorld artifacts.require(HelloWorld);
module.exports
导出函数
module.exports function(deployer, network, accounts) {}// Deploy a single contract without constructor arguments
deployer.deploy(A);// Deploy a single contract with constructor arguments
deployer.deploy(A, arg1, arg2, ...);// Dont deploy this contract if it has already been deployed
deployer.deploy(A, {overwrite: false});
contract()
在函数运行之前合约将被重新部署到正在运行的以太坊客户端以便其中的测试以干净的合约状态运行。提供以太坊客户端可用的帐户列表您可以使用这些帐户来编写测试。
it()
每一个需要执行的测试用例。