Oracle

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.

## Known oracles

**P2P exchange of Bytes vs. Bitcoin** | FOPUBEUPBC6YLIQDLKL6EW775BMV7YOH

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

**Crypto exchange rates** | JPQKPRI5FMTQRJF4ZZMYZYDQVRD55OTC

**Flight delay tracker for flight delays insurance** | GFK3RDAPQLLNCMQEVGGD2KCPZTLSG3HN

**Sports betting on soccer match results** | TKT4UESIKTTRALRRLWS4SENSTJX6ODCW

**Timestamp in Unix Epoch Time** | I2ADHGP4HL6J37NQAD73J7E5SKFIXJOT

## 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

   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

From the Slack Byteball #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 [byteball explorer search box](http://explorer.byteball.org). As soon as one party fulfills the terms of the contract its funds can be spent.

## Random numbers

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: 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

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

## References

<references>

1. ↑ https://medium.com/byteball/making-p2p-great-again-episode-ii-bitcoin-exchange-d98adfbde2a5
2. ↑ Gambling
3. ↑ https://medium.com/byteball/making-p2p-great-again-episode-iii-prediction-markets-f40d49c0abab
4. ↑ https://medium.com/byteball/making-p2p-great-again-episode-iv-p2p-insurance-cbbd1e59d527
5. ↑ Sports betting
6. ↑ Timestamp
https://explorer.byteball.org/#Ns//o52EKR32ykuHfUfcm3ailHtta6TvM5kB07vbpVA=
bitcoin\_hash: 0000000000000000019dd457cf8e233701dab44ac855492d575a4366556213e0
bitcoin\_height: 460852
bitcoin\_merkle: GW9cQW5m0KLIi2suUlkzRP2yurg8jLEax3uHiun7kik=
random460852: