English | 中文
The opportunity of becoming an Oracle service vendor is open for any intrested party. Oracles can provide services to fetch public data, or can be limited to a certain Specialized domain that one has understanding of. A fixed amount of processing fee can be charged for each request to the Oracle. Details regarding becoming an Oracle service vendor have been provided below.
The first step ivolved in the process of becoming an Oracle service provider is deploying a custom Oracle contract. Please refer to this link for more information on the Oracle protocol.
A sample Oracle contract is available for reference, and can be found by following this link.
The following Git command can be used to directly clone Ontology's Oracle repository:
$ git clone https://github.com/ontio/ontology-oracle.git
The Oracle repository contains services that by default can fetch public data, and the data can be obtained without any extra permissions. The specialized data services from random.org can be fetched after applying for the key. The sample provided in the repository uses the Basic API version to fetch the development API key.
The data service provider can choose to add any kind of specialized data for the clients to access, or stick with the public data services, as shown in the sample.
The relevant data service files that can be found under the runners folder are as follows:
- The
runner.go
file defines therunner
API and other runner routes. - The
http.go
file provides some basic data retrieval services. The data is fetched using theHTTP
methods. - The
json_parse.go
file provides data analysis service. - The
random_org.go
file provides specialized data retrieval services to fetch random numbers, including both ordinary random numbers and random numbers used for signature.
Data service vendors can refer to random_org.go
to get an understanding of how to implement specialized data services.
go build main.go
The contents of the configuration file config.json
are as follows:
{
"WalletFile": "./wallet.dat",
"LogLevel": 0,
"ONTRPCAddress": "http://127.0.0.1:20336",
"ScannerInterval": 10,
"GasPrice": 0,
"GasLimit": 20000,
"ContractAddress": "b869eed573863f8efdb3ae39d4963a781e81d4b3",
"RandomOrgKey": "c7511065-c88d-4f28-af4f-293c91ad20d9"
}
Field | Description |
---|---|
WalletFile | Wallet path, this wallet is used to pay the gas fees for data upload requests |
LogLevel | The selected log level |
ONTRPCAddress | The RPC address and port of the Ontology nodem, the transaction result of data upload request is transmitted to this node |
ScannerInterval | Time interval for scanning, the Oracle client scans request data from the Oracle contract in fixed time intervals |
ContractAddress | Contract address hash of the Oracle contract |
RandomOrgKey | The Basic API verion key fetched from random.org, permissions for fetching other specialized data can also be added |
The different log levels supported are:
const (
DebugLog = iota
InfoLog
WarnLog
ErrorLog
FatalLog
MaxLevelLog
)
The command used to start the Oracle client node is:
./main node
Please enter the password when prompted by the shell to start the node.
After deploying the Oracle contract and starting the Oracle client, the data service vendor can publicly share the Oracle contract address and fee structure along with the content being provided and the request format.