【问题标题】:who is the owner of the contracts deployed using truffle?谁是使用松露部署的合约的所有者?
【发布时间】:2017-10-11 15:26:00
【问题描述】:

我正在使用 testrpc 和 truffle 来测试我的合约。

当我输入 truffle migrate 时,这会将我的合约部署到 testrpc 网络。

我的问题是,哪个帐户(来自 testrpc 帐户)已用于部署合约。

换句话说,合约所有者是谁?

提前谢谢你

【问题讨论】:

    标签: solidity smartcontracts truffle


    【解决方案1】:

    默认情况下,所有者是accounts[0],因此是列表中的第一个帐户,但您可以通过在 truffle.js 配置文件中添加“from”来设置所有者

    module.exports = {
      networks: {
        development: {
          host: "localhost",
          port: 8545,
          network_id: "*",
          from: "0xda9b1a939350dc7198165ff84c43ce77a723ef73"
        }
      }
    };
    

    有关迁移的更多信息,请参阅此 https://github.com/trufflesuite/truffle/issues/138

    【讨论】:

    • 感谢您的回答
    • @Crema 感谢您的回答。我也在徘徊如何设置自定义账户来执行交易?例如,在 truffle 控制台中,我有类似 Hello.deployed().then(function(){h = instance}) 的内容,然后默认情况下 h.exetuceTransaction() 将从帐户 [0] 中燃烧气体。如何指定我想从中发送此交易的帐户(例如 accouts[1])?
    • @brankoterzic 我认为您只需在调用executeTransaction({"from" : "0x..." }) 时指定from参数检查The doc
    猜你喜欢
    • 2021-09-11
    • 2021-06-18
    • 2019-09-09
    • 1970-01-01
    • 2018-06-18
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多