Quick start

A quick way to start interacting with the protocol is to deploy it locally. This requires several actions:

  1. Having a development blockchain running.

  2. Having an IPFS node running.

  3. Having a development External Adapter running.

  4. Deploy the contracts to the local blockchain.

  5. Having, at least, 1 Chainlink Node running.

  6. Configure the Chainlink Node with the proper jobs and bridges, depending on the contracts deployed.

All this can be achieved easily in a few simple steps:

Prerequisites

Please ensure you have the following installed in order to successfully deploy and start using the Developer Toolkit (DTK)

circle-info

Do you feel like life is too short to read documentations?

TLDR; copy the code pieces and execute them in the order they appear in this section, and voila! DSLA deployed in your computer.

Install Hardhat shorthand

Refer to this section to install hh shorthand to run all the developer toolkit available tasks, or simply run this command:

Install the DTK packages

Navigate into the cloned repo folder /stacktical-dsla-developer-toolkit/ and install NPM packages:

Create the .env file

Copy the env-min file and paste it in a .env file, or execute the next:

Set the environment values that are suitable for you in the .env file.

Deploy 'develop' services

The services folder contains docker-compose files for multiple services, including:

  • Local Blockchain: Ganache, pre-configured. It will be replaced once hardhat node is compatible with Chainlink.

  • IPFS node.

To run these services, make sure Docker is running then use the following Hardhat task:

Deploy 'develop' external adapter

The services folder contains an external-adapter subfolder with the code for a simple Express.js app. It can be modified to implement the logic of an indexer for a new use case.

In a new console tab, navigate to the DTK repository folder and run the following command:

This will run the services/external-adapter/index.ts using pm2arrow-up-right so it has hot reload, and any change to the external adapter files will restart the service.

circle-info

There are other external adapters used in the protocol:

Staking Efficiency: https://github.com/Stacktical/stacktical-dsla-oracle-searrow-up-right

Leave this service running and switch back to your other console tab.

Enable the networks you need

While using the DTK, you can update as many networks as needed at once, by editing the networks/index.ts file.

But we highly recommend focusing on one network at a time. Make sure you update the networks/index.ts file accordingly:

This will ensure that only the develop network is active for the next steps.

Once the necessary services are running we can deploy the contracts along with the Chainlink nodes by executing:

This will clean the previous develop deployment, and will run the Chainlink nodes locally, setting them up automatically.

You may run into a permissions error on the /services/chainlink-nodes/ folder or the /services/graph-protocol/postgres/ folder if you run the hh deploy --network develop --reset command more than once.

If so, use chown to ensure proper permissions on these folders. Execute the following commands substituting in your username and the proper path to your local DTK repo:

Once the previous process is finished, we have to bootstrap the protocol:

At this point, if you want to run the local subgraph deploy it with the following command:

After this, the protocol is ready to use! Execute the following script to deploy a pre configured SLA:

This will deploy the SLA defined in the scripts.config.tsarrow-up-right. You can expect an output like this:

Depending on networks/develop.config.ts configuration, the first period of the SLA contract is going to be "expired", so we can proceed to verify the SLA contract by executing:

Previous task will take the last deployed SLA to verify it.

Expect an output like this:

This means that our request traveled back and forth from the SLA contract to the external adapter. You can check this by reading the external adapter log:

Comparing the result, in both cases is 28221.

Please note that we are checking if they are equal, since you can get a different number because the development external adapter returns a random number.

That's it! A full DSLA protocol deployment.

You can check the Chainlink node by browsing to http://localhost:6688arrow-up-right using [email protected] and password=PaSSword123456 as credentials, or you might want to check your IPFS node UI by visiting http://localhost:5001/webuiarrow-up-right.

You can access the Subgraph, if you deployed it earlier, at http://127.0.0.1:8000/subgraphs/name/dsla-protocol/core/graphqlarrow-up-right

Last updated

Was this helpful?