Commit cab4703d authored by Sharon Urban's avatar Sharon Urban

updated readme

parent b0d697e6
......@@ -21,9 +21,9 @@ msbuild src
The `config.yaml` file contains the following configurable items:
- `nodeApi`: This is the listening address of the Zen Node backing the oracle
- `api`: This is the address which will listen to http requests for verification of inclution of committed data
- `tickers`: This is a list of tickers to fetch from Intrinio and commit in the blockchain
- `nodeApi`: API address of the Zen Node used by the oracle service
- `api`: Incoming HTTP requests endpoint
- `tickers`: A list of tickers to fetch from Intrinio and commit in the blockchain
- `interval`: In hours, the interval between data fetching requests
- `acs`: Active Contract Set settings:
- `activate`: When activating the contract, this is the amount of blocks to have it activated for
......@@ -32,21 +32,25 @@ The `config.yaml` file contains the following configurable items:
- `contract`: Oracle code file name
- `chain`: Specifies the chain (main, test, local)
# Setup (using [oracle](https://github.com/zenprotocol/contracts/blob/master/Oracle.fst) contract)
# Wallet Setup
1. Wallet
Set up a wallet by importing a seed:
```
zen-cli import <ZEN-WALLET-PASSWORD> feel muffin volcano click mercy abuse bachelor ginger limb tomorrow okay input spend athlete boring security document exclude liar dune usage camera ranch thought
zen-cli resync
```
Set up a wallet by importing a seed:
```
zen-cli import <ZEN-WALLET-PASSWORD> feel muffin volcano click mercy abuse bachelor ginger limb tomorrow okay input spend athlete boring security document exclude liar dune usage camera ranch thought
zen-cli resync
```
Lock some funds (Zen) to it. This will be used to activate and extend the oracle contract.
Lock some funds (Zen) to it. This will be used to activate and extend the oracle contract.
# Contract Setup
1. Source
Refer to [examples](https://github.com/zenprotocol/contracts) repository for Oracle contract source code. Make the source file available in the filesystem.
2. Contract Authentication
2. Authentication
As the orcale contract incorporate authenticated execution, a public key needs to be extracted from the node's wallet and embedded into the body (code) of the contract.
Use the following command to extract the public key:
Use the following command to extract a public key:
```
zen-cli publickey "m/44'/258'/0'/3/0" <ZEN-WALLET-PASSWORD>
......@@ -54,7 +58,7 @@ The `config.yaml` file contains the following configurable items:
> The `m/44'/258'/0'/3/0` [path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) is used by the oracle to perform an authenticated contract execution transaction.
Then, in the example oracle contract, in line `let oraclePubKey = ""`, embed the result.
Then, in the source file, in line `let oraclePubKey = ""`, embed the result.
For example:
......@@ -63,8 +67,8 @@ The `config.yaml` file contains the following configurable items:
let oraclePubKey = "02add2eb8158d81b7ea51e35ddde9c8a95e24449bdab8391f40c5517bdb9a3e117"
```
3. Contract Packing
Using [Zebra, Zen SDK tool](https://github.com/zenprotocol/ZFS-SDK), pack the updated contract code:
3. Packing
Using [Zebra, Zen SDK tool](https://github.com/zenprotocol/ZFS-SDK), pack the updated contract:
```
zebra --pack Oracle.fst
......@@ -78,7 +82,7 @@ The `config.yaml` file contains the following configurable items:
# Running
Use systemd to manage the oracle deamon. See `scripts/zen-oracle.service` for environment variable configuration
Use systemd to manage the deamon. See `scripts/zen-oracle.service` for environment variable configuration.
Alternatively, set the needed environment variable and launch `zen-oracle.exe`:
......@@ -93,10 +97,29 @@ export zen_account_password=<ZEN-WALLET-PASSWORD>
Pass the 'wipe' command line switch to wipe all commitment records from the Oracle service's database
# Verifying
# HTTP API
The oracle service responds to HTTP requests to the following routes:
> `<DATE>` format: `yyyy-MM-dd`
- `/proof?date=<DATE>&ticker=<TICKER>`
outputs a YAML represented proof-of-inclusion of oracle data which is used to validate against the data committed to in the blockchain, for example:
```
Hash: bdbac8bf395a74d45e34c04d3661ebd607dcd21a9f0eec52264b4f734ee8e288
Index: 0
AuditPath:
- 6e7ce38340711d436aae480719c7c30b5bc488476bb452591b0c8dedb30149bf
- dacf022e7b964b27eb40b45c3c0c69a6db439a09f7ea8c1f819b65f7ae7d5a7d
- 411784e894b3d6adb3091a71d119d95fcc3c35fcb3c7239ec45e778bc86359b8
- 2ab9b3f0f2014218623f84279fb26027a9d60504e67ffb7ba4b6fe991cf73d45
- 776bcba2254cccaff61bc22f58f8da1a7e015dd07ec8c0d0e577d11cc14a293b
```
- `/data?date=<DATE>&ticker=<TICKER>`: outputs the price of TICKER for DATE
- `/data?date=<DATE>`: lists ticker-price values for DATE in Json format
- `/data?ticker=<TICKER>`: lists date-price values for TICKER in Json format
The oracle service init an HTTP sever which listens to the following routes:
# TODO
- `/list`: list all records
- `/auditpath?date=<DATE>&ticker=<TICKER>`: outputs a list of hashes which comprise a proof-of-inclusion of the merkleized data, the root of which tree is committed in the blockchain
> `<Date>` format: yyyy-MM-dd
\ No newline at end of file
Implement scheduling
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment