Difference between revisions of "Oracle"

From Obyte Wiki
m (upright x2)
(Precious metals exchange rates: added note re moving averages addition)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
An ORACLE is a trusted third party that monitors specific external events and imports them into the Byteball database as a data feed. An example is a list of cryptocurrency exchange rates updated every ten minutes.
+
An ORACLE is a trusted third party that monitors specific external events and imports them into the Obyte database as a data feed. An example is a list of cryptocurrency exchange rates updated every ten minutes.
  
 
==Known oracles==
 
==Known oracles==
Line 13: Line 13:
  
 
'''Timestamp in Unix Epoch Time'''<ref>[[Timestamp]]</ref> | I2ADHGP4HL6J37NQAD73J7E5SKFIXJOT  
 
'''Timestamp in Unix Epoch Time'''<ref>[[Timestamp]]</ref> | I2ADHGP4HL6J37NQAD73J7E5SKFIXJOT  
 +
 +
'''Precious metals exchange rates oracle''' | DXYWHSZ72ZDNDZ7WYZXKWBBH425C6WZN
  
 
==Contract times==
 
==Contract times==
Line 24: Line 26:
  
 
==Personal oracles==
 
==Personal oracles==
{{#ev:vimeo|https://vimeo.com/254485316|thumb|right|'''Personal oracles'''}} Here is an example. A father, away from home, gives his child money conditional on doing some chores. When the mother signals online they are done, the money automatically becomes spendable.
+
{{#ev:vimeo|https://vimeo.com/254485316|thumb|right|'''Personal oracles'''}}Use a single-address wallet. Use the <code>Data into datafeed</code> option in your [[Send]] menu.
 +
 
 +
Here is an example. A father, away from home, gives his child money conditional on doing some chores. When the mother signals online they are done, the money automatically becomes spendable.
  
 
This sort of thing could be used as part of a [[family tokens]] set-up in a household.
 
This sort of thing could be used as part of a [[family tokens]] set-up in a household.
Line 35: Line 39:
 
{{clear}}
 
{{clear}}
  
From the Slack Byteball #prediction_markets forum, tonych:
+
From the Slack Obyte #prediction_markets forum, tonych:
  
 
<blockquote>This is a trading floor, shout out your offers like in the old times. For example: 
 
<blockquote>This is a trading floor, shout out your offers like in the old times. For example: 
Line 44: Line 48:
 
<div style="clear: both;"></div>
 
<div style="clear: both;"></div>
 
==Using the crypto-exchange-rates oracle in a smart contract==
 
==Using the crypto-exchange-rates oracle in a smart contract==
 +
{{#ev:youtube|https://www.youtube.com/watch?v=tjWHxlHBGAg|200|right}}
 +
 
# Practise thoroughly with small amounts of money first. The finished contract is human-readable but it is not obvious to a novice who gets to pay what under what conditions.
 
# Practise thoroughly with small amounts of money first. The finished contract is human-readable but it is not obvious to a novice who gets to pay what under what conditions.
 
# Pair up with a peer in wallet chat. Agree on the terms for the contract with your peer as needed throughout. After you have started writing the contract you will not be able to use the wallet chat until you finish (or abort) it. So either carefully agree all the details first, or have a separate chat channel open.
 
# Pair up with a peer in wallet chat. Agree on the terms for the contract with your peer as needed throughout. After you have started writing the contract you will not be able to use the wallet chat until you finish (or abort) it. So either carefully agree all the details first, or have a separate chat channel open.
Line 52: Line 58:
 
# '''Caution: The peer should read the contract VERY carefully. Maybe neither party knows the other, and a costly mistake could have been made in the details, like a "<" (less than) sign instead of a ">" (greater than) sign. Or an incorrect currency pair. Also check that the payment request is for the correct amount, both the figures and the units (GB/MB).'''
 
# '''Caution: The peer should read the contract VERY carefully. Maybe neither party knows the other, and a costly mistake could have been made in the details, like a "<" (less than) sign instead of a ">" (greater than) sign. Or an incorrect currency pair. Also check that the payment request is for the correct amount, both the figures and the units (GB/MB).'''
 
# Your peer clicks Send on the payment request. The new contract will be visible as a smart wallet.
 
# Your peer clicks Send on the payment request. The new contract will be visible as a smart wallet.
# Now you both wait. You can view an up-to-date feed from that oracle by entering its full JPQ… address in the [byteball explorer search box](http://explorer.byteball.org). As soon as one party fulfills the terms of the contract its funds can be spent.
+
# Now you both wait. You can view an up-to-date feed from that oracle by entering its full JPQ… address in the [Obyte explorer search box](http://explorer.obyte.org). As soon as one party fulfills the terms of the contract its funds can be spent.
 +
{{clear}}
  
 
==Random numbers==
 
==Random numbers==
Line 83: Line 90:
  
 
<div style="clear: both;"></div>
 
<div style="clear: both;"></div>
 +
 +
== Precious metals exchange rates ==
 +
This oracle [https://obyte.io/@DXYWHSZ72ZDNDZ7WYZXKWBBH425C6WZN posts units] every 10 minutes. The data feed shows 20 pairs, such as XAG_BTC, XAG_EUR, XAU_USD, XAG_GBYTE and XAU_GBLACKBYTE, sourced from https://1forge.com/forex-data-api/currency-pair-list. Global precious metals markets are closed over the weekend, Friday 21:00 - Sunday 21:00 UTC, so the oracle will not post during these times.
 +
 +
This oracle can be used in the same way as the crypto exchange rates oracle, the only difference being the oracle address and ticker of the pair. Each oracle also shows moving averages over the previous ten units, GBYTE_USD_MA and GBYTE_BTC_MA for the exchange rates and GBYTE_XAU_MA and GBYTE_XAG_MA for the precious metals.
  
 
==External links==
 
==External links==

Latest revision as of 12:18, 8 March 2020

An ORACLE is a trusted third party that monitors specific external events and imports them into the Obyte database as a data feed. An example is a list of cryptocurrency exchange rates updated every ten minutes.

Known oracles

P2P exchange of Bytes vs. Bitcoin[1] | FOPUBEUPBC6YLIQDLKL6EW775BMV7YOH

P2P random numbers gambling | FOPUBEUPBC6YLIQDLKL6EW775BMV7YOH (same oracle as above) 

Crypto exchange rates[2] | JPQKPRI5FMTQRJF4ZZMYZYDQVRD55OTC

Flight delay tracker for flight delays insurance[3] | GFK3RDAPQLLNCMQEVGGD2KCPZTLSG3HN   

Sports betting on soccer match results[4] | TKT4UESIKTTRALRRLWS4SENSTJX6ODCW  

Timestamp in Unix Epoch Time[5] | I2ADHGP4HL6J37NQAD73J7E5SKFIXJOT  

Precious metals exchange rates oracle | DXYWHSZ72ZDNDZ7WYZXKWBBH425C6WZN

Contract times

There are two times in a non-timestamp smart contract which are set by the contract writer. The default time for peer non-payment is not as important as the contract expiry time, which may or may not play an important role in the bet.

Peer non-payment

This is the minimum time period after which the contract-writer can recover his stake if the peer doesn't pay his stake. The default is set to 4 hours, but it can be set as low as .1 hours (6 minutes).

Contract expiry

This is the time period after which the contract does not operate. The default setting is 7 days, but it can be set as low as .01 days (14 1/2 minutes). If you are betting on a discrete event, like a particular sporting event or single flight arrival it doesn't matter. But if you are betting on a system in continual flux like whether the price of a particular cryptocurrency pair will exceed a certain amount, it makes a big difference. In such a case this time must be discussed as one of the terms of the bet.

Personal oracles

Personal oracles

Use a single-address wallet. Use the Data into datafeed option in your Send menu.

Here is an example. A father, away from home, gives his child money conditional on doing some chores. When the mother signals online they are done, the money automatically becomes spendable.

This sort of thing could be used as part of a family tokens set-up in a household.

Example of trading using an oracle

Oracle-1.png
Oracle-2.png

From the Slack Obyte #prediction_markets forum, tonych:

This is a trading floor, shout out your offers like in the old times. For example:  "I bet on BTC going below 1150 within 1 day, I pay 0.3GB out of 1GB"

Use the crypto exchange rates oracle for this.

Using the crypto-exchange-rates oracle in a smart contract

  1. Practise thoroughly with small amounts of money first. The finished contract is human-readable but it is not obvious to a novice who gets to pay what under what conditions.
  2. Pair up with a peer in wallet chat. Agree on the terms for the contract with your peer as needed throughout. After you have started writing the contract you will not be able to use the wallet chat until you finish (or abort) it. So either carefully agree all the details first, or have a separate chat channel open.
  3. Peer sends you a receive address. Left-click the address. Click “offer a contract.” Go down filling in the easy bits, with the details as agreed on.
  4. When you get to ORACLE ADDRESS, copy/paste in the crypto exchange rates one: JPQKPRI5FMTQRJF4ZZMYZYDQVRD55OTC
  5. See an example of the feed from this oracle, and pick a currency pair, maybe BTC_USD. Then under DATA FEED NAME paste: BTC_USD
  6. Fill in the remaining easy bits with the agreed details, then click/press PAY AND OFFER. This will send your stake to the smart contract, and send a payment request to your peer for their stake.
  7. Caution: The peer should read the contract VERY carefully. Maybe neither party knows the other, and a costly mistake could have been made in the details, like a "<" (less than) sign instead of a ">" (greater than) sign. Or an incorrect currency pair. Also check that the payment request is for the correct amount, both the figures and the units (GB/MB).
  8. Your peer clicks Send on the payment request. The new contract will be visible as a smart wallet.
  9. Now you both wait. You can view an up-to-date feed from that oracle by entering its full JPQ… address in the [Obyte explorer search box](http://explorer.obyte.org). As soon as one party fulfills the terms of the contract its funds can be spent.

Random numbers

Betting on Random Numbers

Video in Hi-Def and with English subtitles.

  1. Practise thoroughly with small amounts of money first. The finished contract is human-readable but it is not obvious to a novice who gets to pay what under what conditions.
  2. Pair up with a peer in wallet chat. Agree on the terms for the contract with your peer as needed throughout. After you have started writing the contract you will not be able to use the wallet chat until you finish (or abort) it. So either carefully agree all the details first, or have a separate chat channel open.
  3. Peer sends you a receive address. Left-click the address. Click “offer a contract.” Go down filling in the easy bits, with the details as agreed on.
  4. When you get to ORACLE ADDRESS, copy/paste in the random-numbers-gambling one: FOPUBEUPBC6YLIQDLKL6EW775BMV7YOH
  5. Here is an example of the data feed from this oracle:[6] You will need to know the current bitcoin height, and pick a future one to bet on. Blockchain.info is an easy source for current block height. Let's say you're doing this before the one above. So under DATA FEED NAME paste: random460852
  6. Fill in the remaining easy bits with the agreed details. Let's say you're doing an evens bet, above or below 50,000, then put "50000" in the POSTED VALUE box. Then click/press PAY AND OFFER. This will send your stake to the smart contract, and send a payment request to your peer for their stake.
  7. Caution: The peer should read the contract VERY carefully. Maybe neither party knows the other, and a costly mistake could have been made in the details, like a "<" (less than) sign instead of a ">" (greater than) sign. Or an incorrect bitcoin height. Also check that the payment request is for the correct amount, both the figures and the units (GB/MB).
  8. Your peer clicks Send on the payment request. The new contract will be visible as a smart wallet.
  9. Now you both wait. You can view an up-to-date feed from that oracle by entering its full FOP… address in the Byteball Explorer search box. Find the right one by the timing, compared to when "your" block was mined. As soon as one party fulfills the terms of the contract its funds can be spent.

Flight delays tracker

Betting on Flight Delays

Video in Hi-Def and with English subtitles.

Better to use Flight Delay Insurance chatbot in the wallet bot store. You can get flight numbers and schedules from flightstats.com. You can choose any flight 1 day to 3 months in advance, with maximum compensation 1 GB. Example premiums for 1 GB compensation are:  

  • 30 minutes delay: 0.082258065 GB  
  • 1 hour delay: 0.079996985 GB  
  • 2 hour delay: 0.070952668 GB  
  • 4 hour delay: 0.066129032 GB

Precious metals exchange rates

This oracle posts units every 10 minutes. The data feed shows 20 pairs, such as XAG_BTC, XAG_EUR, XAU_USD, XAG_GBYTE and XAU_GBLACKBYTE, sourced from https://1forge.com/forex-data-api/currency-pair-list. Global precious metals markets are closed over the weekend, Friday 21:00 - Sunday 21:00 UTC, so the oracle will not post during these times.

This oracle can be used in the same way as the crypto exchange rates oracle, the only difference being the oracle address and ticker of the pair. Each oracle also shows moving averages over the previous ten units, GBYTE_USD_MA and GBYTE_BTC_MA for the exchange rates and GBYTE_XAU_MA and GBYTE_XAG_MA for the precious metals.

External links

References