【问题标题】:How can I see the value assigned to a variable in Ethereum solidity language?如何查看分配给以太坊 Solidity 语言中变量的值?
【发布时间】:2019-11-19 07:21:45
【问题描述】:

我想知道分配给以太坊 Solidity 语言变量的值。

在JavaScript中,即使我不知道它是什么类型的变量,我也可以使用console.log来输出变量的值。 例如)


    ....
    .........
        var l = Math.ceil(8 * n.length / (Math.log(t.length) / Math.log(2))),
        console.log(I);
            c = Array(l);
        console.log(c); // This can be very useful when I want to know what value is outputting, such as using console.table
    ..........
    ....

您可能知道,在分析和调试代码时,这些方法通常很有用。 我应该如何在“solidity”中实现这种方法,如console.log? 例如)

    ...
    ......
    wonder = uint(keccak256(abi.encodePacked(now, msg.sender, Rnd_entropy_2))) % Ana; 
    // There are three variables in this line: "Ana, Rnd_entropy_2, wonder". I want to know what value assigned to each variable has and what they are output. 
    // In JavaScript, Can easily be found console.log (Ana, Rnd_entropy_2, wonder). What should I do?
    ....
    ........

没有更简单的方法可以到达那里吗?我很高兴听到您对此事的看法。

【问题讨论】:

    标签: javascript ethereum solidity


    【解决方案1】:

    你不能拥有像 console.log() 这样的可靠功能 如果您使用的是 Remix,那么您可以在那里检查变量的值。 在部署和运行事务选项卡中运行事务并检查运行相应函数后的变量值

    【讨论】:

      猜你喜欢
      • 2017-08-01
      • 2017-09-22
      • 2018-10-16
      • 1970-01-01
      • 2019-05-09
      • 2019-06-14
      • 2020-04-23
      • 2016-10-03
      • 2021-11-25
      相关资源
      最近更新 更多