> For the complete documentation index, see [llms.txt](https://docs.plugin.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plugin.global/whitepaper-2.1/whitepaper-2.1-english.md).

# Whitepaper 2.1 English

## Plugin 2.1 - Decentralized Oracle Network with Enhanced Performance & Security

Built on XinFin (XDC) Blockchain Network as an open source initiative

## Plugin 2.1: Whitepaper

### Disclaimer

The purpose of this document is to present information about the Plugin Decentralized Oracle Network Powered by XinFin Blockchain Network. The information set forth above may not be exhaustive and does not imply any elements of a contractual relationship. Its sole purpose is to provide relevant and reasonable information on whether to undertake a thorough analysis of the project to be used for various smart contracts.

Whilst every effort is made to ensure that statements of facts made in this document are accurate, all estimates, projections, forecasts, prospects, expressions of opinion, and other subjective judgments contained in this paper are based on assumptions considered to be reasonable as of the date of the document in which they are contained and must not be construed as a representation that the matters referred to therein will occur. Any plans, projections, or forecasts mentioned in this paper may not be achieved due to multiple risk factors. No information in this whitepaper should be considered to be business, legal, financial, or tax advice. We suggest that you do your own research and consult your own legal, financial, tax, or other professional advisers about Decentralized Oracle Network respective businesses and operations.

This whitepaper does not constitute a prospectus or offer document of any sort and is not intended to constitute an offer of securities or a solicitation for investment in securities in any jurisdiction. No person is bound to enter into any contract or make a binding legal commitment.

No regulatory authority has examined or approved any of the information set out in this whitepaper. No such action has been or will be taken under the laws, regulatory requirements, or rules of any jurisdiction. The publication, distribution, or dissemination of this whitepaper does not imply that the applicable laws, regulatory requirements, or rules have been complied with.

This whitepaper is subject to change as the product progression and development advances. Changes will be reflected in future updated/revised whitepaper versions.

### Abbreviations

| **Abbreviation** | **Definition**                                                   |
| ---------------- | ---------------------------------------------------------------- |
| API              | Application Programming Interface                                |
| AWS              | Amazon Web Services                                              |
| CRT              | Carbon Reduction Token                                           |
| DApp             | Decentralized Application                                        |
| DeFi             | Decentralized Finance                                            |
| DFP              | Data Feed Providers                                              |
| DLT              | Distributed Ledger Technology                                    |
| DON              | Decentralized Oracle Network                                     |
| EA               | External Adaptor                                                 |
| EI               | External Initiator                                               |
| EOI              | Expression of Interest                                           |
| ETH              | Ether                                                            |
| GHG              | GreenHouse Gas                                                   |
| IP               | Internet Protocol                                                |
| IT               | Information Technology                                           |
| KYO              | Know Your Operator                                               |
| KYP              | Know Your Provider                                               |
| NPM              | Node Package Manager                                             |
| OBD              | On-Board Diagnostic                                              |
| OS               | Operating System                                                 |
| PLI              | Plugin Utility token                                             |
| PLIP             | Plugin Improvement Protocol                                      |
| pm2              | Process Manager 2                                                |
| RAM              | Random Access Memory                                             |
| RPC              | Remote Procedure Call                                            |
| SEaaS            | Sensing-as-a-Service                                             |
| SLA              | Service Level Agreement                                          |
| VRF              | Verifiable Random Function                                       |
| WFN              | Weather Forecast Node                                            |
| XDC              | XinFin Digital Contract                                          |
| XRC20            | XinFin Request for Comment, 20 is the proposal identifier number |

## 1. Introduction

Blockchain technology continues to grow and touch many parts of our lives and it is important to support the expansion by connecting blockchain’s Distributed Ledger Technology(DLT) to the existing legacy systems and applications built on a different technology. Oracles provides a secure form of communication between blockchain and the external world by providing off-chain data from the external world to the blockchain network’s on-chain environment. While the oracle network allows external connectivity to blockchain, centralized oracle network still poses the problem of over-reliance on third parties which blockchain addresses primarily, termed as Oracle problem.

Decentralized Oracle Network(DON) overcomes the ‘Oracle Problem’ by distributing trust among multiple parties, similar to how blockchain works. Hybrid smart contracts of Decentralized Oracle Network provides interoperability, enhanced performance, multi-party trust model and transparency in the bidirectional communication of blockchain and off-chain data.

In this whitepaper, we cover the success stories of Plugin since its inception and the launch of Plugin 2.1, an enhanced version of Plugin’s decentralized oracle network built on XDC blockchain network. While Plugin continues to provide secure, scalable and decentralized oracle, Plugin 2.0’s architecture is aimed to provide better performance of oracle, utilization of resources and to help users to participate in our network with minimum infrastructure.

## 2. PLUGIN - Decentralized Oracle Network(DON)

Decentralized Finance (DeFi) applications need reliable price feeds, and other smart contracts and decentralized applications (DApps) built on blockchain require a variety of real-world data inputs ranging from current events and sports, to weather, or even random numbers. A DON aims to offer these with strong confidentiality, integrity, and availability properties, as well as accountability. Decentralized oracles achieve trustlessness and deterministic results by distributing trust among many network participants.

### 2.1 Plugin’s Decentralized Oracle Network Overview

Plugin’s DON serves as a powerful and flexible tool for developers to create off-chain support for their smart contracts on the XDC network.

Plugin Decentralized Oracle Network comes with:

* Highest Level of Security
* Decentralized Architecture to prevent single point failure
* Censorship resistance
* Developer friendly interface for ease of deployment & operation

*VN: Validator Node, PP Node: Preprocessor Node, DS: Data set, VRF: Verifiable Random Function*

*Conceptual representation of Plugin’s Decentralized Oracle Network*

**Nodes**: Nodes are the place wherein programs that run continuously and in a decentralized manner on the DON. They provide high performance and confidential computation but they do not directly store main-chain assets. Executables run autonomously on a DON and perform deterministic operations. They work in hand with adapters that link the DON to external resources.

**Web APIs**: Web APIs in Plugin oracles are responsible for fetching data from external sources. The oracle nodes aggregate and validate this data to ensure its accuracy and reliability before providing it to smart contracts. This is crucial for maintaining the integrity of data used within blockchain applications.

**Storage**: Local storage for the executable to additionally read and write to local DON storage to keep state and/or communicate with other executables. While critical data is stored in Blockchain, this storage is used to store the event logs which get archived periodically from the respective nodes.

### 2.2 PLUGIN Interfaces

Plugin’s DON has powerful interfaces that enable many use cases using the XDC blockchain network.

#### 2.2.1 Networking

Plugin nodes communicate with each other and external systems to securely and reliably deliver data to smart contracts on Blockchain platforms. Below mentioned are the key elements of Plugin networking:

* **Peer-Peer Networking**: Plugin operates as a decentralized oracle network(DON) where nodes communicate with each other in peer-to-peer fashion, This means that individual nodes connect with other nodes within the network, forming a distributed and resilient architecture.
* **Plugin Nodes**: Plugin nodes are the participants in the decentralized oracle network. Each node is responsible for retrieving, validating, and delivering data to smart contracts. Nodes can be operated by different entities, creating a decentralized and trust-minimized infrastructure.
* **Node Registration**: Nodes must register to participate in the Plugin network. During registration, nodes specify the external APIs they support.

#### 2.2.2 Computation

Nodes are the prime unit of computation for DON. Plugin initiators initiate the execution processing depending on some external condition. Once the job is initiated by the initiators, nodes have a deterministic logic to complete the assigned job.

#### 2.2.3 Storage

DONs can store data locally or externally in storage such as File server or Cloud servers for use in their specifically supported services. Through web APIs nodes access the data stored off-chain and Plugin’s DON can make use of such data in a confidential way, computing on data that is a trusted execution environment.

### 2.3 PLUGIN Community

Plugin’s DON has a strong community support to provide seamless data transfer between blockchain network and web server systems.

**Oracle Node Operators**: Oracle nodes are the backbone of Plugin Network. Plugin has node operators spread across the globe with nodes providing consistent data to blockchain. Plugin encourages and assists node operators to set up their node with cloud service providers offering 99.9% availability. Plugin has a capped limit to onboard up to 2000 node operators and all the requests are approved after the review and approval of the Plugin Governance committee.

**Data Feed Providers:** DFPs offer a seamless way of integrating the data with decentralized applications by providing APIs to smart contracts. After review and approval of the data feed API by Plugin’s governance committee they can start providing data to the blockchain DApps and monetize the same.

### 2.4 Plugin 2.1 Features

**Reputation Algorithm:** Plugin 2.1 will have a strong reputation logic to assess and evaluate the trustworthiness and reliability of individual oracle nodes within the network. Reputation logic incentivizes oracle nodes to act honestly and perform their tasks diligently.

**Multichain compatibility:** Plugin 2.1 oracle network now supports multiple EVM chains, currently we are supporting XDC and Polygon network. We will be extending our oracle support to other EVM chains in upcoming releases.

#### Security Updates

* **Automatic connectivity detection:** Introduction of new error indication parameter called "Critical" will prevent the errored events from running and consuming the gas and let the user fix the connectivity issues before job processing.
* **Secured node boot:** In Plugin 2.1 version, node will boot up only if the postgres database password is secured and correctly entered.
* **Node EthSubscription:** Plugin 2.1 will only allow successful Ethsubscription nodes to proceed with the next steps. This will prevent unsuccessful subscription nodes from acquiring and holding locks in the resources.

#### Performance enhancements

* New config option, that caps the total number of completed runs per job.
* Optimizing the job table by archiving the completed old and errored runs and giving priority to the current jobs improving the overall performance of the oracle network.

**New NodePool.SelectionMode:** Upgrading the node selection algorithm to pick the best node that can handle the job based on the capability of the node and its recent activities in completing the tasks. This will create a competitive environment between the nodes since the most active nodes get job allocation.

**Automatic connectivity detection:** Introduction of new error indication parameter called "Critical" which will prevent the errored events from running and consuming the gas and let the user fix the connectivity issues before job processing.

**Reduced Gas Cost:** EIP-1559 is now enabled by default. Enabling EIP-1559 mode can help reduce gas costs on chains that support it.

**EVM.NodePool.SyncThreshold:** Plugin 2.1 will have a new parameter to ensure that live nodes do not lag too far behind. Sync Threshold controls how far a node may lag the best node before being marked out-of-sync.

### 2.5 Plugin partnerships

#### 2.5.1 Certik

Certik, the foremost smart contract auditor in the Web3 space, offers an extensive set of tools to enhance industry-wide security. We are pleased to announce that our Plugin core smart contracts are audited by Certik with no major threats. This certification provides assurance to the community and end users of Plugin Decentralized oracle network and this partnership also aims to elevate the standards and security of our feeds setup program to ensure a robust and secure environment.

#### 2.5.2 WeFi

Plugin’s partnership with WeFi, aims to support and provide data feeds as service for their lending & borrowing protocol. WeFi is a decentralized money market protocol for lending and borrowing digital assets, Plugin serves the data feeds from XDC Network and acts as an oracle of choice for the pricing information.

#### 2.5.3 Stasis(Euro)

Plugin’s partnership with Stasis, aims to provide data feed support for EURO/Index pairs. STASIS is an European fintech company that designs user-oriented Web3 tools allowing institutional and retail clients to handle digital currencies and public blockchains with elegant simplicity. Plugin provides the data feeds for Stasis and acts as a source for price information within the network.

#### 2.5.4 DeGaming

DeGaming is revolutionizing iGaming Businesses with a Web3 platform for developers, operators, and investors. Plugin has integrated Plugin’s VRF functionality into their gaming ecosystem leveraging PLI. Plugin’s VRF generates Random numbers on chain through our “Direct Access Approach”. We are opening our platform with “Subscription Model” soon, this will help any gaming platform to subscribe for VRF through UI and view their txn status online.

#### 2.5.5 XSwap Protocol

XSwap is a decentralized exchange for XRC20 tokens and is built on the XDC Network. It allows all customers to Swap & Earn inside secured pools. Plugin Partnering with XSwap to open up the liquidity farming for our communities to participate and yield the benefits.

#### 2.5.5 PLISwap Protocol

In PLI Swap, developers can leverage the capabilities of the Plugin oracle on the Polygon network. Within PLI Swap, developers can mint PLI tokens that operate seamlessly on the Polygon network and integrate these tokens into their dApps to utilize the Plugin oracle. Additionally, developers have the flexibility to burn the Polygon-supported Plugin tokens once their development tasks are completed, enabling them to reclaim their tokens.

#### 2.5.6 Ambient Global

Plugin collaboration with Ambient global allows individuals or enterprises to take part in the Plugin WFN project by purchasing Ambient’s smart weather system. Upon approval and staking of the required amount (1000 PLI & 5000 XDC), individuals / enterprises are allowed to gather weather-related data for Plugin WFN’s project. The users, thereafter, claim their reward for providing weather-related data. This partnership will help to increase the utility of weather forecast data, contribute to mitigating climate-related effects globally, and nurture the Sensing-as-a-Service (SEaaS) business model.

### 2.6 Plugin’s key design focus areas

**Heterogeneous Oracle Network:** Plugin has planned to become a heterogenous, permissionless oracle network that can run multiple oracle networks simultaneously allowing the nodes to perform tasks independent of other nodes and networks. This will provide unbound flexibility for developers. Each network can be built for a specific purpose to serve the exact external data and provide off-chain computation for any smart contract applications.

**Abstracting the complexity**: Plugin Oracles abstracts the complexity from end users and developers. Plugin Feeds Marketplace provides new ways of bridging oracle into user’s smart contracts and allows users to focus more on their use case and avoid spending time on oracle integration, understanding the backbone of oracle and spending time on API genuinity, FIAT & Crypto etc.

**Scalability:** Network congestion is becoming a recurring problem in existing permissionless blockchains making it difficult for DApps to achieve the desired low latency. It is important for Oracle services to achieve low latencies and higher throughputs to meet the performance demands. Plugin is focussed on enhancing the scalability and minimizing on-chain fees (e.g., gas costs) for contract operators and ordinary users.

**Order-fairness for transactions:** Transaction sequencing is a paramount task for the blockchain network since miners and validators can control the transaction sequence. Plugin Decentralized Oracle Network, applies a fair sequencing process which eliminates the transaction order disarray and continues to optimize the transaction processing.

## 3. Plugin Improvement Protocol(PLIP)

Plugin is initially conceptualized as a fork of Chainlink open-source technology and developed by a large community of developers, researchers, and users who share the common goal of building an effective decentralized oracle network for the benefit of the XDC Network ecosystem. Expanding the Oracle network and increasing the strength of the ecosystem, we have come up with the Plugin Improvement Protocol(PLIP) developed to increase the performance and stability of the oracle network.

Node operators are the strength to any decentralized oracle network and more node operators and data feeds contribute to better aggregation processes and accurate results. Plugin has come up with the implementation protocol categorizing the node operators into three buckets to increase network stability and add new nodes to the network.

*Plugin Node Network Pool Design*

### 3.1 Validator Node Pool/Processor Node Pool

Validator Nodes set up the oracle jobs and provide data feed for end customers. Nodes are expected to run 24/7 and provide seamless connection to the master nodes. Separate ***node monitor tool***, will be executed to identify the oracle health status and see if the event is emitted as per the schedule. Periodic execution of jobs is necessary to provide high data integrity & availability to end customers.

#### 3.1.1 Criteria for Onboarding Validator Nodes

1. Node Operators should have strong technical knowledge to handle the issues that might arise in their nodes.
2. Data Integrity should be very high and the availability of nodes should be 99.9%.
3. Validator node operators should be transparent in providing the data feed.
4. Provide clear documentation & information to the Plugin Governance Committee to review & approve and list the data feed in “<https://feeds.goplugin.co”>.
5. Node operators can set up the data feed, after the Governance Committee approves the request.

Validator node submission is similar to “Node Submission Process”, but users will have to submit a special “validator request” form to consider the node to be a validator. It is important to know that approval is subject to open requirements for validator nodes. The Governance Committee can reject your request, if “Clause(A)” is not fulfilled.

Clause(A) states:

* Requirement for Strengthening the Validator Network is available. (Requirement for validator nodes is currently capped to 100. There should be a requirement for Validator nodes and existing validator nodes count is within the capped limit).
* Validator Node is not in “***Off/Idle State***” for more than ***2 days***
* Validator node with no negative remarks from end customers

#### 3.1.2 Infrastructure requirement for Validator Nodes

1. RAM 8GB to 16GB
2. Storage - Minimum 250 GB
3. Ubuntu OS 20.04
4. AWS Cloud / Other Cloud which guarantees high uptime

### 3.2 Pre-Processor Node Pool

Pre-Processor nodes will act as bridges and provide external adapter service to Validator nodes. If this node doesn’t return expected results or returns an error, then this node will be considered idle state or “Not Responsive” and if the node continues to be not responsive for 2 days, it will be moved to Standby Node pool.

#### 3.2.1 Criteria for Onboarding Pre-Processor Nodes

Standby Nodes can be moved into “Pre-Processor Nodes”, provided if they meet the following criteria:

1. Execute ProcessUpgrade command to move your node from standby/staker to Pre-Processor Node
2. Check “feeds.goPlugin.co” & choose the adapter(s) you want to set up in your node
3. Expose the port number to only specific IP address(Validator Node Pool)
4. Share the external adapter details via node operator platform for approval.
5. Infrastructure requirements for these nodes are minimal so you can choose optimal infrastructure.
6. Host on a cloud service provider with a promise of 99.9% uptime

#### 3.2.2 Infrastructure requirement for Pre-Processor Nodes

1. RAM min 4GB - Recommended 8GB
2. Storage - Minimum 100 GB
3. Ubuntu OS 20.04
4. Any cloud

### 3.3 Staking Node Pool/Standby Node Pool

Standby Nodes are existing staking nodes, and they are like standby warriors with minimum infrastructure which shall be upgraded to Validator nodes when they build the recommended infrastructure and show expression of interest and qualify to be a Validator node or when oracle needs further decentralization and more data feeds.

#### 3.3.1 Criteria for standby nodes to become validator nodes

1. Node should be setup in AWS / or any cloud with an SLA of 99.9% uptime or higher
2. Node should meet the “Validator Node or Pre-Processor Nodes” infra requirement
3. Oracles should be highly secured
4. External Adapter should be up & running

A request should be raised by the “***Standby Node***” operator as ***“Expression of Interest”*** (EOI) in the platform. This EOI will be reviewed by the Governance Committee and approved if the prescribed conditions are met.

#### 3.3.2 Infrastructure requirement for Standby Nodes

1. RAM 2GB to 5GB
2. Storage - Minimum 50 GB
3. Ubuntu OS 20.04
4. Any cloud

### 3.4 Advantages of Plugin Improvement Protocol

PLIP is implemented to enhance the stability of the oracle network and provide improved performance to the applications utilizing Plugin’s DON.

**Strong Node Backup:** With three layer node structure, Validator nodes are always backed by Pre-processors and standby nodes that are ready to become validator nodes and support in data feed.

**Better RPC Management:** With this implementation, we will have a minimum RPC requirement to manage the load. It will also help in setting up our own full nodes to balance the network traffic.

**Effective Approval Process:** Plugin is backed by a strong governance committee to ensure the nodes are chosen after establishing the prescribed standards in terms of infrastructure and data integrity. Validator nodes are chosen after proper scrutiny to ensure transparency, recommended infrastructure and technical knowledge of the validator nodes.

**Transparency**: Approving a node to be a validator has to go through the KYO/KYP process. Once the KYP is done, the validator details will be shared to the public to build the trust.

**Proper Dissemination of rewards:** Plugin is improvising the reward distribution mechanism with the implementation of PLIP. The node operators are categorized as Validator nodes, Pre-processor nodes and Standby nodes and with this the responsibilities for each type of nodes are also clearly defined. Now, the reward dissemination will be based on the responsibilities and the users are allowed to charge a fee for the service they provide. This improves the reward dissemination by providing more rewards for the nodes with greater responsibilities.

Plugin introduced a reward distribution system based on a carrot-and-stick model. Under this approach, nodes undergo continuous monitoring, and if a node remains inactive for more than three days, the corresponding reward for those inactive days is deducted during the monthly reward distribution. Penalties will be calculated as the total monthly reward minus (number of inactive days multiplied by the per-day incentive).

### 3.5 Implementation Plan

{% stepper %}
{% step %}

### Set up a separate RPC for the Validator Node Pool

Allow validator node pool to use a dedicated RPC. This will provide high connectivity and data availability.
{% endstep %}

{% step %}

### Submit KYO & KYP

Validator to submit KYO & KYP to become a validator.

* **Know Your Operator:** Basic details of the node operator that will only be open to “Plugin Governance Committee”
* ***Know your Provider:*** Details about feeds and APIs used by validator nodes that will be shared to Public
  {% endstep %}

{% step %}

### Onboard Validator Nodes

Onboard Validator Nodes & form a node pool.
{% endstep %}

{% step %}

### Convert staking node to Pre-Processor Node

To convert their staking node to “Pre-Processor” Node, node operators are expected to run “Process Upgrade” script.

* This will stop the existing RPC connection made during node setup.
* Clean-up the pm2 process.
  {% endstep %}

{% step %}

### Revisit reputation evaluation

Revisit and define the Reputation evaluation program.
{% endstep %}

{% step %}

### Provide an External Adapter list

Provide an option to show the list of “External Adapter”(EA) submitted by Pre-Processing Node Operators. Validator Node should be able to view this list and use it in their oracle nodes.
{% endstep %}

{% step %}

### Establish a Task Pool

Establish a “Task Pool'', a new feature to monitor and enhance the stability of the protocol. Sample tasks pools which Pre-processor / Standby Nodes can be part of:

* Option for Preprocessor or Standby Nodes to run any tasks from the pool, to open their additional revenue stream separately.
* External Adapter Job Execution for Single & Aggregate Jobs
* Oracle Health Monitoring Tool
* Metrics Report Generation
* API Periodic Evaluation
* Data Matcher: Perform cross-vetting of data from different API’s & measure the difference in value.
* Validator Node Health Status
* Log Aggregator
* Alert Mechanism for “Short of Storage” and other high resource utilization alerts
  {% endstep %}
  {% endstepper %}

### 3.6 Revenue Stream

In addition to the staking rewards received by the operators, here are the additional revenue streams that one can make revenue by running these activities:

| **ACTIVITY**                 | **OWNER**        | **DESCRIPTION**                                                                      |
| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------ |
| Run Validator Nodes          | VALIDATOR        | Setup Data Feed & Provide Index Pair Services                                        |
| Run External Adaptor         | PRE-PROCESSOR    | Setup External Adapter for complex business logic and list them for validator to use |
| Run Task from Task Pool list | STAKER / STANDBY | Select the tasks from the pool & run the same to generate the metrics                |

### 3.7 Reputation

Reputation of a node is critical to strengthening our Plugin Oracle Network, hence it is the prime responsibility of every node operator to periodically review their node health by ensuring high time availability. Plugin Node Reputation will be calculated based on the following metrics. At present, we are evaluating only the system heart beat to measure the performance of the nodes. After this architecture implementation, below are the factors that will influence the reputation.

Validator Nodes are expected to be operational 24/7. If the validator node is down for more than 1 day, then the node will be “removed” from the aggregation and the proper justification to be shared with the Governance Committee along with an action plan to avoid the downtime in future. These adjustments are aimed at promoting continuous participation and ensuring the resilience of our network. Since the Validator Nodes are playing a critical role in decentralization, it is of utmost importance that nodes remain active & provide the feeds to the aggregator node on time.

| **METRICS**               | **DESCRIPTION**                                                                   |
| ------------------------- | --------------------------------------------------------------------------------- |
| Heart Beat                | System Heartbeat                                                                  |
| Oracle Health             | Check the event emitted                                                           |
| EA Health                 | External Adapter Response                                                         |
| EI Port Health            | External Initiator response                                                       |
| Index Price Feed Response | Price Feed Setup by Validators should be providing valid & successful return code |
| Log Rotation              | Archiving the logs periodically                                                   |
| Periodic Maintenance      | Periodic node maintenance                                                         |
| Internal Contract Health  | Check the event emitted                                                           |

#### Rewards Information

Validator Nodes are expected to be operational 24/7. Node operators are rewarded for the trustable data and any false data will be penalized through the ‘carrot and stick’ method. Penalties will be calculated as the total monthly reward minus (the number of inactive days multiplied by the per-day incentive).

## 4. Plugin Data Feeds

Blockchain world needs to connect with the outside network to make more beneficial use cases. For example, to have DeFi, we need to get the price of Ether (ETH) and other cryptocurrencies into a contract. Another example where it requires meteorological data to provide decentralized and trustless insurance. Data Feeds are the quickest way to connect your smart contracts to the real-world market prices of assets such as gold for example.

Plugin covers a wide range of Data feeds and converts them to a real time use case such as Weather forecast, Stablecoin pairs and foreign exchanges.

With more than 1000+ active node operators and data feeds coming from different regions of the world, Plugin uses a standard data feed logic to receive the off-chain data, aggregate them and send accurate price value for the asset.

#### How does Plugin data feed work?

{% stepper %}
{% step %}

### Request an update

A DeFi protocol or Smart Contract requests an update (Example- Price of a Crypto).
{% endstep %}

{% step %}

### Launch the event

It launches the event from a smart contract.
{% endstep %}

{% step %}

### Distribute the task

The task is then distributed to a specified number of validators.
{% endstep %}

{% step %}

### Validate the data

The Validator node, who vet the data from the reliable data source, provides the pricing information back to the aggregator smart contract.
{% endstep %}

{% step %}

### Aggregate and write data on-chain

Aggregator then captures the data from multiple oracles and writes the aggregated data on-chain.
{% endstep %}
{% endstepper %}

### 4.1 Components of a data feed

**Consumer contract**: Consumer contracts call functions on the proxy contract and retrieve information from the aggregator contract.

**Internal contract:** Internal contracts are on-chain proxies that point to the aggregator for a particular data feed. These internal contracts enable the underlying aggregator to be upgraded without any service interruption to consuming contracts.

**Aggregator contract:** An aggregator is a contract that receives data from multiple data sources and provides aggregated value on-chain. Consumers can retrieve the data and act upon it within the same transaction.

### 4.2 Types of Data Feeds

Depending on the usage, data feeds can be classified as Price Feeds, Sports Feeds, Proof of Reserve Feeds and there are many custom data feeds which solve a very specific use case. Here are some of the data feeds available and upcoming in the Plugin network.

#### Price Feeds

* **StableCoins pair:** Plugin data feeds tracking stablecoins pairs.
* **Cryptocurrencies - XDC pair:** Tracking cryptocurrencies paired against XDC
* **Cryptocurrencies - other pairs:** Tracking cryptocurrencies paired against others.
* **Foreign Exchanges:** Plugin Data Feed tracking forex pairs.

#### Proof of Reserve Feeds

Track the price of the real world asset from various data feed operators.

#### Custom Data Feeds

Plugin has developed a few custom data feeds for DApps developed on the XDC network using Plugin Decentralized Oracle Network.

* **Weather Forecast:** Data feeds to get the weather data from different nodes.
* **Carbon Offset(upcoming):** Data feeds to get carbon emission data from nodes.
* **Pollution Sensor(upcoming):** Data feeds to get the air pollution level from nodes.

### 4.3 Setting up Data Feeds

**XDC Network:** Plugin has most of the standard data feeds available for use for building DApps on XDC like real time index pair rates. Documentation with detailed steps on the integration of data feeds can be found at <https://feeds.goplugin.co>.

**Polygon Network:** Plugin has updated its oracle engine to accommodate Polygon networks, now developers can easily switch the networks while using the oracle to get price feeds.

**Other Blockchain networks:** Plugin has made it easier for developers in other blockchain networks to just download Plugin’s data feeds as a NPM package and integrate it with a few steps.

* Download NPM package from npmjs.com
* `npm install Plugin-pricing-index-pair`
* Choose the feed you want to access
* Fund #PLI (Oracle Fee)

### 4.4 Advantages of Plugin Data Feeds

**Highly Decentralized:** Plugin has 3 tiered network pool composed of Validator, Pre-processor and Standby warriors and the data feed is obtained from decentralized oracle nodes.

**Implementation made easy:** NPM package that you can access to consume NPM package that can be installed to get the price feeds from Plugin network and the results can be used in smart contracts built on other blockchain networks.

## 5. Plugin VRF

Plugin VRF (Verifiable Random Function) is a critical tool for smart contract developers seeking to incorporate provably fair and verifiable randomness into their applications. It's designed to ensure that the randomness generated cannot be tampered with or predicted, making it ideal for a wide range of decentralized applications, including blockchain games, NFTs, and systems requiring random assignment of duties or resources.

### 5.1 Features of Plugin VRF

**Randomness**: Plugin VRF generates random numbers in a way that is provably fair and verifiable by all parties involved.

**Security:** The process ensures that the results cannot be manipulated by oracle operators, miners, users, or even smart contract developers.

**On-Chain Verification:** With every new request for randomness, Plugin VRF provides a random number along with cryptographic proof of how that number was determined. This proof is verified on-chain before it can be used by any consuming applications.

### 5.2 How Plugin VRF Works

**Requesting Randomness**: A smart contract requests randomness from Plugin VRF by providing a seed value. This is done through the RequestRandomness function.

**Generating Randomness:** Plugin oracles generate the random value using the provided seed in conjunction with their secret key. This process also involves creating a cryptographic proof of the randomness generation.

**Verification and Delivery:** The VRF verification contract, knowing the oracles’ public keys, verifies the cryptographic proof. If the proof is valid, the random number is considered untampered and is delivered to the requesting contract.

## 6. Plugin Ecosystem

**Node Operators**: Plugin network is built on independent node operators, making it a decentralized Oracle technology. Plugin nodes have job specifications registered with each node to execute jobs coordinated by the on-chain Oracle contracts. Plugin Improvement Protocol(PLIP) allows users to onboard as node operators with minimum infrastructure and start contributing to the network. Users with good technical knowledge and prescribed infrastructure can be onboarded as validator nodes with approval from the governance committee. The node operators are rewarded with the Plugin’s native tokens(PLI) for their commitment in Plugin’s DON.

**Data Sources:** Plugin strongly encourages the data feed providers to actively participate and constantly share trustable data. Node operators are rewarded for the trustable data and any false data will be penalized through the ‘carrot and stick’ method.

**Off-Chain Computation:** Plugin nodes not only provide data delivery capabilities but can also perform trust-minimized off-chain computation such as generating verifiable randomness, calculating insurance quotas, and more.

**Data Aggregation:** Plugin Oracle network is equipped to perform different forms of aggregation depending on the data type such as taking the median, mean, mode, or any other strategy to combine multiple data points into one. Plugin strength of nodes and data from a variety of sources makes aggregation more effective and provides accurate and aggregated feed to the customers.

**Security Parameters:** Security forms the most important aspect of the Plugin ecosystem. All our nodes are safeguarded with a strong firewall. Service agreements are put in place for the security requirements such as specifying the amount of collateral to be deposited by oracles, length of service, uptime requirements, and other considerations for the node operators and the users.

## 7. Plugin Tokenomics

Plugin has robust tokenomics through controlled minting, incentives and effective distribution of tokens.

| **#**     | **Subject Description**                                     | **Token Allocation**\* |
| --------- | ----------------------------------------------------------- | ---------------------- |
| 1         | Ecosystems Adoption and Development Rewards                 | 40%                    |
| 2         | Promoters and Founders                                      | 18%                    |
| 3         | Advisors, Partnership, Market Making & Exchange Listing etc | 15%                    |
| 4         | Community Placement                                         | 10%                    |
| 5         | Contingency                                                 | 10%                    |
| 6         | Core Team Members and Technology Ops                        | 7%                     |
| **Total** | **100%**                                                    |                        |

*Token Allocation at the time of launch*

### 7.1 Proof of Reserve for Staking

Plugin’s proof of reserve for staking offers users an easy-to-use interface where node operators can verify their stake. Given that the main objective of the platform is to increase the community member’s "Trust" and "Transparency", the platform enables members to check whether their PLI stakes are locked in smart contracts and that there’s no entity or individual that has central control over the stake.

For users that stake their funds on Plugin, the funds will be locked-in for a period of one year. Nonetheless, Plugin’s governance committee may make some exceptions, allowing some users to remove their funds before the one-year period elapses.

## 8. Plugin Innovations

We always stay futuristic and try to bring out of the box innovations that not only benefit us but the entire Web3 community. Listing down a few of the innovations that simplified the process, reduced the development time and improved the quality of the product.

### 8.1 Plugin Truffle Box

Plugin Crypto Adapter Truffle Box is a boilerplate, which allows users to bring oracle service up & running in a few minutes. This template, by default pulls data from cryptocompare.com and fetches information for index pairs that you are passing from Smart Contract. Plugin’s truffle box can be very handy with the following activities:

* Deploy consumer contract
* Deploy Oracle Contract
* Run Fulfillment
* Run Adapter
* Run approve PLI transfer
* Run PLI transfer to consumer contract
* Submit request for pricing

### 8.2 React-Solidity-XDC3 Web package

Blockchain developers and enthusiasts can understand the complexity of evaluating which web3 packages/libraries is better to use to build an application. Though we have ethers, xdc3 libraries, it is always a cumbersome process for a beginner when they want to try out and bring their idea into reality. We have built a new npm package "react-solidity-xdc3". A complete package, which takes care of connecting your client application to smart contract in just a few lines of code.Using this package, you can write data, query data, query events, convert price to wei, wei to price, xdcpay wallet integration & many more.

#### Installation Steps

```bash
npm install react-solidity-xdc3
```

* README has the details - <https://www.npmjs.com/package/react-solidity-xdc3>

#### How does it work?

* Try this <https://github.com/GoPlugin/dapp-react-solidity-xdc3> implementation sample
* Go through README.md file for step by step instructions on how to setup DApp using react-solidity-xdc3

React-Solidity-XDC3 Web package performs the following tasks.

| **Functions**                             | **Descriptions**                                                                                                                            |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| executeTransaction                        | It calls the send Transaction and writes the data onto Blockchain                                                                           |
| queryData                                 | It queries the data from Blockchain for a given function, you can read mapping variable, view function, public variable using this function |
| queryEvents                               | It enables you to read event details by passing block number                                                                                |
| createWeb3Provider createcontractInstance | It connects web3 with chosen wallet(metamask, Torus, WalletConnect) It enables you to create an instance for your contract                  |
| Ethereumcontext                           | It enables you to set up in main app.js and read those in other components                                                                  |
| showToasts                                | It enables you to show toast message after successful execution                                                                             |
| showError                                 | It enables you to show error message when there is a failure                                                                                |
| log                                       | it enables you to print detailed log by passing three parms                                                                                 |
| convertPriceToEth                         | It enables you to convert price to Wei                                                                                                      |
| convertPricefromEth                       | It enables you to convert wei to actual price                                                                                               |
| upload                                    | It enables you to upload images to IPFS                                                                                                     |
| checkCurrencyBalanceForUser               | It enables you to fetch balance for user                                                                                                    |
| getTransactionReceiptMined                | In Progress                                                                                                                                 |
| MetaTxn                                   | In progress                                                                                                                                 |

We are constantly updating this package to give complete functionalities required to build an enterprise grade decentralized application.

### 8.3 Accept XDC or XRC20 tokens as Payment method

We have created a package to accept XDC or XRC20 token as Payment method in your website or web application in a few lines of code. With this package there is no need to calculate any conversion of currencies, users can just pass an amount,payment method and fiat currency and the package will perform the task for you. With this the users can easily capture the return response for onSuccess, onFailure and onError functions.Currently this package supports XDC and PLI tokens. Integration steps can be found in npmjs.com.

### 8.4 Connect XDCPay wallet with Web3Modal

A simple package for the easy integration of XDCpay with Web3Modal.so. This package will solve the difficulties for the users in connecting the XDCPpay wallet with Web3Modal. Along with the solution and simplified steps for implementation is also provided for the users at npmjs.com

### 8.5 Automation of Data Feeds Set up

Plugin has developed an automation script for the validator nodes to set up the data feeds quickly with abstracted complexity. The deployment of oracle and other contracts has been handled using Hardhat and creation of Jobs and bridges is powered with the help of shell scripts. This will reduce the efforts of setting up data feeds and this automation will make the data feed available for the user in a short span of time.

## 9. Plugin Game changing DApps

Plugin’s Decentralized oracle networks has opened the capability to build a wide range of applications on XDC and other blockchain networks and we have built some exciting Decentralized applications using Plugin’s data feeds and adaptors.

### 9.1 Plugin Weather Forecast Node

A decentralized application, built on XDC Network to get real-time weather data. With the advent of evidence of climatic change, it is extremely important to have precise weather forecasting for every industry to make insightful decisions.Plugin Weather Forecast Node built on XDC Network brings the data from various regions across the globe at granular level.Through efficient data processing from various units across the globe, the data lake that was built by Plugin in a decentralized world will witness a new economy in the future.Plugin Weather Forecast Node built on XDC Network brings the data from various regions across the globe at granular level.

### 9.2 Cropyie

Plugin opens up diverse modern technical-oriented services to the agriculture sector across the globe with Cropyie. Although agriculture plays a significant role in fostering wealth across the globe; changes in weather patterns, unexpected production cycles, a lack of actionable weather knowledge, and insufficient mechanisms designed to offset negative consequences throughout the entire agriculture supply chain are just a few of the particular difficulties facing today’s agriculture sector.

With climate change introducing weather uncertainties, there’s a need for real-time weather data to help validate and verify damages for crop loss compensation. With the near real-time data to verify whether any specific weather conditions were experienced, causing specified problems, Cropyie ensures automated compensation to affected farmers, guaranteeing continuity in agriculture.

### 9.3 Plugin Real time air pollution tracking

Plugin Real Time Air Pollution Tracking (RTAPT) is a blockchain-enabled use case that allows air pollution tracking and tracing in real-time. The project aims to collect real-time data on air pollution, helping users with air pollution-related health issues or allergies make appropriate decisions. Plugin's (RTAPT) use case holds a lead position in helping track air pollution in real-time using data feeds from authoritative off-chain sources.

### 9.4 SkyClaim

SkyClaim, an innovative Blockchain-powered DApp, would bring a positive impact in the aviation industry globally. With Plugin’s Flight delay compensation DApp, travelers can purchase and register for the coverage. Flight schedule and delays are tracked through data feeds and If a flight is delayed due to some unforeseen conditions, the compensation amount will be settled in the user wallet automatically.

### 9.5 Plugin Emergency Care Connect

Built on XDC Network, Plugin ECA will play a critical role in assisting doctors and healthcare institutions in analyzing a patient’s profile and providing suitable treatment. Blockchain can transform the way a patient’s electronic health records are stored and shared. It can provide a safer, more transparent, and traceable underpinning system for health information exchange.The patient will have complete control over their data and will decide, whom to share and revoke the access. The caregiver would be able to grant access to patient data, during an emergency period. This will definitely enable a seamless and secure way of storing health records in blockchain and retrieving them when needed.

### 9.6 Plugin’s XDC Eco Drive

Built on XDC Network, Plugin’s Eco drive encourages road transport users to drive in eco mode and earn actively tradable crypto tokens for reduction of carbon emission. Studies show that Eco-driving has reduced vehicles’ fuel consumption and greenhouse gas (ghg) emissions by an average of 5.5%. This project will use an IoT based OBD sensor to read the carbon reduction using Eco mode of driving from the user's vehicle and reward him with a NFT token (Carbon Reduction Token - CRT) for every 100 KG of CO2 saved. Plugin also brings in corporations who want to invest in Carbon offsetting projects to buy the CRT tokens available for sale using XDC or PLI tokens. Eco drive will connect the general public and corporations to join hands and reduce carbon emission from the road transport sector.

### 9.7 EquitEdge

EquitEdge's is a blockchain application based on Real world asset tokenization with a vision to make real estate investment affordable to everyone using real estate tokenization. Investors can invest with as minimum as 100USD on premium properties and earn stable rental benefits. EquitEdge brings in a blend of regulations of the traditional real estate industry and the cutting edge blockchain technology to provide customers a feel good investment marketplace.

### 9.8 XDC Center of Excellence

As part of Plugin's XDC Center of Excellence, We are ecstatic to unveil our collaboration with Zayed University in Dubai! Through the Zayed University’s Partner Challenge Program, students will engage hands-on with genuine projects, guided every step of the way by the Plugin team's expertise. We are also partnered with Sathyabama University, Chennai, India in ways of conducting Blockchain hackathon and meet ups encouraging the student community to know more about the technology and the ecosystem.

### 9.9 Model Law On Electronic Transferable Records(MLETR)

Plugin is committed to empowering the supply chain community by creating a mobile application that will enable users to electronically manage transferable documents, following global standards such as MLETR, directly from their mobile devices. By utilizing decentralized blockchain technology, Plugin's mobile app strives to offer a convenient and secure solution for the supply chain community to streamline and enhance their operations.

## Conclusion

Plugin offers a comprehensive and secure solution for bridging the gap between decentralized applications and the real world. Its diverse data feeds, covering everything from weather forecasts to crypto prices, combined with verifiable randomness generation and multi-chain support for EVM chains, empowers developers to build innovative and trustless applications across various blockchain ecosystems. Plugin's robust network of independent node operators, incentivized through their effective tokenomics model, ensures the reliability and decentralization of the network. Their commitment to continuous improvement through ongoing innovation positions them as a key player in the evolving landscape of decentralized oracles and Web3 development.

## Acknowledgements

As said by Ken Blanchard, “None of us is as smart as all of us”. Plugin’s success and achievements are made possible with key contributions from all our stakeholders. Thanks to our moderators, community members, advisors, clients and developers who support us with constructive feedback, improved benchmarks and bring the best out of the Plugin team. We would like to acknowledge XDC foundation and our ecosystem partners who share a common goal of making web3 a significant innovative space and motivates us to achieve our vision.

## References

1. Plugin official website: <https://goplugin.co/>
2. Plugin webpage for developers: <https://docs.goplugin.co/>
3. Plugin whitepaper V2.0: <https://goplugin.co/assets/Whitepaper%202.0%20-%20Decentralized%20Oracle%20Network%20Powered%20by%20XinFin%20Blockchain%20Network.pdf>
4. Plugin whitepaper V1: White Paper - Decentralized Oracle Network Powered by XinFin Blockchain Network.docx
5. Ethereum whitepaper : <https://ethereum.org/en/whitepaper/>
6. XinFin network whitepaper: <https://xinfin.org/docs/whitepaper-tech.pdf>
7. Chain link 2.0 whitepaper: <https://chain.link/whitepaper>
