-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from unification-com/readmes
README cleanup
- Loading branch information
Showing
4 changed files
with
205 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Docker Dev Environment | ||
|
||
A full Docker environment for testing the OoO smart contracts and `go-ooo`. | ||
|
||
This is a complete, self-contained `ganache-cli` development environment, which can be used | ||
to test contracts, developing and testing Consumer contracts and testing the `go-ooo` Provider Oracle app. | ||
|
||
## Running | ||
|
||
To run the development environment, from the **repo root directory**, run | ||
|
||
```bash | ||
make dev-env | ||
``` | ||
|
||
This will run a local `ganache-cli` chain, deploy the Router and demo consumer contract, and also initialise | ||
the accounts with some Dev xFUND. The chain's RPC endpoint will be exposed on `http://127.0.0.1:8545`, and can be | ||
accessed via the `truffle-config`'s `develop` network. | ||
|
||
## Interaction | ||
|
||
**Note**: Both this Docker environment and [`go-ooo`](../go-ooo/README.md) must be running (on this `dev` network) in | ||
order to test data requests. | ||
|
||
#### Requesting Data | ||
|
||
The development environment is deployed with a pre-configured and deployed demo Consumer contract, along with a script | ||
for requesting and waiting for data. This script can be called using `docker exec`: | ||
|
||
```bash | ||
docker exec -it ooo_dev_env /root/xfund-router/request.sh <BASE> <TARGET> <TYPE> [SUBTYPE] [SUPP1] [SUPP2] | ||
``` | ||
|
||
For example querying Finchains tracked data: | ||
|
||
```bash | ||
docker exec -it ooo_dev_env /root/xfund-router/request.sh BTC GBP PR AVC 1H | ||
``` | ||
|
||
This will request data using the OoO endpoint `BTC.GBP.PR.AVC.1H`, which is the mean GBP price of Bitcoin for the | ||
past hour, using the Chauvenet Criterion to remove statistical outliers. | ||
|
||
Or and Ad-Hoc request: | ||
|
||
```bash | ||
docker exec -it ooo_dev_env /root/xfund-router/request.sh BONE WETH AD | ||
``` | ||
|
||
See the [OoO API Guide](https://docs.unification.io/ooo/guide/ooo_api.html) for more information on endpoint | ||
construction. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# go-ooo | ||
|
||
The Go implementation of the OoO Provider application, required to be run by providers to serve data | ||
|
||
## Development and Testing | ||
|
||
### Prerequisites | ||
|
||
#### Go | ||
|
||
Go v1.18+ is required to compile the `go-ooo` application. | ||
|
||
## Running | ||
|
||
First, build the Go application: | ||
|
||
```bash | ||
make build | ||
``` | ||
|
||
`go-ooo` will need initialising before it can run: | ||
|
||
```bash | ||
./build/go-ooo init <network> | ||
``` | ||
|
||
Where `<network>` is one of `dev`, `goerli`, `mainnet` or `polygon`. Using `dev` will configure `go-ooo` for the Docker | ||
[development environment](../docker/README.md). | ||
|
||
This will save the default configuration to `$HOME/.go-ooo`, with the initial values for the `dev` network. | ||
This config location can be changed using the `--home` flag to specify a custom location, e.g. | ||
|
||
```bash | ||
./build/go-ooo init dev --home $HOME/.go-ooo_dev | ||
``` | ||
|
||
This initialisation script will ask whether you want to import an exisitng private key, or generate a new one. | ||
You can enter anything for the account name. For the purposes of quick testing, the Docker development environment | ||
initialises by pre-registering account #3 on the `ganache-cli` chain as a Provider Oracle. The private key to import is: | ||
|
||
`0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913` | ||
|
||
Make a note of the generated decryption password - this will be required to run the application (to decrypt the keystore) | ||
and to execute any admin commands. For the sake of simplicity, save it to `$HOME/.go-ooo/pass.txt` | ||
|
||
The application should now have the default configuration saved to `$HOME/.go-ooo/config.toml`. It will use `sqlite` as | ||
the default database, but can easily be configured for PostgreSQL. | ||
|
||
#### Registering a new Oracle Provider | ||
|
||
If `go-ooo` has been initialised for a network other than `dev`, and using a key other than the pre-defined test key, | ||
then registration as an Oracle Provider is required. First, ensure the wallet being used has funds on the target | ||
chain, then run the registration admin command: | ||
|
||
```bash | ||
./build/go-ooo admin register [FEE] --home /path/to/.go-ooo --pass /path/to/pass.txt | ||
``` | ||
|
||
Where `[FEE]` is your fee, for example `1000000` for 0.001 xFUND. | ||
|
||
#### Start the Oracle | ||
|
||
Now, you can start the Provider Oracle: | ||
|
||
```bash | ||
./build/go-ooo start | ||
``` | ||
|
||
This will prompt you for the decryption password, and start the application. If you saved the password, you can pass the | ||
path to the file using the `--pass` flag, e.g. | ||
|
||
```bash | ||
./build/go-ooo start --home $HOME/.go-ooo_dev --pass $HOME/.go-ooo_dev/pass.txt | ||
``` | ||
|
||
## Docker Developer Environment | ||
|
||
If the [Developer Environment](../docker/README.md) is running, these will have been deployed automatically, along with | ||
a number of funded test accounts for both an OoO Provider and end-users. The `dev` network provider above should be | ||
pre-registered in the Router smart contract. |
Oops, something went wrong.