<?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 Gert-Jaap Glasbergen on Medium]]></title>
        <description><![CDATA[Stories by Gert-Jaap Glasbergen on Medium]]></description>
        <link>https://medium.com/@gertjaap?source=rss-815e56bf90c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LzpGyQwInUXoGpMj3nsyFQ.jpeg</url>
            <title>Stories by Gert-Jaap Glasbergen on Medium</title>
            <link>https://medium.com/@gertjaap?source=rss-815e56bf90c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 10:30:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gertjaap/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[Who is Monitoring Mining Pools?]]></title>
            <link>https://medium.com/mit-media-lab-digital-currency-initiative/who-is-monitoring-mining-pools-65de79b90710?source=rss-815e56bf90c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/65de79b90710</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[mining-pool]]></category>
            <category><![CDATA[proof-of-work]]></category>
            <dc:creator><![CDATA[Gert-Jaap Glasbergen]]></dc:creator>
            <pubDate>Fri, 21 Aug 2020 15:30:26 GMT</pubDate>
            <atom:updated>2020-08-21T15:30:26.299Z</atom:updated>
            <content:encoded><![CDATA[<p>One of our goals at the <a href="https://dci.mit.edu/">Digital Currency Initiative</a> is to harden the security of cryptocurrency networks. Most users of cryptocurrency take the actual network protocol and all of its implementation — mining, pools, validation, messaging, and more — for granted, and aren’t necessarily aware of all the ways these mechanisms might be attacked or fail. For example, though mining pools are a huge part of Bitcoin’s network security, there isn’t any available public monitoring to make sure that mining pools are well-behaved. There isn’t even a standard way to look at what pool operators are doing or infrastructure to keep tabs on pool operators.</p><blockquote>This is an example of what we call <em>protocol risk</em>: cryptocurrencies are only as secure as their networks. If a network is insecure, it can become unusable or users could lose their money. Businesses and users who are deeply invested in cryptocurrency should understand how to evaluate and mitigate this risk.</blockquote><h3>Review of mining</h3><p>In Bitcoin and other proof-of-work cryptocurrencies, miners secure the network by using their computational resources (usually ASICs or GPUs) to compete for block rewards. In total, these resources are known as the <em>network hashrate</em>, which is the rate at which all the mining equipment operating in the network can execute the cryptocurrency’s hash function. Bitcoin and other longest-chain protocols rely upon the distribution of hashrate among miners for security; if an attacker can obtain a majority of the network hashrate, they can mine an alternative chain that will become the network’s longest chain and they can double spend. We’ve seen this happen ourselves on five occasions on <a href="https://dci.mit.edu/51-attacks">several low-hashrate cryptocurrencies to date</a>. Most recently there were multiple attacks on Ethereum Classic, where attackers took several million dollars worth of money from their victims.</p><p>The hashrate of the biggest cryptocurrencies has grown very high — in Bitcoin the network completes 2⁷⁶ hashes every ten minutes. As a solo miner, it will likely take you a very long time to find a block and collect your rewards — using a cutting-edge miner today, it will take on average 19 years to find a block. But miners make an up-front investment in equipment and have to pay power costs; they often can’t wait that long for income.</p><p>In order to reduce this variance in rewards, miners combine their hashrate together in <em>mining pools</em> and split the rewards according to how much hashrate each miner contributes. The <a href="https://bitcointalk.org/index.php?topic=1976.0">first mining pool</a> was established in 2010. Mining pools work as follows: Miners register for a pool with a payment address, usually through a website, and point their miner towards the pool. The mining pool operator distributes work to miners (making sure they don’t do overlapping work) and has the responsibility of accounting how much work each miner performed. <em>Work</em> is a version of a block header with a transaction that pays the mining pool operator; the miner tries different nonces. A miner gives the pool operator <em>shares</em> which are mined block headers that hash to low values, but not low enough to meet the blockchain’s difficulty target; this is evidence to the pool operator of the miner’s hashrate. When a miner finds a share low enough to meet the difficulty target, they report it to the pool operator, who attaches it to the block and gossips it to the network. The pool then distributes the block reward to all the miners proportionally to the work each miner did.</p><p>Mining pools in Bitcoin make up the vast majority of the total Bitcoin hashrate. Generally somewhere between 4–8 mining pools comprise a majority of the hashrate. They’re a critically important part of Bitcoin’s security.</p><h3>What exactly are the pools mining?</h3><p>In existing mining pool software, the mining pool operator chooses and distributes the work: miners do not get to choose what block contents to mine. In fact, miners only get the block headers, not the transactions that form the block. This is in contrast to solo mining, where the miner runs their own full node and chooses their own transactions for a new block, and new mining pool protocols like Stratum v2 where the miner can have a say in what they mine. But right now, miners pretty much mine whatever they are given.</p><p>This is risky: pool operators control large amounts of network hashrate, and could conduct attacks like <a href="https://en.wikipedia.org/wiki/Double-spending">double spending</a> and <a href="https://arxiv.org/abs/1311.0243v5">selfish mining</a> without the miners even knowing it. Or, a pool operator could redirect a miner’s hashrate to a different coin with the same algorithm.</p><p>A miner decides what pool their hardware connects to, and pool operation is competitive: miners can leave and join pools whenever they like. So miners could abandon a pool for bad behavior, and in fact, this has happened in the past when miners decided to leave Ghash.io after it accumulated more than 50% of the Bitcoin hashrate. But how do miners even learn about bad behavior?</p><h3>Introducing Pool Detective</h3><p>In order to address the risk that mining pool operators could go rogue, DCI developed Pool Detective. The idea is simple: We join all the public mining pools and monitor what they’re doing, making sure it matches the work we’d expect to see. We add a proxy server between our own mining hardware and each mining pool in order to archive the jobs the mining pool instructs our hardware to perform, and the work we produced in return. We are currently mining in 32 pools across 17 cryptocurrencies. We also run full nodes for each of the cryptocurrencies we monitor, as well as block observers which connect to full nodes and listen for block propagation messages in five different locations around the globe. This gives us an overall view of the network and we can detect things like delayed blocks or spy mining by seeing when our observers find out about blocks as compared to when our miners switch work in the pools.</p><p>The protocol over which miners and pools talk to each other is called <a href="https://en.bitcoin.it/wiki/Stratum_mining_protocol">Stratum</a>. We’ve built a Stratum proxy server that connects to all of the 32 upstream pools, and receives jobs to work on which it archives in a database. It then acts as a stratum server to our mining hardware, using a single miner per mining algorithm to produce valid work for these pools.</p><p>Mining pools usually disconnect miners that don’t produce work, so in order to do our monitoring we actually have to run mining hardware as well. In addition to monitoring, we’re also contributing useful work, honestly mining in each of the individual pools.</p><p>We’ve been running this system since November 2019, and are collecting the work pools give out and how and when new blocks are gossiped on the peer-to-peer networks. We are then analyzing this data for unexpected behavior and anomalies. The mining jobs that the pool sends us contain a number of interesting aspects that we can correlate to the data we observe using our full node, for instance:</p><p><strong>Block hash</strong></p><p>Each job contains the hash of the block it’s trying to build on top of. This should be the publicly known tip of the blockchain (i.e., the most recent Bitcoin block on the chain with the most work), since that’s the chain we want to extend with the new block we’re trying to find. If this is not the tip of the chain we’re mining, it could indicate a number of things:</p><ul><li>If we don’t know this block hash at all, then the mining pool is potentially engaging in selfish mining. The network doesn’t yet know about the block that we’re working on.</li><li>If we’ve seen this block on a different blockchain, then the pool could be mining on a different chain than the one we expect. For example, a pool advertised as mining BTC might direct some hashrate to BSV, perhaps because the reward is more favorable. This is possible because Bitcoin and Bitcoin SV share the same proof-of-work function, SHA256, and thus the same type of hardware is effective at mining both.</li></ul><p><strong>Coinbase transaction</strong>.</p><p>The first transaction in every block is the pool operator paying rewards to themselves. This transaction is included in the job sent to the miner, allowing the miner additional space to put random data (nonce space) while mining. This transaction contains identifying information such as which key the rewards are paid to. Linking blocks in the blockchain to mining pools is generally done by looking at the payout address of the coinbase transaction. It also contains various marker data that can be used to identify the mining pool. It is possible to link blocks from the blockchain to these mining jobs using this identifying information. Mining pools could decide to include an unknown pay-out address (that they still control) and/or the marker of a different mining pool — to attribute blocks to a different pool or to “unknown” hashrate. While this might seem far-fetched, it’s a possibility allowing pools to conceal their true hashrate. It is risky for a single pool to dominate the hashrate of a coin since users are at risk of double spends and the miners might leave, but there’s economic incentive to do this if the pool operator can get away with it: more miners means more income to the pool.</p><p><strong>Merkle proof of the coinbase transaction.</strong></p><p>The block header of each block contains a cryptographic proof that commits to all the transactions in the block. Since miners change the coinbase transaction to use the extra nonce space, they need more of the Merkle tree to re-calculate this proof after the transaction is altered. We can learn a few things from his merkle proof in the mining job:</p><ul><li>We can take the same Merkle proof from blocks on the chain to see which jobs included the same transactions (besides the coinbase) as the block that ended up being appended to the ledger.</li><li>We can identify mining pools that mine on empty blocks (blocks with only a coinbase transaction), because the Merkle proof will be empty. From this, we can see how often and how long mining pools ask their miners to mine empty blocks, and evaluate if this is longer than it absolutely needs to be. Mining empty blocks is unhealthy for the network because it decreases total throughput.</li></ul><h3>Moving forward</h3><p>Mining pools play a vital role in the security of proof-of-work networks and therefore deserve to be monitored more closely than individual miners currently do. Pool Detective is already uncovering threats, and we’ve just started. With more resources, we’d expand our work in the following ways to effectively monitor more networks at scale and monitor more operations:</p><ul><li><strong>Monitor more messages on the P2P networks.</strong> Right now we’re just monitoring blocks. If we saved and analyzed all messages on the P2P network, we could create a way to detect things like transaction censorship and mempool attacks, which could be important once Lightning is more widely deployed. The information on the P2P network, observed from multiple places, can help us understand what kind of work we should expect our miners to receive. We can match that against what we actually receive to search for anomalies.</li><li><strong>Design a compact, self-hosted Pool Detective so more miners can monitor</strong>. Ideally, everyone could run this for themselves. We think we can create a way for individual miners to monitor, ensuring they’re mining on top of the expected chain tip — and if not, report or switch to a different pool.</li><li><strong>Add more proof-of-work networks</strong>. In order to reliably identify unknown or suspicious blocks from mining pools (especially pools from hash rental markets) we need to rule out that the work is not from a lesser-known (but valid) proof-of-work chain. This means adding and maintaining more cryptocurrency nodes.</li><li><strong>Educate the community.</strong> People aren’t necessarily talking about these risks yet, but they will as the ecosystem grows. We need to better explain the potential attacks that could happen, how they affect businesses built on Bitcoin and other digital assets, and how monitoring and detection can help mitigate them. We intend to help quantify this risk and cultivate awareness of it.</li></ul><p>We’re currently in the process of analyzing all the data we’ve collected and are moving forward with three immediate next steps:</p><ol><li>We found and reported unexpected mining behavior in one of the top mining pools. We expect to have a report ready to share soon.</li><li>We’re working on a video series explaining this work in more detail. Follow the DCI on Twitter (<a href="https://twitter.com/mitdci">@mitdci</a>) or subscribe to our <a href="https://www.youtube.com/channel/UCJkYmuzqAnIKn3NPg5lc0Wg">YouTube channel</a> to be notified when episodes are posted.</li><li>We’re working on analyzing all our data and sharing it through a public website which will allow anyone to query our dataset through an API. Work in progress can be seen at <a href="https://www.pooldetective.org/">https://pooldetective.org</a>.</li></ol><p>If you have any suggestions or ideas, feel free to leave a comment below or reach out to <a href="/service/mailto:pooldetective@mit.edu">pooldetective@mit.edu</a>.</p><p><em>Pool Detective is one part of </em><a href="http://dci.mit.edu/security"><em>a comprehensive effort</em></a><em> at DCI to improve the security and robustness of global cryptocurrency networks. Please reach out if you’re interested in learning more or </em><a href="https://dci.mit.edu/support-our-work"><em>supporting our work</em></a><em>.</em></p><p><em>Authors: </em><a href="/service/mailto:gertjaap@mit.edu"><em>Gert-Jaap Glasbergen</em></a><em>, </em><a href="/service/mailto:narula@mit.edu"><em>Neha Narula</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65de79b90710" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mit-media-lab-digital-currency-initiative/who-is-monitoring-mining-pools-65de79b90710">Who is Monitoring Mining Pools?</a> was originally published in <a href="https://medium.com/mit-media-lab-digital-currency-initiative">MIT Media Lab Digital Currency Initiative</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discreet Log Contracts: invisible smart contracts on the Bitcoin blockchain]]></title>
            <link>https://medium.com/@gertjaap/discreet-log-contracts-invisible-smart-contracts-on-the-bitcoin-blockchain-cc8afbdbf0db?source=rss-815e56bf90c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc8afbdbf0db</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Gert-Jaap Glasbergen]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 13:27:50 GMT</pubDate>
            <atom:updated>2018-06-30T13:27:50.418Z</atom:updated>
            <content:encoded><![CDATA[<p>On May 19, 2018, MIT’s Digital Currency Initiative and Fidelity Labs and organized the Layer 2 Summit in Boston. During this event, two people from the DCI, <a href="https://twitter.com/tdryja">Tadge Dryja </a>(Research Scientist) and <a href="https://twitter.com/gertjaap">Gert-Jaap Glasbergen</a> (Software Developer), gave a <a href="https://www.youtube.com/watch?v=2VAPotcB9Dc">presentation and demonstration</a> on Discreet Log Contracts. The <a href="https://adiabat.github.io/dlc.pdf">paper</a> on Discreet Log Contracts is written by Tadge Dryja and published in 2017.</p><p>In this blog post, we’ll try to further explain what Discreet Log Contracts are, how they work, and what the next steps are if you’re interested in leveraging this technology.</p><h4><strong>What are Discreet Log Contracts?</strong></h4><p>By creating a Discreet Log Contract, Alice and Bob can form a monetary contract redistributing their funds to each other, based on preset conditions, without revealing any details of those conditions to the blockchain. Alice and Bob both commit funds to the contract, but its appearance on the blockchain will be no different than an ordinary multi signature output. Therefore the contract is discreet in the sense that no external observer can learn its existence or details from the public ledger.</p><p>This contract depends on an external entity or entities, known as an <em>oracle, </em>that publishes a signed message at some point in the future (before the expiration of the contract). The contents of this signed message determine the division of the funds committed to the contract.</p><p>Oracles are not aware of the contracts or people using its data, they independently publish their signed messages according to a preset schedule. These signatures are incorporated into the contract by Alice and Bob, without the oracle being aware of them using it.</p><p>Because the oracle is not aware of specific contracts using the data, it is not able to decide the outcome of a specific contract. This is an important difference from a situation where the oracle is the third party in a 2-of-3 multi signature setup.</p><p>Oracles provide the connection between the blockchain and the external world — and are therefore trusted to provide accurate data. There are ways to minimize the dependency on this trust, which we’ll discuss later.</p><p>Using Discreet Log Contracts, the signature published by the oracle gives each participant of the contract the possibility to claim the amount from the contract that is due him or her without the need for cooperation from the other party.</p><h4>How can I use Discreet Log Contracts?</h4><p>The most obvious use case for Discreet Log Contracts, which is also described in the paper, is a bitcoin-settled forward contract. Forward contracts are customized contracts between two parties to buy or sell an asset at a specified price on a particular date in the future. Forwards are a very common instrument to hedge against volatility. So using US Dollar forwards someone can hedge the volatility in the US Dollar to bitcoin exchange rate. Clearly, this can be used to hedge other currencies as well, such as Yen, Euros, or Rubles.</p><p>You could also engage in forwards on other assets like gold, wheat, coffee. As long as there is an oracle that publishes a price, you can build forward contracts on that using Discreet Log Contracts.</p><p>This opens up huge opportunities for a bitcoin economy. Since the main reason for businesses not to go with bitcoin as their base currency is that their purchases are all in fiat, and they can’t risk the volatility of bitcoin against that. A forward contract in essence can provide a solution to that problem. By engaging in a forward contract, you can preserve the fiat-value of (parts of) your bitcoin holdings.</p><h4>Example: US Dollar forward contract</h4><p>For instance: Alice can engage in a US Dollar forward contract with Bob. Alice agrees to buy 5000 US Dollar from Bob, at 12500 satoshi (=0.000125 BTC) per Dollar, which equals 8000$ per BTC, on the last Friday of the month at 5:00 PM. In this example, the US Dollar is the ‘asset’, and the price is denominated in bitcoin.</p><p>Alice engages in this contract because she has future obligations to deliver US Dollar (for instance: to pay bills), and wants to mitigate the volatility risk. This contract will entitle her to 5000 US Dollar at the time the contract expires, regardless of the US Dollar to bitcoin exchange rate at that time.</p><p>On the other hand, Bob expects the value of bitcoin to increase, hence he expects the market rate for 5000 US Dollar in bitcoin to be lower than what Alice agreed to pay. Bob engages in this contract to turn a profit at the time the contract expires.</p><p>Since the contract is bitcoin-settled this means that, like cash-settlements in normal asset forwards, instead of Bob actually delivering US Dollars to Alice, parties will pay each other the difference between the agreed price and the market price in bitcoin.</p><p>So if the US Dollar appreciates, Bob will have to pay Alice the difference. Similarly, if the US Dollar depreciates, Alice will have to pay Bob.</p><p>Alice and Bob commit the funds for paying each other upfront. This payment is locked in a 2-of-2 multi signature output that is controlled by Alice and Bob’s private keys. Before committing the funds, they exchange the transactions necessary for spending the funds based on the values the oracle will announce. This way, before committing the funds, they know the funds they are entitled to can be retrieved. This also means that the payment is limited to the amount both parties agree to lock up in the contract.</p><h4>How does it work?</h4><p>In our previous example:</p><blockquote>Alice agrees to buy 5000 US Dollar from Bob, at 12500 satoshi (or 0.000125 BTC) per Dollar (which equals 8000$ per BTC), on the last Friday of the month at 5:00 PM</blockquote><p><strong>Step 1: Find an oracle.</strong> The first thing we need, is an oracle that will publish the value of the US Dollar, measured in satoshi, on the last Friday of the month at 5:00 PM. This oracle provides the public key with which it will sign this message.</p><p><strong>Step 2: Create funding transaction. </strong>The parties will then construct a transaction funding the contract from the coins in their wallets. Both parties contribute the same amount of coin into the contract. The contract will be a 2-of-2 multi signature output, meaning both Alice and Bob will have to sign any transaction that spends from it. The contract is funded with <em>[asset quantity * asset price]</em> , so in this case 5,000 * 0.00125 = 0.625 BTC each.</p><p>Using the exchanged outpoint information, both parties can create one single transaction that funds the contract from both their wallets at once. Eventually they will have to sign their respective inputs to that transaction, but they don’t do that yet. Now that the transaction is created though, the transaction ID can be determined. Since the signatures are not part of the ID, signing it won’t change that ID.</p><p>Since we now know the ID of the funding transaction, we can already craft transactions that spend from the contract without it actually being on the blockchain, which is exactly what the next step is.</p><p><strong>Step 3: Create all possible execution transactions. </strong>For each possible value the oracle can publish, a Contract Execution Transaction is created. A Contract Execution Transaction is a transaction that spends the funds locked in the contract (in the 2-of-2 multi signature output) to outputs that can be claimed by Alice or Bob. It divides the contract funds in the way the participants agreed to.</p><p>These transactions spend the contract funds to two outputs: One can be claimed by Alice and the other by Bob. How much is in each of them is determined by the price of the US Dollar. If either party would receive zero, the output is omitted.</p><p>An important part of this is that the transaction that Alice signs and Bob keeps, does not spend the amount Bob’s entitled to directly to Bob’s wallet (otherwise he could just sign it, broadcast it right after the contract is funded and capture the funds without waiting for any oracle signature). The transaction spends to a combination of Bob’s public key and the public key to the oracle’s signature. That way, Bob can only claim the funds due him using the oracle’s signature of the correct value, which he can’t falsify.</p><p>A second addition is that Bob’s due amount can <em>also</em> be spent by Alice, after a timeout. This is to mitigate the risk that if Bob publishes any Contract Execution Transaction other than the correct one, no one can claim the funds. If the published value by the oracle is 12500, and Bob publishes the transaction belonging to 12600 (of which no one has the oracle’s signature) — Alice can claim Bob’s funds after the timeout. So by publishing the wrong transaction, Bob essentially forfeits all the contract funds to Alice.</p><p>Since publishing the wrong transaction forfeits all the funds to the other side, either party should ensure they have the correct oracle signature prior to publishing a Contract Execution Transaction. Since these signatures are easily verifiable, no one should be able to get ‘tricked’ into publishing the wrong transaction.</p><p>So, when the value published by the oracle is 12500, parties receive back what they funded since the value is exactly the agreed price: no party has to pay the other the difference since there is none. The Contract Execution Transaction that Alice signs and gives to Bob for that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*EiLcv9DhThqX0insXoGgLg.png" /></figure><p>However, if the price changed to 14000 satoshi ($7142,85 per BTC), Bob needs to pay Alice the difference of 5000 * 1500 satoshi, or 0.075 BTC. So the Contract Execution Transaction that Alice signs looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*Rj0LLF2ka4N85rWGhu2Lyg.png" /></figure><p>Alice and Bob can create all Contract Execution Transactions for all possible satoshi values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*h7UAKRMPsyGT4_rb1HNm5Q.png" /></figure><p><strong>Step 4: Exchange signatures to the Contract Execution Transactions.</strong> Once all these Contract Execution Transactions are crafted, both parties exchange the signatures to these transactions, but they don’t publish any of them yet. They verify their correctness, at which point they can safely exchange the signatures to the funding transaction, since they know they have a way to claim the contract funds.</p><p><strong>Step 5: Exchange signatures to the funding transaction. </strong>Now that each party can claim funds from the contract, they are safe to exchange signatures to the transaction that funds the contract from their wallet.</p><p><strong>Step 6: Publish the funding transaction to the blockchain. </strong>Now that the funding transaction is signed, either party can publish the signed funding transaction to the blockchain.</p><p><strong>Step 7: Settle the contract</strong>. At the time the oracle publishes the value, either of the participants can publish the correct Contract Execution Transaction that spends from the contract. The party that publishes the transaction, should then claim the output that spends to the combined key back to their wallet — using the oracle signature combined with their private key to sign it. This prevents the other party from spending it after the time delay.</p><h4>What are potential other use cases?</h4><p>The forward contract is a pretty straightforward use case that fits this technology well. But essentially any value that an oracle can produce can be used in forming these kinds of contracts. For instance, you could create an insurance contract that automatically pays out a claim based on a value (weather data, flight delay data) that comes from an oracle. If an oracle would announce the country that won a world championship in any kind of sport, you could facilitate a simple betting contract based on it.</p><p>Basically any situation where funds need to be divided based on an external future value can be enforced using Discreet Log Contract technology.</p><h4>What are the limitations / challenges?</h4><p>We have currently identified a couple of issues that can be improved in the prototype we built:</p><ul><li><strong>Contract collateral </strong>— Since the contract funds have to be committed in advance, there’s a limit to the price difference it can handle. In our example, if the price goes above 25000 satoshi per dollar (hence below 4,000$ per BTC), Alice will receive all the BTC in the contract, but it might no longer be worth 5000$. This can be prevented by both parties funding more money, but there’s a downside to that too since the funds are locked.</li><li><strong>Number of signatures</strong>— Especially in the Dollar forward use case, we’ve seen that dividing and signing transactions for each individual possible value can lead to enormous numbers of signatures that need to be exchanged. Since, if the oracle ends up giving us a value outside of the range we signed, there’s no way to claim the funds back (except for both parties signing a transaction again). The paper already describes a possible solution to this, but this has not been implemented yet. We could split up the value into an exponent and mantissa. In stead of signing 12500, the oracle will sign “.25” and 4 (1<strong>.25</strong>*10<strong>⁴</strong>). The decimal base and mantissa’s leading 1 are implied. We use both signatures’ public keys in the spending transaction. Now, in our example, we can make the transactions for values 100,000 and up just use the exponent signature and leave mantissa out. So with only 5 signatures extra, we can allow for values between 10⁵ and 10⁹ saving us a billion signatures.</li><li><strong>Risk of trusted oracle</strong> — When forming these contracts, you’re relying on the oracle to give you the correct value. Even more so, if the oracle decides to give you an R-point but never signs any message (and vanishes), you are stuck with a contract that can only be settled with your counter party cooperating. This risk can be somewhat mitigated by using multiple oracles. Using multiple oracles is possible by adding both oracle’s R-points together in the contract execution transactions.</li><li><strong>Novation</strong> — The current setup does not allow for swapping one of the parties for someone else. This might be useful in the situation where Bob wants to settle the contract early. If Alice disagrees with that, it might be an option to offer Alice a small fee to sign the Contract Execution Transactions again under the exact same conditions, except with Carol’s public keys in stead of Bob’s. This might be subject to further research.</li><li><strong>Matching</strong> — Right now the proof-of-concept does not include order matching. Bob and Alice already found each other and set up the contract after agreeing on the terms. It might make sense to allow for some form of marketplace to match people that want to engage in these kinds of contracts. Centralized marketplaces already exist, and could find a way to incorporate DLCs in their portfolio. A decentralized marketplace might be subject to further research.</li></ul><h3>Interesting, so how do I use it?</h3><p>At this time, the software we produced is not ready for production usage. It is merely a proof-of-concept. We think this might be very interesting technology for a broad range of use-cases, and the detailing we did in this blog post might have interested you.</p><h4>Creating an oracle</h4><p>If you have an interesting data feed that might be useful for people to use in their contracts, consider making an oracle out of it. We created a library for that exact purpose. Check out one of the tutorials available. We created one for <a href="https://github.com/mit-dci/dlc-oracle-go/blob/master/TUTORIAL.md">Go</a>, <a href="https://github.com/mit-dci/dlc-oracle-nodejs/blob/master/TUTORIAL.md">NodeJS</a> and <a href="https://github.com/mit-dci/dlc-oracle-dotnet/blob/master/TUTORIAL.md">.NET Core</a></p><p>Essentially, you pre-commit to publishing the data feed’s value at a particular time in the future by publishing the public key, and you publish the values and signatures once the publication is due.</p><p>Right now, the publication could just be on a plain website. We are still working on a standardized publication mechanism. If a standard is decided we will add this to the library.</p><h4>Executing Discreet Log Contracts</h4><p>You can execute Discreet Log Contracts using <a href="https://github.com/mit-dci/lit">lit</a>, the Lightning Network implementation that the DCI is working on.</p><p>You can find a tutorial on setting up an environment consisting of two lit nodes and a Bitcoin Regtest <a href="https://github.com/mit-dci/lit/blob/master/docs/test-setup.md">here</a>.</p><p><a href="https://github.com/mit-dci/lit/tree/master/docs/execute-dlc-litaf.md">Here</a> is a tutorial on executing a Discreet Log Contract from lit’s console client (lit-af).</p><p>We also have a RPC Client for LIT in <a href="https://github.com/mit-dci/lit-rpc-client-go">Go</a>, <a href="https://github.com/mit-dci/lit-rpc-client-nodejs">NodeJS</a> and <a href="https://github.com/mit-dci/lit-rpc-client-dotnet">.NET Core</a> that you can use to execute Discreet Log Contracts from your own software. Samples on how to do that are also available in <a href="https://github.com/mit-dci/lit-rpc-client-go-samples/tree/master/dlctutorial">Go</a>, <a href="https://github.com/mit-dci/lit-rpc-client-nodejs-samples/tree/master/dlctutorial">NodeJS</a> or <a href="https://github.com/mit-dci/lit-rpc-client-dotnet-samples/tree/master/dlctutorial">.NET Core</a>.</p><h4>Contact us</h4><p>If you have any ideas, suggestions, questions, feel free to contact us through <a href="/service/mailto:dlc@mit.edu">e-mail</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc8afbdbf0db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>