<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mario Cao on Medium]]></title>
        <description><![CDATA[Stories by Mario Cao on Medium]]></description>
        <link>https://medium.com/@mariocao?source=rss-8a44dd95825c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fzBr053k2MNAYDXPdNpqTw.jpeg</url>
            <title>Stories by Mario Cao on Medium</title>
            <link>https://medium.com/@mariocao?source=rss-8a44dd95825c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 17:59:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mariocao/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing the Flux Endgame Procotol]]></title>
            <link>https://medium.com/@mariocao/introducing-the-flux-endgame-procotol-461b69449759?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/461b69449759</guid>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 15:52:58 GMT</pubDate>
            <atom:updated>2022-08-11T15:52:58.152Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ggtccqIF25ggrt3G.png" /><figcaption><a href="https://paras.id/collection/peters-brain-by-peterfluxnear">Peter’s Brain NFT Art Collection</a></figcaption></figure><p>Learn more about how Flux aims to change the game for decentralized oracles</p><p><em>Originally published on </em><a href="https://fluxprotocol.medium.com/introducing-the-flux-endgame-protocol-ec1d0558fa9e"><em>Flux Protocol</em></a></p><p>Blockchain oracles connect smart contracts to external data, allowing them to perform executions depending on real-world inputs and outputs. Despite the numerous iterations and protocols attempting to build that bridge between the on-chain and off-chain worlds, none of these solutions have been able to find the perfect tradeoff between data security, economic guarantees, and scalability.</p><blockquote>“Imagine the ideal protocol. It would have the most trustworthy third party imaginable — a deity who is on everybody’s side. All the parties would send their inputs to God. God would reliably determine the results and return the outputs.” — “The God Protocols” by Nick Szabo</blockquote><p>Szabo’s utopian “The God Protocols” article could be interpreted as the idea that the perfect oracle might not actually be possible. It makes sense if one thinks about the non-deterministic nature of data combined with the spurious interests of the involved parties within a decentralized distributed system.</p><p>However, at Flux Protocol, we are convinced that we are moving one step forward in the race for building a next-gen decentralized oracle with the <strong>Flux Endgame Protocol.</strong></p><p>In this article, we will deep dive into the foundations of building this protocol. We will also cover the design decisions and main challenges.</p><h3>Why is the Flux Endgame Protocol Necessary?</h3><p>Before jumping into technicalities, we will review why oracles are crucial for blockchains, but most importantly, why the Flux Endgame Protocol will become an essential infrastructure component in the space.</p><h4>Why decentralized oracles?</h4><p>Blockchains without oracles are like computers without an internet connection. They are isolated from the outside world and can only access on-chain information. Oracles act as bridges toward the external world, but it is paramount that they are secure and reliable as they might directly determine the output of smart contracts.</p><p>Not to defeat the purpose of using a blockchain network (hundreds or thousands of nodes running the same software), oracles should aim to be as decentralized as possible. Thus, avoiding single points of failure (e.g., nodes or data sources going offline or acting dishonestly).</p><p>However, an unbelievable amount of the most widely-used protocols — such as in DeFi, or NTFs — are not truly decentralized. They are still using permissioned infrastructure or trusted third parties. Some strong arguments are that they rely heavily on risk management and accountability, and some decentralized solutions cannot guarantee a sufficient quality of service (e.g., data accuracy and latency). In some cases, data providers can be seen as the custodians of the funds in the smart contracts.</p><h4><strong>Why the Flux Endgame Protocol?</strong></h4><p>Oracles are a critical but often overlooked component of many decentralized protocols. They are complex to build, and there is probably no silver bullet perfect for all use cases. Decentralization brings significant advantages to the table (transparency, security) along with some considerate drawbacks (speed, accountability).</p><p>At Flux, we believe we can build a protocol with all these advantages while overcoming (or reducing) most of its drawbacks. It has not been an easy journey. At Flux, we started building a fully decentralized oracle protocol, whose security was based on staking and a court system. However, we soon realized that the non-deterministic time-to-finality of the system was a critical impediment for many protocols consuming this data. After that experience, we implemented a First Party Oracle (FPO), where we sacrificed complete decentralization in pursuit of the highest quality of service (i.e., data quality and latency).</p><p>Now we leveraging our previous experience in the space to build a next-gen oracle infrastructure that will become the HTTP for Web3 technologies. The Flux Endgame decentralized protocol aims to be a secure yet performant oracle at the service of any other protocol on any chain.</p><h3>Main design decisions: What should it look like?</h3><p>As with any other blockchain oracle, the Flux Endgame protocol aims to guarantee the expected properties such as safety, liveness, and fault tolerance. Yet, we would like to focus on the design decisions that will make Flux different from other solutions.</p><h4><strong>Built-in multi-chain support</strong></h4><p>Native support for multiple chains was one of the top priorities while envisioning the oracle protocol. The architecture design has bridging mechanisms as part of the core protocol. The main goal is that protocols and smart contracts can interact with the Flux protocol seamlessly from other chains without having to know anything about Flux protocol specifics.</p><h4><strong>Economic guarantees based on PoS</strong></h4><p>Okay, this is not necessarily too different from other existing solutions, but security is one of our cornerstones, and we could not leave it out. Our security model is based on a Proof-of-Stake scheme, where node operators will stake part of their funds to perform some tasks (e.g., resolving data requests) and to contribute to the overall system security (e.g., validating a global state).</p><h4><strong>Fast-finality</strong></h4><p>The third design decision is clearly about performance. Many protocols require an oracle service that is not only reliable but with almost no delay. Most of them are time-sensitive, and data requests lose value if they are not recent. At Flux, we will prioritize having a fast and deterministic time-to-finality of the data request execution on any chain.</p><h4><strong>Decentralized sustainable ecosystem</strong></h4><p>The Flux Endgame protocol is a permissionless decentralized protocol. The idea is to foster a rich ecosystem in which different interested parties can easily coexist, i.e., developers and protocols, node operators, and data providers building a symbiotic community around the Flux oracle protocol. Additionally, the protocol will be governed by a DAO comprised by its community, i.e., anyone that holds $FLX tokens.</p><p>There are many more design decisions that we decided not to include in the previous list because we believed they should be part of any existing oracle solution. Some examples are data tamper resistance, sybil resistance, protocol upgradeability, censorship resistance, multi-source fact checking, etc.</p><h3>Which are the main challenges?</h3><p>Building a decentralized protocol is a complicated problem, not only for the substantial amount of hidden complexities but also because all its pieces have to fit perfectly together. Here are the main identified challenges that need to be addressed before moving to the protocol implementation.</p><h4><strong>Architecture design</strong></h4><p>There are many moving pieces within a decentralized oracle protocol. The figure below shows a high-level abstraction of the system architecture. Each box requires consequent analysis and design before the implementation phase. Some challenging topics include: security analysis and potential attacks, core protocol dynamics, cost analysis, and data request execution latency.</p><figure><img alt="Generic Oracle Architectural Model" src="https://cdn-images-1.medium.com/max/1024/1*8Ki4gQMaiC73zpz7lz0k_g.png" /><figcaption>Generic Oracle Architectural Model</figcaption></figure><h4><strong>Sub-chain bridging</strong></h4><p>Analyzing and designing how bridging would work in a multi-chain decentralized oracle is clearly the most critical challenge we faced.</p><p>As the Flux Endgame Protocol will support other chains for oracle services, forwarding states to different chains will be required. It means designing the interactions between parties with potentially different interests within a multi-chain context.</p><h4><strong>Tokenomics</strong></h4><p>The following piece of the puzzle is token economics, i.e., the economic dynamics that guarantee that interests are aligned and that the system is secure. It is a complex analysis in which the end goal is to maximize the overall system security by identifying the proper incentives for each participating party, i.e., node operators, data request executors, nodes acting as relayers, consumers, etc.</p><h3>Where are we now?</h3><p>During these past few months, we have been working on analyzing the previously described main challenges. In this analysis stage, we laid the foundations of the protocol by proposing technical solutions for all identified problems. We also started with a high-level architecture design while deep diving into those topics of special relevance. Some of the topics that have been covered so far:</p><ul><li>Consensus algorithm based on PoS</li><li>Global state and its data structure (incl. commitments and proofs)</li><li>Bridging between main-chain and sub-chains</li><li>Data request execution based on WASM</li><li>Data request committees using VRF sortition</li><li>Data request lifecycle and commitment scheme</li></ul><p>For the upcoming quarter, we aim to shift the focus to additional design tasks such as:</p><ul><li>Drafting a high-level technical paper (or litepaper)</li><li>Continue with architecture design tasks such as defining contract interfaces and main data structures</li><li>Start designing P2P overlay network (message schema, gossip protocol, serialization protocol, etc.)</li><li>Specific Proofs-of-Concept (PoC) might be implemented to be used as reference or formal verification of research outcomes.</li></ul><p>Please take the previous goals just as an informational note. Priorities and tasks can always be subject to change.</p><h3>Closing Thoughts</h3><p>As often happens with decentralized protocols, challenges and technical solutions tend to be quite complex. This often leads to solutions that lack some core characteristics that, we believe, should be present in any decentralized oracle.</p><p>At Flux, we are committed to building the next-gen oracle protocol. A fast and reliable protocol with the ambition of becoming an essential infrastructure to any blockchain protocol on any chain.</p><p>Stay tuned for future research and engineering updates!</p><h3>About Flux</h3><p>Flux allows any smart contract to connect with crowdsourced, API-based, and price-feed data. Flux brings this data on-chain using a sophisticated validation and dispute mechanism that relies on economics principles to keep validators honest.</p><p>Flux is backed by world-class investors such as Distributed Global, Coinbase Ventures, Reciprocal Ventures, Coinfund, Maven 11, Flow Ventures, among others.</p><p><a href="https://www.fluxprotocol.org/">Website</a> | <a href="https://github.com/fluxprotocol">GitHub</a> | <a href="https://t.me/fluxprotocol">Telegram</a> | <a href="https://discord.com/invite/wsNwx2N75B">Discord</a> | <a href="https://twitter.com/fluxprotocol">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=461b69449759" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial: Off-chain voting on Aragon DAOs powered by Witnet]]></title>
            <link>https://medium.com/witnet/tutorial-off-chain-voting-on-aragon-daos-powered-by-witnet-33b529737a03?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/33b529737a03</guid>
            <category><![CDATA[witnet]]></category>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[discord]]></category>
            <category><![CDATA[aragon]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 11:15:51 GMT</pubDate>
            <atom:updated>2021-08-30T11:15:51.217Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial is a follow-up to this <a href="https://medium.com/witnet/witnet-decentralized-oracle-brings-aragon-daos-to-discord-2f6ea6e071e9">article</a> about the integration between Witnet and Aragon Govern by using Discord as an off-chain voting platform. We will present how the integration works and how to spin up your own Discord bot for an Aragon Govern DAO.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F6_oku8U1VQ1DXrk-GHAIg.png" /></figure><h3>Behind the curtains…</h3><p>In May 2021, the Witnet decentralized oracle project released an integration with Aragon Govern, a framework for DAOs that enables off-chain voting with on-chain execution, and Discord, the leading voice, video and chat app for online communities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NKP5iydAewgqkfOd.png" /><figcaption>Integration architecture</figcaption></figure><p>The integration is based on 2 main components:</p><ol><li>A <strong>Conversational Bot</strong>, in charge of reacting to Discord messages (!setup and !proposal) and managing the proposals lifecycle powered by Witnet and Aragon Govern contracts.</li><li>Several <strong>Reaction Monitors</strong>, servers in charge of monitoring proposal votings so that results can be queried by the Witnet network.</li></ol><p>In addition, there are 2 required external components:</p><ol><li><strong>Ethereum node</strong>, which will receive the Aragon Govern transactions.</li><li><strong>Witnet node</strong>, which will be responsible for querying the proposal voting results.</li></ol><p>Other components included in the architecture diagram are:</p><ul><li><strong>Discord server</strong>, used to read and write in Discord channels.</li><li><strong>Subgraph Server</strong>, used to query Aragon Govern data required by the Conversational Bot.</li></ul><p>The following image depicts the default execution scenario featuring no exceptional or error conditions, aka the “happy path”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bQbRHmpFXc01o1v8.png" /><figcaption>Default execution scenario</figcaption></figure><p>Despite being the execution complexity hidden from the users, it can be used to better understand the solution and all its “moving pieces”:</p><ol><li>The <strong>Discord Bot</strong> obtains all required information from the Aragon Govern contracts by querying the subgraph server.</li><li>The <strong>Discord Bot</strong> reads a new Govern proposals from the users (e.g. “transfer funds to an address”).</li><li>Once, the proposal voting period is over, the <strong>Discord Bot</strong> triggers proposal resolution by first creating a Witnet Data Request that will query the voting results.</li><li>The Witnet Data Request is broadcasted to the Witnet network and its execution starts.</li><li>As part of the execution, secret randomly selected Witnet nodes retrieve proposal voting results by querying all <strong>Reaction Monitors</strong>.</li><li>As part of that query, each <strong>Reaction Monitors</strong> fetch the reactions for the proposal from the <strong>Discord Server</strong>.</li><li>The data request execution is finalized by aggregating all <strong>Reaction Monitors</strong> voting results and checking if there was consensus among them.</li><li>The <strong>Discord Bot</strong> detects that the data request has been executed.</li><li>If the data request was successful, the <strong>Discord Bot</strong> will trigger the proposal schedule and, after the dispute/challenge window, the execute in the Govern Aragon smart contract.</li></ol><h3>Step 0: Requirements</h3><p>This tutorial has the following requirements:</p><ul><li>Access to <strong>Ethereum</strong>: run an Ethereum node (e.g. geth) or have access to a JSON-RPC interface to be able to sign and send Ethereum transactions.</li><li>Access to <strong>Witnet</strong>: run a Witnet node or have access to a JSON-RPC interface to send data requests to the Witnet network.</li></ul><h4>Ethereum node</h4><p>The second requirement is about having access to an Ethereum node to be able to interact with the Aragon Govern contracts. There are 2 possibilities to access a node:</p><ol><li><a href="https://ethereum.org/en/developers/docs/nodes-and-clients/run-a-node/">Spin up your own Ethereum node</a>.</li><li>Use a Web3 provider (e.g. <a href="https://ethereum.org/en/developers/docs/nodes-and-clients/nodes-as-a-service/">nodes-as-a-service</a>).</li></ol><p>In both configurations, an unlocked Ethereum account is required to interact with the Aragon contracts and sign transactions.</p><p>This account will be used later in the tutorial as an environment variable called <strong>WEB3_ACCOUNT</strong>.</p><h4>Witnet node</h4><p>The first requirement is access to a Witnet node is needed to send data requests (i.e. querying for the proposal results). More concretely, a JSON-RPC interface with a Witnet node is required.</p><p>To run a Witnet node follow the instructions from the <a href="https://docs.witnet.io/try/run-a-node/">documentation</a> but make sure that the JSON-RPC port will be accessible for the next step (discord bot), by default on port 21338.</p><p>The docker instructions to also make accessible port 21338 are:</p><pre>$ docker run -d \<br>    --name witnet_node \<br>    --volume ~/.witnet:/.witnet \<br>    --publish 21337:21337 \<br>    --publish 21338:21338 \<br>    --restart always \<br>    witnet/witnet-rust</pre><p>Note: The Witnet node needs to have some funds to be able to send data requests to the network.</p><p>The Witnet node host and port will be used later in this tutorial as <strong>WITNET_NODE_HOST</strong> and <strong>WITNET_NODE_PORT</strong> respectively.</p><h3>Step 1: Create an Aragon DAO</h3><p>Create an Aragon DAO by using the <a href="https://govern-rinkeby.aragon.org/">Aragon Govern website</a>.</p><p>To be compatible with the current implementation of the Aragon bot, it is important to set up the DAO as follows:</p><ul><li>Collateral amounts must be set to 0.0 tokens.</li><li>Scheduling transaction whitelist must be set to “Any address” or to the same address that the Ethereum node has unblocked, i.e. <strong>WEB3_ACCOUNT</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*6vmJC56hfVdJnMPv.png" /></figure><p>For example, the <a href="https://govern-rinkeby.aragon.org/#/daos/angry-violet">angry-violet</a> DAO was configured as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YVOBFviEVMISnAHV.png" /></figure><h3>Step 2: Create the Discord bots</h3><p>The Discord bot will operate on Discords servers it has been invited. If the server has not been created yet, follow these <a href="https://blog.discord.com/starting-your-first-discord-server-4dcacda8dad5">instructions</a>.</p><p>Once, the server exists, bots can be created as:</p><ol><li>Go to <a href="https://discord.com/developers/applications">https://discord.com/developers/applications</a></li><li>Create a new application<br>a. Click on “New application” and give an application name<br>b. Fill out the “General information” of the application</li><li>Create a bot<br>a. On the application dashboard, go to the side menu “Bot”<br>b. Click on the “Add Bot” button<br>c. Configure the bot username (by default it will be the same as the application name)<br>d. Copy the bot TOKEN (it will be required in the next steps)<br>e. Configure your bot as you want (e.g. public bot, permissions, …)</li><li>Invite bot to the Discord server<br>a. On the application dashboard, go to the side menu “OAuth2”<br>b. In “OAuth2 URL Generator section” click on “bot”<br>c. Click on the “Copy” button to copy the authorize URL<br>d. Go to the copied URL (it should start with: https://discord.com/oauth2/authorize?client_id=&lt;CLIENT_ID&gt;)<br>d. Select the Discord server and authorize the bot to join</li></ol><p>After creating the bots, they should be listed as offline within the member list of the Discord server.</p><p>The previous instructions should be followed to create the <strong>Conversational Bot</strong> and as many as desired <strong>Reaction Monitors</strong>.</p><p>The Discord tokens and Oauth URLs are required for the next steps as <strong>DISCORD_TOKEN</strong> and <strong>MONITOR_LINK</strong> respectively.</p><h3>Step 3: Build the project</h3><p>Inside this repository there are two packages, which will be configured in the next tutorial steps:</p><ul><li><strong>Conversational Bot</strong>: contains the logic for Aragon’s discord bot.</li><li><strong>Reaction Monitors</strong>: act as a middleware to read message reactions from the Discord API, and then publish the results through a public REST API.</li></ul><p>After ensuring that the previously mentioned requirements, access to a Witnet and Ethereum node, are fulfilled, follow these steps:</p><ol><li>Clone the discord-bot-integration repository from GitHub</li></ol><pre>$ git clone <a href="https://github.com/stampery-labs/aragon-govern-discord-integration">https://github.com/stampery-labs/aragon-govern-discord-integration</a></pre><ol><li>Enter the directory, install all dependencies and build the project:</li></ol><pre>$ cd aragon-govern-discord-integration<br>$ yarn<br>$ yarn bootstrap</pre><h3>Step 4: Start the Conversational Bot</h3><p>The <strong>Conversational Bot</strong> is configured via environment variables. The easiest to configure the bot is by using the .env file located under aragon-govern-discord-integration/packages/bot.</p><p>The main configuration parameters are:</p><ul><li>DISCORD_TOKEN: the token available at Step 2 (3.b) of the conversational bot.</li><li>MONITOR_NAME_0: reaction monitor name shown after !setup message.</li><li>MONITOR_LINK_0: generated OAuth2 URL at Step 2 (4.c).</li><li>MONITOR_RETRIEVE_URL_0: host and port of the monitor to be queried by Witnet nodes (should be accessible externally).</li><li>WEB3_ACCOUNT: Ethereum account from which transactions are sent.</li><li>WEB3_PROVIDER: host and port of the web3 provider.</li><li>WITNET_NODE_HOST: Witnet node host.</li><li>WITNET_NODE_PORT: Witnet node port.</li></ul><p>Example .env file:</p><pre>ENVIRONMENT = development<br>DISCORD_TOKEN = &lt;COPY DISCORD TOKEN HERE&gt;<br># The minimum period a proposal has to be active in seconds<br>MINIMUM_PROPOSAL_DEADLINE = 120</pre><pre># Subgraph server<br>SUBGRAPH_ENDPOINT = https://api.thegraph.com/subgraphs/name/aragon/aragon-govern-rinkeby</pre><pre># List of Reaction Monitors<br>MONITOR_NAME_0 = &quot;Reactions Monitor 1&quot;<br>MONITOR_LINK_0 = &lt;COPY OATH2 URL HERE&gt;<br>MONITOR_RETRIEVE_URL_0 = &lt;CHANGE ME! http://mydomain1:3000&gt;</pre><pre>MONITOR_NAME_1 = &quot;Reactions Monitor 2&quot;<br>MONITOR_LINK_1 = &lt;COPY OATH2 URL HERE&gt;<br>MONITOR_RETRIEVE_URL_1 = &lt;CHANGE ME! http://mydomain2:3000&gt;</pre><pre># Web3 provider<br>WEB3_ACCOUNT = &lt;COPY WEB3 ACCOUT HERE&gt;<br>WEB3_PROVIDER = http://localhost:8544</pre><pre># Witnet<br>WITNET_NODE_HOST = &quot;localhost&quot;<br>WITNET_NODE_PORT = 22338</pre><p>From the aragon-govern-discord-integration folder, start the conversational bot as:</p><pre>$ yarn bot</pre><pre>[BOT]: Connected to Witnet node<br>Connected to database<br>[BOT]: Listening discord server<br>[BOT]: looking for active proposals<br>[BOT]: active proposals found []</pre><h3>Step 5: Start the Reaction Monitors</h3><p><strong>Reaction Monitors</strong> are configured in a similar but simpler way to the Conversational Bot. It only contains 2 parameters:</p><ul><li>DISCORD_TOKEN: the token available at Step 2 (3.b) of the reaction monitor bot.</li><li>PORT: port to listen to HTTP GET requests, used by Witnet nodes to query the proposal results.</li></ul><p>Example .env file:</p><pre>DISCORD_TOKEN = &lt;COPY DISCORD TOKEN HERE&gt;<br>PORT = 3000</pre><p>From the aragon-govern-discord-integration folder, each <strong>Reaction Monitor</strong> is started as:</p><pre>$ yarn server</pre><pre>[Server] Listening on PORT 3000<br>Connected to database</pre><p>Ideally, <strong>Reaction Monitors</strong> should run in different machines and they should be independently operated. However, if they run on the same machine (e.g. for testing purposes), the ports should be different for each one of them.</p><p>The PORT environment variable can also be defined inline as:</p><pre>$ PORT=3001 yarn server</pre><pre>[Server] Listening on PORT 3001<br>Connected to database</pre><h3>Step 6: Use it from Discord</h3><p>We are almost done, the last step is all about the happy path and about checking that all configured components are working properly:</p><p>1. First, if you didn’t do it already, add the bot to a Discord server by using the OATH2 URL as described in Step 2 (4d). Once you have added the bot to your server it should appear <strong>online</strong> in the member list.</p><p>2. Configure your Aragon Govern DAO by using the !setup command within the channel and specify the DAO’s name and which role is allowed to send proposals.</p><pre>!setup &lt;daoName&gt; &lt;role&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*GFqCefoCTRrsOIue.png" /></figure><p>3. Only authorized users (with a configured role) are allowed to create proposals by using the !proposal command as:</p><pre>!proposal &lt;deadline&gt; &lt;description&gt; to:&lt;address&gt; value:&lt;ETH&gt; data?:&lt;data&gt;</pre><p>Example:</p><pre>!proposal 2021/03/26 15:07:00 do you want to give a grant to ENTITY? to:0x199eA5114D1612e40E3457Eaf9DF2779340EAD12 value:0.01</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/0*Zj5hBZbBCKt4KbVb.png" /></figure><p>4. After a proposal is received by the bot, the voting period starts and it will read 👍 and 👎 reactions from all Discord users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*Tt8EygRAr4qQzmSv.png" /></figure><p>5. When the proposal deadline is reached, users can’t continue voting. Then, the bot will create a Witnet data request to retrieve the voting results and it will deliver the data to the Aragon DAO in form of a schedule transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*aXqJzICNY47hOpUM.png" /></figure><p>6. After the dispute period is over, the bot will trigger the execution of the proposal as a execute transaction. This will also execute the specified action. In this case, transferring ETH to the given address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*Wk3y5WP2cVq1Uk2U.png" /></figure><h3>What to do next?</h3><p>If you made it this far, thank you very much for your patience! 🎆</p><p>We know the integration has many <em>moving parts</em> and it is not easy to make it work on the first attempt. Please take into consideration that this integration is a <em>work-in-progress</em> and there are still missing features to be added!</p><p>The integration source code is open-source and available at our Github repository <a href="https://github.com/witnet/aragon-govern-discord-integration">aragon-govern-discord-integration</a>. New collaborators and new feature requests are always welcomed! 💪</p><h4>About Witnet</h4><p>Witnet is a decentralized oracle that is true to the censorship resistant nature of blockchains. The Witnet protocol leverages state-of-the-art cryptographic and economic techniques to provide smart contracts with secure data input.</p><p><a href="https://witnet.io/">Website</a> | <a href="https://discord.gg/X4uurfP">Discord</a> | <a href="https://t.me/witnetio">Telegram</a> | <a href="https://twitter.com/witnet_io">Twitter</a> | <a href="https://reddit.com/r/witnet">Reddit</a> | <a href="https://www.youtube.com/witnetfoundation">Youtube</a></p><h4>About Aragon</h4><p>Aragon is the leading platform for enabling online communities, companies and collectives of all types to run Decentralized Autonomous Organizations (DAOs) on Ethereum.</p><p><a href="https://aragon.org/">Website</a> | <a href="https://discordapp.com/invite/eqQJkdp">Discord</a> | <a href="https://forum.aragon.org/">Forum</a> | <a href="https://twitter.com/AragonProject">Twitter</a> | <a href="https://www.reddit.com/r/aragonproject/">Reddit</a> | <a href="https://www.youtube.com/channel/UCODiU_-FWhr4SVOoBlm-qaQ">YouTube</a></p><h4>About Discord</h4><p>Discord is a voice, video and text communication service used by over a hundred million people to hang out and talk with their friends and communities.</p><p><a href="https://discord.com/">Website</a> | <a href="https://twitter.com/discord">Twitter</a> | <a href="https://www.instagram.com/discord/">Instagram</a> | <a href="https://www.facebook.com/discord/">Facebook</a> | <a href="https://www.youtube.com/discord/">YouTube</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33b529737a03" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/tutorial-off-chain-voting-on-aragon-daos-powered-by-witnet-33b529737a03">Tutorial: Off-chain voting on Aragon DAOs powered by Witnet</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Witnet Smart Contracts Security Audit Results]]></title>
            <link>https://medium.com/witnet/witnet-smart-contracts-security-audit-report-afbc8e653cd?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/afbc8e653cd</guid>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[witnet]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 16:18:32 GMT</pubDate>
            <atom:updated>2020-06-04T17:04:40.806Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>Witnet’s smart contracts have gone through an external security audit, in preparation for Mainnet.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*SkN7SZb2ldml9WGGrxxJQw.png" /></figure><p>Witnet’s Ethereum smart contracts are the gateway into the Witnet network, and with the security of applications that rely on Witnet at stake, they must be bullet-proof. With that in mind, the following steps are critical during our development process:</p><ul><li><strong>Open-source: </strong>All the code and research developed in Witnet is open-source. As a result, any community member can contribute by peer-reviewing and alerting the community to potential vulnerabilities at both the protocol and the code level.</li><li><strong>Testing, testing and more testing: </strong>Testing the entire code is a<strong> </strong>necessary (but not sufficient) condition to merge any Pull Request. Thus, all the code is put through an exhaustive test suite that runs on every push in <a href="https://travis-ci.com/">Travis</a> and <a href="https://github.com/features/actions">GitHub Actions.</a></li><li><strong>Peer code reviews</strong>: As part of our development process, any Pull Request submitted to Witnet repositories goes thorough several reviews from other Community Members before it can get committed to the repository.</li><li><strong>Internal audits</strong>: Once the code is considered stable (i.e. there have been no significant changes during the last iterations), an exhaustive internal security audit is done by using static analysis tools such as <a href="https://mythx.io/">MythX</a> or <a href="https://tool.smartdec.net/">SmartCheck</a>.</li><li><strong>External audits</strong>: Finally, the community has chosen to hire <a href="https://red4sec.com/en">Red4Sec</a> (after a lengthy decision process) to conduct external security audits of the smart contracts.</li></ul><h3>Outcomes of the external security audit</h3><p>The community asked <a href="https://red4sec.com/en">Red4Sec</a> to perform an analysis of the core components of the infrastructure which enable the interaction between Witnet and Ethereum. These components comprise of the following cryptographic libraries and smart contracts:</p><ul><li><a href="https://github.com/witnet/elliptic-curve-solidity"><strong>Elliptic Curve library</strong></a><strong>:</strong> Arithmetic operations on elliptic curves aiming to keep gas costs low.</li><li><a href="https://github.com/witnet/vrf-solidity"><strong>VRF library</strong></a><strong>:</strong> Verifiable Random Functions (VRFs) verifications following the <a href="https://www.ietf.org/id/draft-irtf-cfrg-vrf-06.txt">VRF standard</a>.</li><li><a href="https://github.com/witnet/witnet-ethereum-block-relay"><strong>Witnet Ethereum Block Relay</strong></a><strong>:</strong> The building block that allows contracts to securely verify Witnet transactions within Ethereum.</li><li><a href="https://github.com/witnet/witnet-ethereum-bridge/"><strong>Witnet Ethereum Bridge</strong></a><strong>:</strong> Relays data requests and their results from Ethereum to Witnet and vice versa.</li></ul><p>In particular, a thorough audit of the smart contract security measures was requested, in order to identify possible errors in the design, configuration or programming. The main goals are to guarantee the confidentiality, integrity and availability of the information accessed, treated, and stored.</p><p>Red4Sec dove deeply into the Witnet Network Protocol and its Smart Contracts, reviewing the technical aspects of the complete ecosystem. The subsequent report included <strong>19 vulnerabilities</strong> classified in the following levels of risk according to the impact level defined by CVSS (Common Vulnerability Scoring System).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGnA2QwIRtnA3rB2lTMHNQ.png" /><figcaption>Summary of security audit vulnerabilities</figcaption></figure><p><a href="https://github.com/witnet/research/blob/master/security_audits/smart_contracts/Security_Audit_Report.pdf">The complete external security audit report can be found here.</a></p><h3>Mitigation of vulnerabilities</h3><p>After numerous discussions with the auditors, Witnet defined a mitigation plan by producing a technical response for each vulnerability (where possible) along with a pull request fixing or mitigating each issue. Most of them were easy to address by following the recommendations suggested by Red4Sec, while others required further discussions and more lengthy code fixes.</p><p>Some of the most interesting ones (classified as critical):</p><ul><li><strong>Replay Proof of Inclusion (PoI) Attack</strong>: a vulnerability that enabled attackers to report an old data request as a valid result for identical data requests executed at a later point in time. The issue was addressed by pulling the latest Witnet block epoch from Block Relay and ensuring that the data request lifecycle is always completed after that epoch has passed.</li><li><strong>Race condition in the Witnet Request Board</strong>: a vulnerability that allowed any Ethereum user to listen to result insertion transactions, copy them and claim the rewards without doing any work. The issue has been mitigated by ensuring only legit nodes can report results (i.e. nodes that have proven to do recent work and are members of the Active Bridge Set).</li><li><strong>Drain of contract funds in Witnet Request Board:</strong> this vulnerability describes a potential drain of funds if zero-length results are posted in the Witnet network. As this would indicate an invalid result, a guard was included to ensure the results are not zero-length.</li></ul><p><a href="https://github.com/witnet/research/blob/master/security_audits/smart_contracts/mitigations.md">The complete mitigation plan, which details the procedure to fix these vulnerabilities can be found here.</a></p><h3>Acknowledgements</h3><p>Special thanks to <a href="https://medium.com/@girazoki">Gorka</a> and <a href="https://medium.com/@HelloImThomas">Thomas</a>, as this post is a common effort between the 3 of us.</p><blockquote>Think you can break Witnet? Earn up to 5000 $DAI during <a href="http://testnet.witnet.io/join">the Witnet Testnet Incentive Program</a> by uncovering a bug or coordinating an attack on the Witnet Network. <a href="http://testnet.witnet.io/join">Find out more</a>!</blockquote><h3>Learn more about Witnet:</h3><ul><li><a href="http://testnet.witnet.io/join">Join the Witnet Testnet Incentive Program to earn WIT and $DAI!</a></li><li><a href="http://witnet.io/">Visit the Witnet homepage</a> 🔗</li><li><a href="https://witnet.io/witnet-whitepaper.pdf">Read the Witnet whitepaper</a> 📃</li><li><a href="https://github.com/witnet">Check out Witnet’s code on Github</a> 🤖</li><li><a href="https://witnet.io/about">Read Witnet core documents</a> ❓</li><li><a href="https://t.me/witnetio">Join the community Telegram group</a> and <a href="https://discord.gg/QKEa5gU">Discord</a> 💬</li><li><a href="https://twitter.com/witnet_io">Follow @witnet_io on Twitter</a> 🐦</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afbc8e653cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/witnet-smart-contracts-security-audit-report-afbc8e653cd">Witnet Smart Contracts Security Audit Results</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to prevent Sybil Attacks without PoW/PoS]]></title>
            <link>https://medium.com/witnet/how-to-prevent-sybil-attacks-without-pow-pos-d4d72436dc85?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4d72436dc85</guid>
            <category><![CDATA[proof-of-work]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[sybil-attack]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Wed, 04 Dec 2019 11:59:32 GMT</pubDate>
            <atom:updated>2020-07-28T15:27:41.963Z</atom:updated>
            <content:encoded><![CDATA[<h4>Preventing Sybil Attacks in a Decentralized Oracle Network, without relying on Proof of Work or Proof of Stake… and not die trying!</h4><p>In this article, we’ll discuss the challenge of preventing Sybil attacks on <a href="https://medium.com/witnet/witnet-smart-contracts-with-real-power-f79e326da3a4">Witnet, the Decentralized Oracle Network</a>, without relying on Proof of Work (PoW) or Proof of Stake (PoS). Sybil attacks are an Achilles’ heel for decentralized protocols, so we’d like to share our process and design choices to deal with them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*im6n4q4jzBMu3iiH.jpg" /><figcaption>The attack of the “Sybils”</figcaption></figure><h3>So who’s Sybil?</h3><p>The term “Sybil attack” is in reference to <a href="https://en.wikipedia.org/wiki/Sybil_(Schreiber_book)">the 1973 book, Sybil<em> </em></a><em>— </em>a case study of a woman diagnosed with a dissociative identity disorder.</p><p>The mechanisms of the attack are as follows: attackers aim to undermine a network by creating numerous fake identities. To an observer, these identities appear as separate users, but in reality, they are all controlled by a single entity. As a result, the attacker has a significant influence on voting power and could collapse or corrupt the network.</p><p>Sybil attacks are often confused with Eclipse attacks. However, in the latter, fake identities do not attempt to mislead the network entirely; instead, they corner individual nodes on the network by monopolizing all their P2P connections. By isolating specific elements, the attack can portray a fake network state to them. In summary, Eclipse attacks affect a small portion of a network, whereas Sybil attacks violate the entire network. You can read more about Eclipse attacks here:</p><p><a href="https://medium.com/witnet/the-p2p-bucketing-system-in-witnet-d893dce4b8c5">The P2P Bucketing System in Witnet</a></p><h3>How decentralized consensus algorithms deter Sybil attacks</h3><p><strong>Proof of Work (PoW), utilized by Bitcoin’s network, is the go-to model for Sybil resistance</strong>. To be rewarded, each identity on the network must carry out a non-arbitrary and equal amount of computational work. In other words, every Sybil identity must perform as much work as every honest identity, thus making a Sybil attack prohibitively expensive.</p><p><strong>In Proof of Stake (PoS), consensus is achieved within a network of validators, who have “locked” or “staked” a non-negligible amount of capital for a set period of time</strong>. An attacker that wishes to carry out a Sybil attack on a PoS network needs to lock at least as much stake as that locked by honest validators.</p><p>Whilst the initial cost of an attack may not be immediately obvious (lock capital -&gt; perform attack -&gt; retrieve stake after a certain period), the PoS model is assumed to work because:</p><ul><li>the amount of capital an attacker can stake is limited, since the sum of the attacker’s stake plus all other stakes cannot exceed total circulation</li><li>by performing a Sybil attack, the attacker depreciates public confidence (and value) of the underlying protocol/asset, thereby reducing or eliminating any profitability on the attack</li></ul><h3>The problem: divide and conquer approach</h3><p>Consensus decisions within a Decentralized Oracle Network typically result in single data points, which are then often reutilized by other protocols. As a result, <strong>the benefits of performing a Sybil attack might take the form of assets other than those used to execute the attack</strong>. Thus, even with a loss of confidence in a network, a Sybil attack might still be profitable.</p><p>Thus, we can categorize Sybil attacks by two distinct incentive motives:</p><ul><li>those aiming to manipulate the result of a data request</li><li>those aiming to attack the underlying blockchain consensus protocol.</li></ul><h4><strong>Manipulating the result of a data request</strong></h4><p>An attacker can <strong>manipulate a data request so as to manipulate the resulting consensus. </strong>Attackers might be incentivized to do this if:</p><ul><li>the attacker’s stake in a particular result is large enough (e.g. conditional payments)</li><li>the attacker aims to sabotage the reputation (and/or collateral) of other identities on the network.</li></ul><p>These attacks often take one of two forms:</p><ul><li><strong>Flash attacks: </strong>an attacker quickly spins up fresh Sybil identities and thus holds significant influence over the outcome of a data request</li><li><strong>Playbook attacks: </strong>the attacker must first play by the rules.<strong> </strong>The attacker creates numerous Sybil identities and then spends considerable time and resources pretending they are all honest identities. Once enough trust is gained, the attack is executed.</li></ul><h4><strong>Attacking the underlying blockchain consensus protocol</strong></h4><p>If the protocol has its own blockchain, an attacker may be willing to disrupt the underlying consensus algorithm, by gaining sufficient influence through Sybil identities. The attacker can choose either to create invalid blocks or to disrupt the network. Defending against this kind of attack relies heavily on the reliability and resilience of the protocol’s consensus algorithm.</p><h3><strong>Proposing a new alternative</strong></h3><p>As described in the post below, the Witnet protocol aims to be fair, accessible and fully parameterizable, whilst maintaining data integrity.</p><p><a href="https://medium.com/witnet/designing-a-decentralized-oracle-network-cad5c5855ba2">Designing a Decentralized Oracle Network</a></p><p>Sybil attacks pose a significant barrier to achieving these goals. As a result, the following precautions have been built into Witnet’s architectural design.</p><h4>An algorithmic reputation system</h4><p>Witnet does not use a Proof-of-Work (PoW) or a Proof-of-Stake (PoS) mechanism, and so cannot rely on upfront cost to prevent Sybil attacks. Instead, Witnet has built an algorithmic reputation system designed to <strong>incentivize nodes to execute data requests in an honest way</strong>.</p><p>In short, the system works by redistributing reputation points from outliers and cheaters to honest, active network participants. Identities are assigned data request tasks (alongside mining and reward privileges) in proportion to their overall reputation score — their track-record. Reputation is non-tradeable and is redistributed autonomously and algorithmically by the Witnet protocol.</p><p>Thus, if an attacker wants to perform a Sybil attack on the network, each Sybil identity must first perform tasks honestly (and gain sufficient reputation scores). This is a classic <strong>Playbook attack, </strong>and not easy, fast or cheap to coordinate.</p><h4><strong>Performance-based data request committees</strong></h4><p>As mentioned above, active identities with high reputation scores are more likely to be assigned to data request committees (and thus be rewarded). To achieve this, the Witnet protocol has:</p><ul><li><strong>an Active Reputation Set (ARS)</strong> tracking active identities in the system</li><li><strong>a Committee Selection Mechanism; </strong>a cryptographic algorithm for pseudo-randomly selecting committees based on reputation score.</li></ul><p>To calculate the ARS, the system tracks a metric that can determine if an identity is actively participating in data requests. The metric consists of all identities that have been selected for committees over a period of time (e.g. during the last 1000 epochs).</p><p>For committee selection, <strong>each identity computes its own eligibility based on a Verifiable Random Function (VRF)</strong>, which takes into account the identity’s current reputation score. If deemed eligible, the identity executes the data request and broadcasts a commitment to resolve it in a subsequent block.</p><p><a href="https://medium.com/witnet/cryptographic-sortition-in-blockchains-the-importance-of-vrfs-ad5c20a4e018">Cryptographic Sortition  in Blockchains: the importance of VRFs</a></p><h4>Selecting<em> block proposers in a fair way</em></h4><p>Each identity calculates its eligibility to mine a block, based on the number of identities on the network.<strong> Eligibility is randomized (using a VRF), and is unrelated to reputation at this stage</strong>. This aligns with Witnet’s goal of a low barrier to entry, since miners do not need expensive hardware, large amounts of capital, or a reputation track-record to participate.</p><p>However, this means the system is vulnerable to Denial of Service (DoS) attacks. If an attacker controls enough Sybil identities, they may propose empty blocks, and halt the network (Note: invalid blocks would be rejected by the network).</p><p>In order to mitigate against this vulnerability, the Witnet protocol enforces a minimum of <em>B</em> block candidates for each epoch. This parameter is termed <em>backup factor</em>. If there is more than one block proposer, the deadlock is resolved by selecting the block proposed by the identity with the highest reputation (so long as the block is valid).</p><h4>Collateral and coin age</h4><p>Thus far, we have decreased the probability of a successful Sybil attack on the network by ensuring:</p><ul><li>every Sybil identity must hold a high reputation within the network</li><li>Sybil identities cannot predict when they‘ll be elected to a data request committee</li><li>a set of Sybil identities cannot predict when they will hold sufficient reputation to perform an attack</li></ul><p>However, if an attacker can create infinite Sybil identities, the network is (theoretically) still vulnerable to both Flash and Playbook attacks. Therefore, Witnet has a combination of:</p><ul><li><strong>Witnessing collateral</strong>: data requests require that participating nodes stake collateral, in the form of Unspent Transaction Output (UTXO)</li><li><strong>Coin age</strong>: in order to be used as collateral, UTXO must have reached a certain age (i.e. recently created UTXO cannot be staked).</li></ul><p>The risk of Flash attacks can be drastically reduced by setting collateral requirements that are difficult to distribute among Sybil identities. Coin age makes it harder for an attacker to avoid detection when rapidly creating new identities, and makes it almost impossible to predict when a sufficiently high reputation score will be attained by each identity.</p><h4>Reputation shelf-life</h4><p>Even with the above precautions, the reputation system is still vulnerable to hoarding; an attacker may attempt to accumulate a significant portion of reputation points in their Sybil identities in order to perform an attack.</p><p>To prevent hoarding, the protocol has built-in <em>reputation shelf-life</em>, whereby <strong>reputation points expire and are redistributed after a certain time</strong>. Shelf-life is not determined by the passing of human time, but instead corresponds to the network’s velocity; higher velocity = higher volume of witnessing requests per block.</p><p>Thus, in order to maintain a high reputation, nodes will have to continuously contribute to the network by executing data requests in an honest manner. Additionally, given the stochastic nature of the cryptographic sortition, the reputation should continuously be flowing between nodes. It should not be easy to predict when nodes will have high reputation scores, so that it should be significantly hard for attackers to orchestrate a Playbook attack.</p><h4><strong>Recent updates</strong></h4><p>One of the issues with not using PoW or PoS is that node operators can spin up a vast number of nodes on the same device or IP, leaving the network vulnerable to crashing if one of the core servers goes down, and leaves the network more vulnerable to Sybil attacks. This is what happened in Testnet 9.0 during the <a href="http://testnet.witnet.io/join">Testnet Incentive Program Phase 2</a>, when ~35k nodes joined (and quickly forked) the network. You can read about <a href="https://medium.com/witnet/witnet-testnet-9-0b-a-victim-of-enthusiasm-and-scalability-issues-9-0c-and-9-1-coming-soon-cd4b3f604015">what happened here</a>.</p><p>To solve these scalability issues, Testnet 9.1 now has some key additional components:</p><ul><li><strong>Icing</strong> <br>If a node tries to connect to another node and fails (for example, the node is out of consensus or down), it will “freeze” that peer address for 24h. This makes the discovery of healthy peers much more efficient.</li><li><strong>Inbound Sybil rejection</strong> 👥<br>Each node will only accept incoming connections from diverse IP ranges, i.e. a connection from IP 1.2.3.4 will be rejected if it has already established a connection from 1.2.5.6. This guarantees a neutral view of the network consensus, and reduces the risk of your node going down if some unreliable but well-connected nodes fail.</li></ul><p>Not only do these updates solve the issues faced in T9.0, but they also make the network hyper-connected, since nodes will often be connected to many nodes in other IPs.</p><h3><strong>What’s next?</strong></h3><p>We’ve tried our darndest to design a secure and fair reputation system to deal with Sybil attacks, but they need to be tested in the wild!</p><p>The reputation system is already complete, and can be field-tested in Testnet 9.2, so feel free to try it out by following the link below:</p><p><a href="https://docs.witnet.io/try/run-a-node/">Run a Node - Witnet Protocol Documentation</a></p><p>If you have any issues, need any help, or have any questions, don’t hesitate to reach out on the Witnet Community’s <a href="https://t.me/witnetio">Telegram</a> or <a href="https://discordapp.com/invite/X4uurfP">Discord</a> channels</p><h3>Acknowledgements</h3><p>This post was written in collaboration with <a href="https://medium.com/@girazoki">Gorka</a>, <a href="https://medium.com/@claudia_6825">Claudia</a>, <a href="https://medium.com/@HelloImThomas">Thomas</a> and <a href="https://medium.com/@aesedepece">Adán</a>. However, we depend on countless discussions with the wider Witnet community and, as always, this post would have been impossible without you all! :)</p><h3>Find this useful? For more content like this, <a href="http://twitter.com/witnet_io">follow Witnet on Twitter</a> and keep up to date on <a href="http://medium.com/witnet">our blog</a>.</h3><h3>For more info:</h3><ul><li><a href="https://witnet.io/witnet-whitepaper.pdf">Read the Witnet whitepaper</a> 📃</li><li><a href="https://witnet.io/#/faq">Read the FAQs</a>❓</li><li><a href="https://t.me/witnetio">Join the community Telegram group</a> and <a href="https://discord.gg/QKEa5gU">Discord</a>. 💬</li><li><a href="https://twitter.com/witnet_io">Follow @witnet_io on Twitter</a> 🐦</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4d72436dc85" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/how-to-prevent-sybil-attacks-without-pow-pos-d4d72436dc85">How to prevent Sybil Attacks without PoW/PoS</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing our Verifiable Random Function (VRF) library in Solidity]]></title>
            <link>https://medium.com/witnet/announcing-our-verifiable-random-function-vrf-library-in-solidity-c847edf123f7?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c847edf123f7</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Mon, 22 Jul 2019 15:05:57 GMT</pubDate>
            <atom:updated>2019-07-22T15:05:57.117Z</atom:updated>
            <content:encoded><![CDATA[<h4>The first VRF implementation written in Solidity supporting fast and effective VRF proof verifications based on ECC</h4><p>Recently <a href="https://medium.com/u/b38bd2aa8aa0?source=post_page---------------------------">Gorka Irazoqui Apecechea</a> and me proudly published a <a href="https://www.npmjs.com/package/vrf-solidity">VRF Solidity library</a> as an <a href="https://github.com/witnet/vrf-solidity">open source project</a> under the MIT license.</p><p>The library is a <strong>fast</strong> and <strong>effective</strong> Verifiable Random Function (VRF) library written in <strong>Solidity</strong>, which follows the IETF standard <a href="https://www.ietf.org/id/draft-irtf-cfrg-vrf-04.txt">VRF-draft-04</a> authored by Sharon Goldberg, Moni Naor, Dimitris Papadopoulos, Leonid Reyzin, and Jan Včelák.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pzIGXaFGD-b0kb9gCag8Kg.png" /></figure><p>This library is the continuation of our work implementing several cutting-edge cryptographic primitives that power the critical components of the <a href="https://witnet.foundation/">Witnet</a> ecosystem. This is also the case of our <a href="https://github.com/witnet/elliptic-curve-solidity">Elliptic Curve Solidity library</a> and our <a href="https://github.com/witnet/vrf-rs">VRF Rust library</a>.</p><h3>What are VRFs?</h3><p>VRFs are cryptographic primitives that provide a <strong>pseudo-random function </strong>along with a <strong>publicly verifiable proof</strong> of its outputs’ correctness.</p><p>VRFs are widely used in various cryptographic schemes, protocols and systems. For example, the <strong>Witnet decentralized oracle network</strong> uses VRFs to conduct the <strong>secret cryptographic sortition</strong> that is used for selecting miners and witnessing committees<strong> </strong>as part of the underlying consensus protocol.</p><p>For more details about VRFs and why they are so important in current cryptographic systems, take a look into this previous post:</p><p><a href="https://medium.com/witnet/cryptographic-sortition-in-blockchains-the-importance-of-vrfs-ad5c20a4e018">Cryptographic Sortition  in Blockchains: the importance of VRFs</a></p><h3>Introducing the library</h3><p>vrf-solidity is a fast and effective implementation of Verifiable Random Functions (VRFs) written in Solidity. In the current0.1.0 version, the library implements verification functions for VRF proofs based on the secp256k1 elliptic curve.</p><p>The library provides two functions for verifying VRF proofs with different cost/security trade-offs.</p><ul><li><strong>verify</strong>: VRF proof <em>full</em> verification as described in the draft. It has a high associated gas cost as it requires heavy EC computations.</li><li><strong>fastVerify</strong>: VRF proof <em>fast</em> verification by providing additional EC points. It requires far less gas by leveraging the EVM’s ecrecoverprecompiled function to verify EC multiplications.</li></ul><p>Additionally, it provides three convenience functions that ease computation of the required input parameters:</p><ul><li><strong>decodeProof</strong>: decode from bytes to VRF proof.</li><li><strong>decodePoint</strong>: decode from bytes to EC point.</li><li><strong>computeFastVerifyParams</strong>: compute the parameters (EC points) required for the VRF fast verification function.</li></ul><p>The library implements theSECP256K1_SHA256_TAI cipher suite, i.e. the secp256k1 elliptic curve and the sha256 digest function.</p><h3>Example</h3><p>Solidity contracts can use theVRF.sol contract directly either by inheritance or by instantiating it:</p><pre>pragma solidity ^0.5.0;<br><br>import &quot;vrf-solidity/contracts/VRF.sol&quot;;<br><br><br>contract MyContract is VRF {<br><br>  function functionUsingVRF(<br>    uint256[2] memory _publicKey,<br>    uint256[4] memory _proof,<br>    bytes memory _message)<br>  public returns (bool)<br>  {<br>    bool isValid = verify(_publicKey, _proof, _message);<br>    // Do something...<br>    return isValid;<br>  }<br>}</pre><p>You can find more advanced examples in the Github repository:</p><p><a href="https://github.com/witnet/vrf-solidity">witnet/vrf-solidity</a></p><h3>Gas analysis</h3><p>Gas consumption analysis was conducted in order to understand the associated costs to the usage of the vrf-solidity library given the fact that VRFs primitives entail heavy EC operations.</p><p>We performed the gas consumption analysis on a contract inheriting from VRF.sol and wrapping that contract’s functions for different VRF primitives, labelled as _methodName.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*znPD7Gywi8WtnfRwxWM_cg.png" /><figcaption>Gas consumption and USD price estimation with a gas price of 20 Gwei, derived from <a href="https://ethgasstation.info/">ETH Gas Station</a>:</figcaption></figure><p>As aforementioned, the library provides two different verification functions with different trade-offs in terms of cost and security. The cost of the fastVerify() function is around 10% that of the verify() function, approximately 200k of gas, which is less than 1 USD with the current gas and ether prices.</p><p>The three convenience functions (decodeProof, decodePoint and computeFastVerifyParams) are provided in order to facilitate the computation of VRF required input parameters. If possible, they should be used as off-chain operations through a local call in order to avoid gas costs.</p><h3>Tests</h3><p>The vrf-solidity library has been tested against test vectors extracted from <a href="https://chuckbatson.wordpress.com/2014/11/26/secp256k1-test-vectors/">Chuck Batson</a> and the <a href="https://github.com/witnet/vrf-rs/">vrf-rs</a> with theSECP256K1_SHA256_TAI cipher suite.</p><p>Please take into consideration that VRFs are currently being standardized and there are not many (if any) resources with test vectors for our very same cipher suite.</p><h3>Acknowledgements</h3><p>We would want to acknowledge the following resources as they served as inspiration to increase the performance of some of the EC arithmetic operations:</p><ul><li>Vitalik Buterin’s post on <a href="https://ethresear.ch/t/you-can-kinda-abuse-ecrecover-to-do-ecmul-in-secp256k1-today/2384/9">Ethresearch</a></li><li>HarryR’s <a href="https://github.com/HarryR/solcrypto">SolCrypto library</a></li></ul><h3>Join us!</h3><p>Please take a look to our <a href="https://github.com/witnet/vrf-solidity">GitHub repository</a> and feel free to report issues, propose changes and contribute to the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c847edf123f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/announcing-our-verifiable-random-function-vrf-library-in-solidity-c847edf123f7">Announcing our Verifiable Random Function (VRF) library in Solidity</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing our own Elliptic Curve Cryptography in Solidity]]></title>
            <link>https://medium.com/witnet/announcing-our-own-elliptic-curve-cryptography-in-solidity-1df1c0ec90ef?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1df1c0ec90ef</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Mon, 08 Jul 2019 11:04:37 GMT</pubDate>
            <atom:updated>2019-07-08T11:04:37.253Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>A cost-efficient, ergonomic and generic crypto library written in Solidity</h4><p>Recently <a href="https://medium.com/u/b38bd2aa8aa0">Gorka Irazoqui Apecechea</a> and me proudly published an <a href="https://www.npmjs.com/package/elliptic-curve-solidity">Elliptic Curve Cryptography Solidity library</a> as <a href="https://github.com/witnet/elliptic-curve-solidity">open source project</a> under the MIT license.</p><p>But, why have we implemented our own crypto library? As you all know, developing your own crypto libraries is not usually encouraged. However, we found several reasons to do so:</p><ul><li><strong>Curve agnostic</strong>: we found out that most of the operations were generic for prime elliptic curves, so there was not special reason to particularize it to only one!</li><li><strong>Generic library:</strong> most libraries are widely used for key derivations or signatures validations. However, we needed elliptic curve operations for other crypto operations, e.g. for a library implementing <a href="https://www.ietf.org/id/draft-irtf-cfrg-vrf-04.txt">Verifiable Random Functions (VRFs)</a>.</li><li><strong>Homogeneous functions</strong>: we tried to have a clear distinction between arithmetic operations in Affine and Jacobian operations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vRn8PxdpnkPMe5cCpeuCQg.png" /></figure><h3>Introducing the library</h3><p>elliptic-curve-solidity is a cost-efficient, flexible and ergonomic library for Elliptic Curve arithmetic operations. It has been generalized in order to support any elliptic curve based on prime numbers up to 256 bits.</p><p>The library has been designed with only pure functions aiming at decreasing gas consumption as much as possible. It aims to be as complete as possible by providing the following operations.</p><ul><li><strong>Modular</strong>: inverse, exponentiation</li><li><strong>Jacobian</strong>: addition, double, multiplication</li><li><strong>Affine</strong>: inverse, addition, subtraction, multiplication</li><li><strong>Auxiliary</strong>: convert to affine, derive coordinate Y, point on curve</li></ul><p>The supported and tested curves are <em>secp256k1</em>, <em>secp256r1</em> (P-256), <em>secp192r1 </em>(P-192), and <em>secp224r1 </em>(P-224).</p><h3>Usage</h3><p>EllipticCurve.sol contract can be used directly by inheritance or by instantiating it. The following <a href="https://github.com/witnet/elliptic-curve-solidity/blob/master/examples/Secp256k1.sol"><em>Secp256k1</em></a> example depicts how to inherit the library by providing a function to derive a public key from a secret key:</p><pre>pragma solidity ^0.5.0;</pre><pre>import &quot;./EllipticCurve.sol&quot;;</pre><pre>contract Secp256k1 is EllipticCurve {</pre><pre>  uint256 constant GX = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798;<br>  uint256 constant GY = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;<br>  uint256 constant PP = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F;<br>  uint256 constant AA = 0;<br>  uint256 constant BB = 7;</pre><pre>  function derivePubKey(uint256 privKey) public pure returns(uint256 qx, uint256 qy) {<br>    (qx, qy) = ecMul(<br>      privKey,<br>      GX,<br>      GY,<br>      AA,<br>      PP<br>    );<br>  }<br>}</pre><h3>Benchmark — gas analysis</h3><p>The repository includes a thorough <a href="https://github.com/witnet/elliptic-curve-solidity/blob/master/benchmark/GAS.md">gas consumption analysis</a> of all library functions.</p><p>As illustrative example, the cost of a key derivation operation in <em>Secp256k1</em> is around 550k gas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*e5YQ5-ocBfkT2L0PVqq3zg.png" /><figcaption>Gas consumption of key derivation operation on curve Secp256k1</figcaption></figure><h3>Acknowledgements</h3><p>We want to thank the following resources and authors, on which our library has been inspired:</p><ul><li><a href="https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf">Comparatively Study of ECC and Jacobian Elliptic Curve Cryptography</a> by Anagha P. Zele and Avinash P. Wadhe</li><li><a href="https://github.com/jbaylina/ecsol/">Ecsol</a> written by Jordi Baylina</li><li><a href="https://github.com/androlo/standard-contracts">Crypto</a> written by Andreas Olofsson</li></ul><h3>Contribute to the project!</h3><p>Please take a look to our <a href="https://github.com/witnet/elliptic-curve-solidity">GitHub repository</a> and feel free to report issues, propose changes and contribute to the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1df1c0ec90ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/announcing-our-own-elliptic-curve-cryptography-in-solidity-1df1c0ec90ef">Announcing our own Elliptic Curve Cryptography in Solidity</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing our Verifiable Random Function (VRF) Rust library]]></title>
            <link>https://medium.com/witnet/announcing-our-verifiable-random-function-vrf-rust-library-2e042c29a4f7?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e042c29a4f7</guid>
            <category><![CDATA[witnet]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[rust]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Mon, 03 Jun 2019 15:03:50 GMT</pubDate>
            <atom:updated>2020-08-07T10:22:35.888Z</atom:updated>
            <content:encoded><![CDATA[<h4>A fast and extensible Verifiable Random Function (VRF) library, which currently supports some of the most widely used elliptic cipher suites.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vR6uiqL7cuau53-vU9vHLw.png" /></figure><p>Recently <a href="https://medium.com/u/b38bd2aa8aa0">Gorka Irazoqui Apecechea</a> and I proudly published a <a href="https://crates.io/crates/vrf">VRF crate</a> as an <a href="https://github.com/witnet/vrf-rs">open source project</a> under the MIT license.</p><p>The library is a <strong>fast</strong>, <strong>flexible</strong> and <strong>general-purpose</strong> Verifiable Random Function (VRF) library written in Rust, which follows the IETF standard <a href="https://www.ietf.org/id/draft-irtf-cfrg-vrf-04.txt">draft</a> written by Sharon Goldberg, Moni Naor, Dimitris Papadopoulos, Leonid Reyzin, and Jan Včelák.</p><p><a href="https://crates.io/crates/vrf">Cargo: packages for Rust</a></p><h3>Introducing the vrf-rs library</h3><ul><li><a href="https://tools.ietf.org/html/rfc6979">RFC6979</a> for the nonce generation functionCurrently the supported cipher suites use the <strong><em>SHA256</em></strong> hashing algorithm and the following elliptic curves: <strong><em>secp256k1</em></strong>, <strong><em>secp256r1</em></strong><em> and </em><strong><em>sect163k1.</em></strong></li></ul><p>The library was written with the idea of being <strong>extensible</strong> so that additional cipher suites and algorithms can easily be added by implementing the trait <em>VRF</em>.</p><ul><li><a href="https://tools.ietf.org/html/rfc6979">RFC6979</a> for the nonce generation functionCurrently the supported cipher suites use the <strong><em>SHA256</em></strong> hashing algorithm and the following elliptic curves: <strong><em>secp256k1</em></strong>, <strong><em>secp256r1</em></strong><em> and </em><strong><em>sect163k1.</em></strong></li></ul><pre>use vrf::openssl::{CipherSuite, ECVRF};<br>use vrf::VRF;</pre><pre>fn main() {<br>    // Initialization of VRF context by providing a curve<br>    let mut vrf = ECVRF::from_suite(CipherSuite::SECP256K1_SHA256_TAI).unwrap();<br>    // Inputs: Secret Key, Public Key (derived) &amp; Message<br>    let secret_key =<br>        hex::decode(&quot;c9afa9d845ba75166b5c215767b1d6934e50c3db36e89b127b8a622b120f6721&quot;).unwrap();<br>    let public_key = vrf.derive_public_key(&amp;secret_key).unwrap();<br>    let message: &amp;[u8] = b&quot;sample&quot;;<br>    <br>    // VRF proof and hash output<br>    let pi = vrf.prove(&amp;secret_key, &amp;message).unwrap();<br>    let hash = vrf.proof_to_hash(&amp;pi).unwrap();</pre><pre>    // VRF proof verification (returns VRF hash output)<br>    let beta = vrf.verify(&amp;public_key, &amp;pi, &amp;message);<br>}</pre><p>A complete example can be found in <a href="https://github.com/witnet/vrf-rs/blob/master/examples/basic.rs">examples/basic.rs</a></p><h3>What is a VRF?</h3><p>A VRF is a cryptographic primitive that provides a <strong>pseudo-random function </strong>along with a <strong>publicly verifiable proof</strong> of its outputs’ correctness. Additionally, the<strong> VRF hash output is deterministic</strong>, in the sense that it always produces the same output given the same pair of inputs. VRF were firstly introduced by <a href="https://pdfs.semanticscholar.org/edad/8f917b827e6c493511a1dcc07037f1c90a2e.pdf">Micali, Rabin and Vadhan in 1999</a>.</p><p>It can be better understood as the public-key version of a keyed cryptographic hash. Only the holder of the VRF secret key is able to compute a valid hash (i.e. pseudo-random value), while anyone with the public can verify its correctness.</p><h3>Why VRFs?</h3><p>VRFs are widely used in various cryptographic schemes, protocols and systems. Similarly to Algorand, the <strong>Witnet network protocol</strong> uses VRFs to conduct <strong>secret cryptographic sortitions</strong> which are used for the leader and <strong>committee selections</strong> as part of the underlying consensus protocol. Cryptographic sortition allows Witnet blockchain to be secure while being efficient and scalable.</p><h3>Contribute with us!</h3><p>Please take a look to our <a href="https://github.com/witnet/vrf-rs">GitHub repository</a> and feel free to report issues, propose changes and contribute to the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e042c29a4f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/announcing-our-verifiable-random-function-vrf-rust-library-2e042c29a4f7">Announcing our Verifiable Random Function (VRF) Rust library</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a Decentralized Oracle Network]]></title>
            <link>https://medium.com/witnet/designing-a-decentralized-oracle-network-cad5c5855ba2?source=rss-8a44dd95825c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cad5c5855ba2</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Mario Cao]]></dc:creator>
            <pubDate>Thu, 14 Mar 2019 11:52:24 GMT</pubDate>
            <atom:updated>2019-03-14T11:52:24.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>Designing a Decentralized Oracle Network (DON)</h3><h4>The insights of how Witnet wants to serve your unstoppable smart contracts!</h4><p>In this article, we’ll take a look at the <strong>main principles and goals we have followed to design Witnet</strong>, the first truly Decentralized Oracle Network (DON). This is the first of several articles that aim to clarify how we envision our solution and how we tackle most of the challenges we found in the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tvIHB6s6P_Goxygxt7zePA.jpeg" /><figcaption>Consulting the Oracle by John Waterhouse</figcaption></figure><h3>Why does a blockchain need an oracle?</h3><p>The main goal of the Witnet protocol is to <strong>connect smart contracts to any external data source in a trustless way</strong>. In order to better understand the fundamentals about oracles, we encourage you to take a look to some of our previous posts:</p><ul><li>I<a href="https://medium.com/witnet/witnet-smart-contracts-with-real-power-f79e326da3a4">ntroducing Witnet: smart contracts with real power</a></li><li><a href="https://medium.com/witnet/why-smart-contracts-shouldnt-trust-the-messenger-a26d1659f7b3">Why Smart Contracts Shouldn’t Trust the Messenger</a></li><li><a href="https://medium.com/witnet/why-do-we-need-a-decentralized-oracle-network-91ba455d074d">Why do we need a Decentralized Oracle network?</a></li></ul><p>They describe how <strong>DONs overcome some of the current limitations of all smart contract platforms</strong> and why they bring unprecedented innovation by unblocking new and disruptive use cases.</p><p>Additional information can be found in our<a href="https://medium.com/witnet/witnet-must-reads-digest-b8d26a909efb"> Witnet Must-Reads Digest</a>.</p><h3><strong>But, why does an oracle need a blockchain?</strong></h3><p>Having its own blockchain allows a DON to be independent from exogenous factors and uncertainties from other chains (e.g. fluctuation in transaction fees). In that way, it provides a higher degree of freedom to put in place several incentive mechanisms. For example, a reputation system may be painfully expensive if implemented as on-chain contracts on a stateful, non-sharded smart contract platform.</p><p>Additionally, it is never sensible to tie the fate of our protocol to the responsiveness of external designs to ever-evolving challenges.</p><h3>Design goals (and core values)</h3><p>As any other blockchain, Witnet protocol aims to guarantee the common properties such as safety, liveness and fault tolerance. Yet, we would like to focus on the design goals that make Witnet different from other solutions.</p><h4>Fairness</h4><p>We envision this project as a protocol for everybody, thus, one of the main characteristics the protocol will need to achieve is fairness. We have seen many examples of decentralized protocols in which competition between peers is somehow unfair in terms of hardware capabilities or initial stake. Aiming at balancing the data request serving opportunities of all nodes (either newcomers or highly reputed), we have designed Witnet with two sharp ideas in mind:</p><ul><li><strong>Low barriers to entry for new nodes</strong>. This means that new nodes do not need to stake a significant monetary amount nor invest in expensive hardware to become eligible to resolve data requests or mining. Nodes will compete with each other with respect to their reputation, which can be easily gained by behaving honestly (not tampering with the data).</li><li><strong>Anti-hoarding.</strong> Spurious incentives may appear if Witnet allowed a perpetuation in the power of the most reputed nodes. These could be bribed to lie in specific data requests for which they could prove valid eligibility. Further, and very related to our previous point, we would like <strong>Witnet to allow anyone to potentially become a reputed node</strong>.</li></ul><h4>Data Integrity</h4><p>As a decentralized oracle solution, Witnet’s main goal is to provide smart contracts with unaltered data from the data sources that witnesses are requested to query. Note that the former is very different from providing the truth: Witnet is not designed to guarantee that the provided answer to a question is a true fact (e.g. <em>the temperature in Madrid is 25 degrees</em>), but rather to guarantee that the provided information is representative (after applying aggregation, filtering and consensus functions defined in the request) of the response the queried sources gave to the query (e.g., <em>according to weather.com the temperature in Madrid is 25 degrees</em>). In order to minimize the potential differences between “the truth” and the provided data point, the data retrieval has the following characteristics:</p><ul><li><strong>Agreed upon consensus, </strong>i.e., the final result of a data request is not given by an individual node but is the result of a consensus achieved by several data retrievals made by a randomly selected group of nodes.</li><li><strong>Multi-source fact checking</strong>, i.e., the protocol offers the possibility to consult many data sources and aggregate their responses before reaching a consensus.</li><li><strong>Economically incentivized, </strong>since honest nodes are rewarded while dishonest ones are penalized.</li><li><strong>Deters conflicts of interest, </strong>provided by clear segregation of duties among all the actors involved in data request life cycles.</li></ul><h4><em>Fully parameterizable</em></h4><p>Last but not least, we envision a decentralized oracle solution that should be as parameterizable as possible. The main goal is to make the platform is flexible enough to enable as many use cases as possible, which may require different types of setups, incentives and trade-offs.</p><p>Some examples about this parameterization are:</p><ul><li><strong>Tailored data requests retrieval and aggregation</strong>: clients define programatically how the results of one or multiple sources are retrieved, aggregated and verified.</li><li><strong>Tailored data request consensus</strong>: additionally, clients also include the tally clauses in order to programmatically define how to turn the multiple data request results provided by witnesses into a single data point.</li><li><strong>Parameterizable incentives</strong>: honest resolution of data requests is incentivized by using several mechanisms which can be configured and fine tuned to achieve a specific degree of certainty and security.</li></ul><p>Some examples for these customizable incentives are:</p><ul><li><strong>Data request reward</strong>, incentivize the honest behavior of the nodes resolving the data request (a.k.a. <em>the witnesses</em>)</li><li><strong>Number of witnesses</strong>, i.e. how many nodes we want the data request to be executed by</li><li><strong>Network fees</strong>, incentives to the network to include the transactions that are required for the data request lifecycle into subsequent blocks</li><li><strong>Collateral and coin age</strong>, guarantee the neutrality and honesty of data request committees (prevents sybil attacks)</li></ul><p>Ironically, even if all of these customizable incentive mechanisms contribute to make Witnet an exceptionally robust design , <strong>one of the main virtues of this system lays indeed in what is not parameterizable: the committee selection</strong>. In Witnet, committee members (the nodes in charge of resolving a specific data request) are selected unpredictably through Verifiable Random Functions (VRF) weighted by the participants’ reputation scores. That is, the more reputed your node is, the more committees it will end up sitting on.</p><h3>Closing Thoughts</h3><p>As often happens with decentralized systems, challenges and technical solutions tend to be quite complex. This may lead to solutions that lack the core values we like to imprint into our work . At Witnet, we are committed to building a decentralized oracle network that is as <strong>customizable </strong>as possible, while preserving <strong>fairness</strong> and guaranteeing <strong>data integrity</strong>.</p><p>As a consequence, these design goals are having a positive and direct impact in most of our research and technical activities. In soon to be published posts we will be describing how we tackle different security challenges and how we solve the most known attacks. Stay tuned for them! :)</p><h4>Thanks you for dropping by!</h4><p>For more detailed information about our design goals, please check out our talk at <a href="https://ethcc.io/">EthCC 2019</a> presented by <a href="https://medium.com/@aesedepece">Adán</a> (Tech Lead @ Witnet).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fv9LbPwK5Tx8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dv9LbPwK5Tx8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fv9LbPwK5Tx8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/46dbe0fcd0f3aae5c3f1450e4e788027/href">https://medium.com/media/46dbe0fcd0f3aae5c3f1450e4e788027/href</a></iframe><p>Please let us know if you have any questions or comments below. You can <a href="http://twitter.com/witnet_io">follow Witnet on Twitter</a> and stay up to date on <a href="http://medium.com/witnet">our blog</a>.</p><p>Thanks to <a href="https://medium.com/@gorka_40018">Gorka</a> and <a href="https://medium.com/@aesedepece">Adán</a> for contributing to the post! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cad5c5855ba2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/witnet/designing-a-decentralized-oracle-network-cad5c5855ba2">Designing a Decentralized Oracle Network</a> was originally published in <a href="https://medium.com/witnet">The Witnet Oracle Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>