以太坊(Ethereum)开发框架 Truffle 入门(五):部署到网络

客户端配置

Before deploying contracts to the network, ensure your Ethereum client is running and receiving requests on http://localhost:8545. This is the default location Truffle expects your client to handle requests, though you can change this within your project configuration. If you're using the EthereumJS TestRPC, you're all set as it defaults to that hostname and port number.

命令

To deploy your contracts to your Ethereum client, run:

$ truffle deploy

This will compile any uncompiled contracts and then deploy all contracts specified within your project configuration. You'll need to update the configuration whenever you write new contracts you'd like deployed.

注意事项

Most dapps have special deployment requirements that are complex and difficult for tool maintainers to predict. Instead of attempting to support all possible deployment use cases, Truffle instead only tries to support one, where contracts have the following characteristics:

  • All deployed contracts are singletons, meaning you only intend for one instance of that contract to exist in the wild.
  • All deployed contracts take no constructor parameters.

Though this deployment support is narrow, we believe it requires you to think clearly about how your application will be built. For instance, you need to answer the question, "Which contracts does my application need to exist on the network at all times, and which contracts will my application instantiate during normal execution?". The answer should tell you which contracts you want to include in truffle deploy and which ones you don't.

自定义部署

You can extend Truffle's deployment capabilities if you have custom deployment requirements or you'd like to run a script after every deploy. See the after_deploy configuration option for more details.

英文原文:http://truffle.readthedocs.io/en/latest/getting_started/deploy/

转载于:https://my.oschina.net/unrealce/blog/682091

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值