How to Start
Last updated
Last updated
To make it easier for developers to start at Orange Protocol, a proxy template is provided, with wrapper data & module interface in Orange system. Thus, every developer can get started quickly as a Proxy Provider.
Proxy wrapper helps provide a unified interface for different providers, hiding API keys, embedding request data signature verification and decryption, response data signing and encryption.
If you want to be an Orange proxy provider, you need to follow these steps:
Register the provider in Orange system.
Fill in the provider information in Orange system.
Note: the "Signing Address" is used to sign the response message and decrypt the response message as a module provider.
The register information will be reviewed by Orange system. If approved, the provider will be activated.
Get Orange proxy wrapper project from Github
Generally, you don't need to modify the code of the proxy wrapper, but you can customize the provider information if you need to connect to the api which requests formats that are not supported by the provider wrapper.
Edit the config.json file
A sample config.json looks like below:
orange_did: the DID of the provider in Orange system, which will be published on Orange website.
keystore: the keystore directory of the provider, which contains the private key of the provider.
wallet_pwd: the password for the wallet stored in the keystore directory.
chain_id: the chain id of orange contract deployed.
chain_rpc: chain rpc.
contract_address: orange contract address. The chain_id,chain_rpc and contract_address
will also be published on Orange website.
api_configs: the api configuration of the provider.
provider_type: "ap" for module provider, "dp" for data provider.
verify_request: whether to verify the request message signature.
server_path: the server path of the wrapper service.
has_api_key: whether the api requires api key.
api_key_location: the location of the api key. The only supported value is "header" for now.
api_key_name: the name of the api key.
api_key: the value of the api key.
api_url: the api url.
api_method: the api method, "GET" or "POST".
param_type: the type of the api parameter, "url" or "body".
failed_keywords: the keywords of the response message which will cause the request to fail.
Create wallet run the following command in your terminal
the standard ethereum wallet file will be generated in the keystore directory with the password you set in config.json.
Register did run the following command in your terminal
NOTE: You need to transfer some gas to the wallet address you just created.
If you want to be a data provider, you just need to :
Get a data source api. For example:
with apikey :x-api-key:test
in request header
add "api_configs" section in config.json:
The proxy wrapper will listen to the GET /balance1 path and forward requests to data source api with api key
Create dataset in Orange
Fill in the dataset information
Choose "GET" and input the wrapper url http://wrapper_address/balance1
Add param "address" with value "User Address"
This will actually create a dataset with url http://sampleDataSourceApi/sampleGetUrlDP?address=$DEFAULT_USER_ADDRESS
if you choose the "POST" method, you need to add the param "body" with the request body with
Currently, Orange supports
User Address: the default address of a logged in user.
Twitter Handle: the Twitter handle of a logged in user.(if bound)
Discord ID: the Discord ID of a logged in user.(if bound)
Customer Value: any customer string value. (for example: "ethereum" or "eth")
Parameter Schema & Output Schema
schema of the input parameter and output data, used for match dataset and module.(module's parameter schema should exactly match the dataset's output schema)
Similar to the dataset.
Get a module api.
Add "api_configs" section in config.json and set provider_type
to "ap".
Fill the module information
Orange will audit your provider, dataset and module information. If approved, your provider will be activated and listed on Orange website.