The reason why smart contracts can be perfectly applied on Ethereum is that Ethereum provides a nearly Turing complete computing environment on its blockchain.As long as the programming language can realize the calculation,it can support it,which also lays a solid foundation for the application of smart contracts in a broader environment.
一、什么是forsage(佛萨奇)?
forsage(佛萨奇),是基于全球第二的加密货币以太坊的公链开发的一个智能合约,系统开发:I8O佛萨奇2857软件8624、百分百开源,百分百去中心化,一旦运行,不可篡改。
接下来几个基础步骤,使用以下代码段更新您的pallet代码(如果您不想使用模板代码,请跳过此步骤):
Log("输出参数",arrParams,"#FF0000")
while True:
nowTime=time.localtime(time.time())
nowHour=nowTime.tm_hour
nowMin=nowTime.tm_min
nowSec=nowTime.tm_sec
tbl={
"type":"table",
"title":"msg",
"cols":["id","begin","end","今天是否执行过启动","今天是否执行过停止"],
"rows":[]
}
for i in range(len(arrParams)):
tbl["rows"].append([arrParams<i>["id"],json.dumps(arrParams<i>["begin"]),json.dumps(arrParams<i>["end"]),arrParams<i>["isProcessOpenThisDay"],arrParams<i>["isProcessCloseThisDay"]])
if nowDay!=nowTime.tm_mday:
arrParams<i>["isProcessOpenThisDay"]=False
arrParams<i>["isProcessCloseThisDay"]=False
if arrParams<i>["isProcessOpenThisDay"]==False:
if nowTime.tm_hour==arrParams<i>["begin"]["hour"]and nowTime.tm_min>=arrParams<i>["begin"]["min"]and nowTime.tm_sec>=arrParams<i>["begin"]["sec"]:
ret=api('RestartRobot',int(arrParams<i>["id"]))
arrParams<i>["isProcessOpenThisDay"]=True
Log("机器人ID:",arrParams<i>["id"],"执行启动,请登录平台检查是否启动成功","扩展API返回值:",ret,strPush)
if arrParams<i>["isProcessCloseThisDay"]==False:
if nowTime.tm_hour==arrParams<i>["end"]["hour"]and nowTime.tm_min>=arrParams<i>["end"]["min"]and nowTime.tm_sec>=arrParams<i>["end"]["sec"]:
ret=api('StopRobot',int(arrParams<i>["id"]))
arrParams<i>["isProcessCloseThisDay"]=True
Log("机器人ID:",arrParams<i>["id"],"执行停止,请登录平台检查是否停止成功","扩展API返回值:",ret,strPush)
if nowDay!=nowTime.tm_mday:
nowDay=nowTime.tm_mday
LogStatus(_D(),nowTime,"n`"+json.dumps(tbl)+"`")
Sleep(500)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70016646/viewspace-2936734/ ,如需转载,请注明出处,否则将追究法律责任。