cita与eth的兼容性
程序员文章站
2022-07-13 10:11:21
...
eth与cita时间戳精度不一样,有个配置项可以选择eth_compatibility
: 是否与以太坊兼容的开关(CITA默认与以太坊在块的时间戳精度上不兼容,CITA为毫秒,以太坊为秒)。
pragma solidity 0.4.26;
contract Nervosbj {
uint public h = 1 hours;
uint public min = 1 minutes;
uint public s = 1 seconds;
function timeNow ()
public
view
returns (uint)
{
return block.timestamp;
}
function happyTime()
public
view
returns (uint, uint, uint)
{
uint now = block.timestamp;
return (now+s, now+min, now+h);
}
}
参考:
https://docs.citahub.com/zh-CN/cita/configuration/service-config
转载于:https://www.jianshu.com/p/2c314a27f5a6
推荐阅读