Source code of the BasicAPI feed from Dataverse. For maximum transparency this is deployed to a decentralized compute network. For someone who is running a feed for their own use only you might prefer to deploy on your own server.
-
Put your private key into the env variable in the deploy.yaml file. This is the key that will be used to sign data request responses.
-
If you want to deploy your own docker image, run
docker build . -t username/dv-server-akashand then push it to dockerhub. Replace thepupcakes/dv-server-akash:latestin thedeploy.yamlfile withusername/dv-server-akash:latestOtherwise, skip to step 3 -
Follow this tutorial to deploy your
deploy.yamlto Akash network. You will need a few dollars worth of Akash tokens for this.
function setOracle(bool _isOracle) external {
oracles[msg.sender] = _isOracle;
emit ModifiedOracles(msg.sender, _isOracle);
}
The registry contract needs to be informed of your provider before it can be used. Using the private key from your deploy.yaml file, call setOracle(true) function on the registry contract.
Put your private key in the basicAPINear.js file. DO NOT push to dockerhub and DO NOT deploy to Akash network.
Run locally or on a secure server with command docker build -f Dockerfile.near . -t basic-near-api to build and docker run -d --name basic-api-near --restart always basic-api-near
It's important to include the --restart flag because this will ensure the whole thing is restarted in the case of the websocket connection closing or any errors