甲骨文与智能合约之间的定期,重复,交互 [英] Regular, repeating, interaction between an oracle and a smart contract

查看:106
本文介绍了甲骨文与智能合约之间的定期,重复,交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这只是一个例子.我正在构建此dapp,其中有一个开始日期和一个结束日期,而且每天我都想从一个oracle中获取一个随机数.如果在某个时候我每天得到的数字总和超过阈值,那么一条OK消息会返回到我的后端.假设我们的范围是7天.

This is just an example. I'm building this dapp where I have a start date and an end date and every day I want to get a random number from an oracle. If at some point the sum of the numbers I get every day exceeds a threshold then an OK message returns to my backend. Let's assume we have a range of 7 days.

第1天:

  • 我的后端向智能合约编号"发送请求,并调用requestOk()方法.
  • 智能合约编号调用oracle智能合约的gethNumber()方法,并向其传递返回响应的回调.
  • Oracle智能合约发出一个updateN()事件
  • oracle服务通过调用UpdateNumber()方法检索数据并将其返回给oracle智能合约
  • oracle智能合约使用回调并将数据返回到智能合约编号
  • 智能合约编号检查当天收到的编号是否大于阈值.如果更大,则返回一条ok消息,否则,将对第2天执行相同的过程,然后将新的数字添加到第1天的数字中.最后,我将总和(第1天+第几天)进行比较2)带有阈值,依此类推.

现在我的问题是:我必须在第二天再次执行的操作会自动从智能合约编号开始吗?我的意思是,是否有可能创建一种机制来允许智能合约编号在一周中的每一天每天向oracle请求随机数?还是是我的后端要求在第二天和一周的每一天进行相同的操作?

Now my question is: can the operations I have to perform again for day 2 automatically start from the smart contract Number? I mean, is it possible to create a mechanism allows the smart contract Number to ask the oracle for a random number every day for a week? Or must it be my backend asking to do the same operations for day 2 and every day of the week?

推荐答案

还是我的后端要求在第二天和一周中的每一天进行相同的操作?

Or must it be my backend asking to do the same operations for day 2 and every day of the week?

是的

这篇关于甲骨文与智能合约之间的定期,重复,交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆