<?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[MedX Protocol - Medium]]></title>
        <description><![CDATA[MedX is a global healthcare market controlled by the people who use it. - Medium]]></description>
        <link>https://medium.com/medxprotocol?source=rss----85136d33f8b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>MedX Protocol - Medium</title>
            <link>https://medium.com/medxprotocol?source=rss----85136d33f8b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 02:05:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/medxprotocol" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[MedX partners with Wyre for USD payments]]></title>
            <link>https://medium.com/medxprotocol/medx-partners-with-wyre-for-usd-payments-3e52e82d5569?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e52e82d5569</guid>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[wyre]]></category>
            <dc:creator><![CDATA[James Todaro, MD]]></dc:creator>
            <pubDate>Mon, 14 Jan 2019 16:30:28 GMT</pubDate>
            <atom:updated>2019-01-15T03:21:56.554Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*5HZKGg5A1HqLOdSNLonMQQ.png" /></figure><p>It is with great pleasure that we announce our partnership with <a href="https://www.sendwyre.com/">Wyre</a> to integrate USD payments on <a href="https://opencare.medxprotocol.com/">OpenCare</a>. As we move forward with the rollout of OpenCare to physicians and patients, it is imperative that those unfamiliar with digital assets or cryptocurrency can easily use the dApp. One of those barriers (for now) is the requirement to own cryptocurrency.</p><p>Now with the Wyre widget, users on OpenCare can pay in USD. While users retain the options to pay or receive payment on OpenCare with DAI or ETH, users and clinics can now also link bank accounts in order to pay or receive payments in fiat.</p><p>On the front end, the widget appears as shown in the payment panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUtrLnCJ6un8kelp1ga91w.png" /><figcaption>Click “Pay with USD” to use Wyre</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R22eKsfKaxAHndVRDmPvfw.png" /><figcaption>In-app Wyre widget</figcaption></figure><p>With Wyre’s simple onboarding process, users are able to use USD to obtain DAI, which then enters the OpenCare smart contracts. DAI token passes along the rails of the smart contracts to the physician in exchange for services, and the physician is able to withdraw either DAI token or USD.</p><h4><strong>About MedX Protocol</strong></h4><p>MedX is a permissionless protocol for launching medical dApps that connect patients and physicians worldwide for medical care. Applications on the MedX protocol can be used to eliminate intermediaries and international barriers to affordable care. OpenCare is the first dApp on MedX and creates a market for telemedicine that reduces global disparities in medical care. For more information, please visit us at <a href="https://medxprotocol.com/">https://medxprotocol.com/</a>.</p><h4>About Wyre</h4><p>Wyre helps crypto companies operate in a fiat world. With the Wyre API, partners can grab off-the-shelf the necessary infrastructure for their business. From KYC/AML onboarding, payment processing, and liquidity, Wyre helps fintech entrepreneurs go to market quickly.</p><p>Founded in 2013 as one of the original infrastructure 1.0 crypto companies, Wyre has traded $3.5 billion in cryptocurrency assets in-house and have completed more than $750 million in bank-to-bank commercial FX payments. Wyre has expanded its global infrastructure to include relationships with counterparties to procure not only same-day settlement but deep liquidity and best pricing and execution. Funded by renowned VCs in Silicon Valley, Wyre is a well-vested company in the digital currency community, with users in 50+ countries, with features in Forbes, WSJ, NBC, Bloomberg, Coindesk and more. They are headquartered in San Francisco’s Mission district. For more information, please visit <a href="http://www.sendwyre.com/">www.sendwyre.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e52e82d5569" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/medx-partners-with-wyre-for-usd-payments-3e52e82d5569">MedX partners with Wyre for USD payments</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MedX Protocol: Mission and Values]]></title>
            <link>https://medium.com/medxprotocol/medx-protocol-mission-and-values-1234012259f9?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/1234012259f9</guid>
            <category><![CDATA[medicine]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Joseph Todaro]]></dc:creator>
            <pubDate>Fri, 28 Dec 2018 14:36:20 GMT</pubDate>
            <atom:updated>2018-12-28T14:36:20.583Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*Oh3vuN1kBJE9KOkBbhvWQQ.png" /></figure><p>Decentralized projects are largely defined by their communities and the shared goals of all of those involved. At MedX, we have always understood the need for open communication and explicit, shared community goals. The majority of the MedX team has been deeply involved in the crypto space for nearly five years. As developers and the early guides of the MedX Protocol, our primary focus is on building great products that will improve the lives of many. However, before taking these roles, we were the early supporters and community members of other great projects that utilize the blockchain and digital assets to make positive differences. Our team has been on both sides. We hope through the sharing of our <em>Mission and Values </em>we can better communicate to the MedX community the fundamental ideas that guide our decision process as a team.</p><p>We understand the gravity of our early role as developers and guides of the initial formation of the MedX Protocol. Although we currently have significant influence over the direction of protocol development, this will not always be the case. We have now successfully launched OpenCare on mainnet as well as the beta release of our token-curated registry (TCR). As the MedX ecosystem and community begins to expand, the direction and future of the MedX ecosystem will be controlled by the community itself. The MedX Protocol will exist as a truly decentralized and globally distributed system governed by the users. This will be initially apparent in the beta release of our TCR whereby users are responsible for verifying the credentials of physician applicants. The user controlled aspect of the network is central to the MedX ecosystem and will continue to expand as the protocol matures and the community grows.</p><p>While the MedX team will continue to develop and release protocol advances and improvements, these upgrades will only be accepted with the support, testing and approval of the community. For this reason, we believe that it is imperative to clearly share our core mission and values with the community in hopes that these shared ideas will guide the MedX ecosystem as a whole for years to come.</p><h3>The Problem</h3><p>Affordable healthcare services are not available to all. The cost and accessibility of healthcare is limited not only by your income status but also by your geographical region. While some portion of this friction may be inherent to the demands of the medical profession and the limitation of available resources, a much greater degree is due to technological shortcomings, inefficient healthcare solutions and geographically fragmented, slow-moving regulations. These aspects of the healthcare market have minimized the supply, distribution and general affordability of medical services throughout the world. Medical services today are not available to the extent that a global, restriction-minimized system would allow. We believe that the use of a decentralized censorship-resistant solution necessitated by a sound blockchain allows for the creation of global free-market health solutions that maximize access and affordability of medical care.</p><h3><strong>Our Mission and Core Values</strong></h3><p>Our vision is of a world where access to health services is widespread and affordable, minimizing market inefficiencies and restrictions that inflate costs and reduce available care. We believe in the creation of a global, free-market driven health ecosystem in which neither geographical location nor artificial restrictions necessarily compromise access to appropriate medical services.</p><blockquote>In accordance with the above beliefs, our mission statement reads as follows:</blockquote><blockquote><em>Build a global health system accessible by all.</em></blockquote><p>We believe that the path to building this system requires the use of permissionless public blockchain infrastructure where information flows freely and all interested participants have access. Participants within this health system are not only owners of the system itself, but also the sole owners of their generated data such that they may freely grant or limit access to this information.</p><p>These closely held beliefs have helped shape the fundamental ideas of our <em>core values</em>.</p><h4>1. Do right by the community</h4><p>Decentralized projects are only as powerful as the communities that use and secure them. Projects that deliver long-lasting value to the community are best positioned to retain their supporters and further encourage an ever larger ecosystem of developers and users. These diverse participants then drive the value of the protocol as more useful products launch and economic activity within the system grows.</p><p>We strive to always <em>do right</em> by continuing to encourage the development of value-filled systems that can survive on long time horizons.</p><h4>2. Give control to the users</h4><p>A global open-access health system cannot be effectively maintained under the control of a single centralized party. Building quasi-decentralized systems that ultimately have central points of control is antithetical to the fundamental value proposition of permissionless systems. We are uninterested in contributing to a protocol that has significant central points of failure. Decentralized systems benefit remarkably from their open-access and permissionless nature. This right for users to access the network regardless of geographical location or specific restrictions is protected by the community alone. If this basic principle is upheld by the community, then we can be sure that MedX remains a protocol open to all.</p><p>We believe that the persistent ability for all people to access and utilize decentralized systems cannot be guaranteed by any central party and must be granted and protected by the users themselves. For this reason, these systems should not be under the control of a central entity but rather they should be wholly controlled by the users.</p><p>That is, a network<em> users truly control</em>.</p><h4>3. Ship code frequently</h4><p>We have consistently released updates to our core protocol to the best of our ability in accordance with our roadmap. This dedication to ship has allowed us to be among a growing group of projects that have delivered usable applications on mainnet. With the release of OpenCare on mainnet and our TCR in beta, we are committed to shipping protocol updates.</p><p>Additionally, as the MedX community grows, we will continue to encourage development from a diverse set of global developers looking to utilize the MedX protocol to launch their own distributed healthcare applications.</p><p>To find out more about the MedX Health System, please join the discussion on our <a href="https://t.me/MedCredits">Telegram</a> or join our <a href="https://medxprotocol.com/whitelist/">mailing list</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1234012259f9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/medx-protocol-mission-and-values-1234012259f9">MedX Protocol: Mission and Values</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MedX Token Curated Registry in Open Beta]]></title>
            <link>https://medium.com/medxprotocol/medx-token-curated-registry-in-open-beta-527959084390?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/527959084390</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[tcrs]]></category>
            <category><![CDATA[token-curated-registries]]></category>
            <dc:creator><![CDATA[James Todaro, MD]]></dc:creator>
            <pubDate>Sun, 23 Dec 2018 14:54:36 GMT</pubDate>
            <atom:updated>2018-12-23T14:54:36.288Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce that the MedX Physician Registry is in Open Beta on the Ropsten Testnet! It is available for testing at <a href="https://registry.medxprotocol.com/">https://registry.medxprotocol.com</a>. The MedX Registry has the following features:</p><ul><li>Ethereum smart contracts including PLCR voting contracts</li><li>Decentralized storage of physician credentials on IPFS</li><li>Integration with the <a href="https://www.civic.com/">Civic Secure Identity Ecosystem</a> for easy physician login</li><li>MEDX wallet integration with MetaMask and user interface</li><li>Near instant in-app faucet for both testnet MEDX and ETH</li></ul><p><strong>The MedX Physician Registry will be the gateway for physicians around the world to become part of a new, global health system. </strong>That is, an open healthcare system that is controlled by its users while simultaneously ensuring the service of qualified, licensed physicians.</p><p>We strongly encourage users to participate in testing the TCR in two different roles:</p><p><strong>Token holders/verifiers</strong></p><p>Verify, challenge or vote on physician applications in the registry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UFPI18V95M6aqLY1sVSOLA.png" /><figcaption>List of physicians and their application statuses</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rFnBmlykh8WFIcEEOl9YtA.png" /><figcaption>Review and verify/challenge physician credentials</figcaption></figure><p><strong>Physicians</strong></p><p>Submit your credentials to register in the health system. Of note, this is not the mainnet version of the TCR and is for testing purposes only. So there is no need to submit actual physician credentials at this time. Anyone can try it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sS38CkTPdfNjlPegnVGJlA.png" /><figcaption>Log-in with Civic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_dbf7YVoZhB8R-UIIH1qw.png" /><figcaption>Enter credentials and submit!</figcaption></figure><p>Lastly, as we approach the upcoming mainnet launch of the MedX Physician Registry, we want to provide our community with a <strong>statement on the Mission and Values</strong> that has guided and will continue to be a navigational beacon for our team in the days to come. We will publish the <em>MedX Mission and Values</em> early next week.</p><p>Happy Holidays everyone!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=527959084390" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/medx-token-curated-registry-in-open-beta-527959084390">MedX Token Curated Registry in Open Beta</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A TCR Protocol Design for Objective Content]]></title>
            <link>https://medium.com/medxprotocol/a-tcr-protocol-design-for-objective-content-6abb04aac027?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/6abb04aac027</guid>
            <category><![CDATA[curation]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[objectivity]]></category>
            <dc:creator><![CDATA[Moshe Praver]]></dc:creator>
            <pubDate>Wed, 05 Dec 2018 16:47:54 GMT</pubDate>
            <atom:updated>2018-12-06T01:16:34.006Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this post, we outline the basic protocol for an objective TCR. This will be followed by a formal quantitative analysis of the security guarantees and potential attack vectors. We assume familiarity with adChain’s <a href="https://medium.com/@ilovebagels/token-curated-registries-1-0-61a232f8dac7">original TCR</a> design and encourage the reader to review our <a href="https://medium.com/coinmonks/subjective-vs-objective-tcrs-a21f5d848553">prior</a> <a href="https://blog.goodaudience.com/tcrs-are-not-work-tokens-693abd6eb795">work</a> on TCRs.</p><blockquote><strong>We prefer to call Objective TCRs: Trustless Incentivized Lists (aka TILs). We consider these a type of oracle and treat them as work tokens.</strong></blockquote><p>The entire protocol centers around one goal: <strong>providing an incentive for a verifier to actually check the validity of an application</strong>. In the original TCR paradigm it is assumed that the subjectivity of the application will naturally cause friction amongst token-holders. Such friction cannot be assumed in a TIL. In other oracle designs, such as Augur, the protocol assumes that, in the context of a prediction market, a self-interested market participant will check the validity of an outcome to prevent being cheated. Such self-interested participants cannot be assumed in a TIL.</p><p>The protocol is inspired by <a href="https://people.cs.uchicago.edu/~teutsch/papers/truebit.pdf">Truebit</a>. The team at Truebit introduced the concept of “forced errors” to motivate verifiers to expend computational resources in search of these errors. Anyone who discovers a forced error receives a reward. <strong>The forced error concept draws upon the idea that, for a given objective task there should be a deterministic outcome. <em>Input a </em>→ <em>Output b</em>. We distill this idea and eliminate the need for forced errors.</strong></p><blockquote>Simply: if one individual (applicant) commits to an input/output pairing and provides another individual (verifier) with the same input, that individual should be able to produce the same output. In the absence of communication between the two individuals, if they produce the same output, we can conclude with great confidence that the input/output pair is valid across some function. Thus, the crypto-economic goal of the protocol is to prevent collusion between the applicant/verifier.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FtVjs6E_S5xs%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtVjs6E_S5xs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtVjs6E_S5xs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0dd3e3f7d68fafc57e4e0db7545a7ab1/href">https://medium.com/media/0dd3e3f7d68fafc57e4e0db7545a7ab1/href</a></iframe><h3>Protocol</h3><h4>I. Pre-amble</h4><ol><li>A TIL requires a “native token”. We use a standard ERC-20 contract.</li><li>The protocol involves 3 types of parties: applicants, verifiers and voters. All three require native tokens. A single individual can perform all 3 roles.</li><li>The applicant &amp; verifier are incentivized by ETH rewards. The voters are incentivized by native token rewards.</li><li>There exists a pool of verifiers who are available to review new applications to the registry. To become a verifier, one must stake a fixed amount of native tokens in a work contract. We use a fixed amount of tokens due to <a href="https://medium.com/medxprotocol/creating-a-work-token-part-i-359cc12e920a">computational complexity</a> that arises when allowing a variable stake size.</li></ol><h4>II. Application Phase</h4><ol><li>An applicant submits a hint and a secret, such that a verifier who is provided the hint can deterministically derive the secret (examples: token-name/ticker→ token contract address; physician name/specialty →license number).</li><li>The applicant generates a random number in their browser.</li><li>The applicant commits the following on-chain: i) his hint, ii) a hash of his random number and iii) a hash of the concatenation of his secret and random number. Note, the secret cannot be credibly revealed without also revealing the random number.</li><li>Along with the above transaction the applicant sends <em>x</em> native tokens and <em>y</em> ETH. The ETH is used to pay the verifier. The native tokens are used to stake in the registry (for a successful application).</li><li>The following block is mined and the block hash is used as a source of pseudo-randomness. This pseudo-randomness is used to randomly select a verifier from the work contract.</li></ol><h4>III. Verification Phase</h4><ol><li>2<em>x</em> native tokens are transferred from the selected verifier’s work contract to the application contract.</li><li>The verifier is presented with the hint and is given a fixed amount of time to derive and submit the corresponding secret.</li><li>If the verifier fails to respond in time, the applicant selects a new verifier, is rewarded <em>x</em> native tokens from the original verifier and the original verifier is returned <em>x</em> native tokens. If a verifier’s staked tokens falls below a given threshold, they are removed from the verifier pool. Repeat step III-1.</li><li>If at any time prior to the verifier submitting a secret, the applicant’s random number becomes known, one may “blow the whistle” by submitting the random number. If the hash of this random number matches the hash stored on chain, the whistle-blower is rewarded <em>x</em> native tokens and <em>y </em>ETH from the applicant. The protocol terminates.</li><li>Assuming the absence of a whistle-blower, the verifier then submits a corresponding secret along with <em>y</em> ETH within the time window.</li></ol><h4>IV. Secret Reveal Phase</h4><ol><li>Following the verifier committing to a secret, the applicant is given a fixed amount of time to reveal their random number.</li><li>If the applicant fails to reveal their random number in time, the verifier is rewarded <em>y</em> ETH. The verifier’s 2<em>x</em> native tokens and <em>y</em> ETH are returned. The applicant’s <em>x</em> native tokens are returned. The application is not admitted to the registry. The protocol terminates.</li><li>Otherwise, the applicant reveals their random number and secret. If the applicant and verifier secrets are the same, the applicant is admitted to the registry with <em>x</em> native tokens staked. The verifier is awarded <em>y</em> ETH for their diligent curation. The verifier is returned their 2<em>x </em>native tokens and <em>y</em> ETH. The protocol terminates.</li></ol><h4>V. Power Challenge Phase</h4><p>If the applicant and verifier secrets differ, a “power challenge” commences in which the voters determine if the application hint/secret pair are valid. Here, <strong>we replace the traditional </strong><a href="https://github.com/ConsenSys/PLCRVoting"><strong>PLCR style voting</strong></a><strong> with a round-based game of escalating stake.</strong> Each round signals a tentative outcome and lasts a fixed window of time. If the tentative outcome is not disputed during the time window of a given round, the tentative outcome becomes the final outcome and all voter stake that supported the losing outcome can be claimed by voters who supported the final outcome.</p><p><strong>The amount of stake required to dispute a tentative outcome is: 2*(total tokens staked) - 3*(current stake on alternate outcome)</strong>. By nature of the prior applicant-verifier interaction, the starting state of every power challenge is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6_vf2GjpynnQckgRwsqTQ.png" /><figcaption>Starting state of a power challenge</figcaption></figure><p>A power challenge that continues through 6 rounds would appear as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzCPJxC22-V_MGb4H1kDkA.png" /><figcaption>6 power challenge rounds</figcaption></figure><p><strong>We prefer the power challenge over PLCR voting for several reasons.</strong> First, voting notoriously suffers from poor voter turnout. This makes it likely that a single ‘whale’ can dictate the outcome of a vote. Over time, this deters smaller voters from participating. Second, PLCR voting rewards are unpredictable. Typically, the number of tokens in the minority are so small that rewards to the majority token holders are simply not worth the effort (in fact, sometimes the gas costs associated with PLCR voting are greater than the actual rewards for winning). <strong>In the power challenge, a voter on the winning side is guaranteed a 50% ROI in native tokens.</strong> This is heavily inspired by Augur’s dispute round mechanism (<a href="https://www.augur.net/whitepaper.pdf">white paper section C-8</a>). Third, PLCR voting requires voters to return and reveal their vote during a “reveal window” — this leads to a poor UI. The power challenge does not rely on obfuscation of votes (it is secured by the credible threat of a fork, see section VI below), and requires only one period of voter interaction.</p><ol><li><strong>If the power challenge resolves in favor of the verifier</strong>, the verifier receives <em>y </em>ETH and <em>x</em> native tokens from the applicant. They are returned their deposit of 2<em>x</em> native tokens and <em>y</em> ETH. The applicant is not admitted to the registry.</li><li><strong>If the power challenge resolves in favor of the applicant</strong>, the applicant receives <em>y </em>ETH and 0.5<em>x </em>native tokens from the verifier. They are admitted to the registry with <em>x</em> native tokens staked. The remaining 1.5<em>x</em> native tokens of the verifier are rewarded to voters who supported the final outcome. Of note, the verifier forfeits both his 2<em>x</em> native tokens and <em>y</em> ETH.</li></ol><h4>VI. Forking Phase</h4><p>The power challenge can, in theory, be won by the individual(s) who possess the largest amount of native tokens. To prevent plutocracy, the ultimate security backup is a fork. When the amount of native tokens involved in a power challenge exceeds a certain threshold, the registry forks. Following a fork, there exists a version of the registry with the new applicant included and a version with the new applicant rejected. For simplicity, in a forking scenario the applicant and verifier are returned their respective <em>y</em> ETH. All pending applications are aborted and participants in these pending applications reclaim their respective ETH and native tokens. All native tokens currently involved in the power challenge are automatically migrated to the version of the registry they signaled support for. All tokens not involved in the power challenge must manually migrate to the version they believe is valid. Users of the registry and token-holders determine which version of the registry they wish to continue using. Presumably, the tokens in the valid version will retain their value, whereas the ones in the invalid version will become valueless. <strong>In this forking paradigm, even an attacker with &gt;51% of the native tokens could be incapacitated by off-chain coordination that would render her native tokens valueless in an invalid deprecated registry.</strong></p><h3>Qualitative Protocol Analysis</h3><p>In this section we will qualitatively describe 2 possible attack vectors. Following this post we will provide a more rigorous quantitative (LaTeX) analysis of the security guarantees.</p><p>TILs rely on the truth as a Schelling Point. If the property being curated in a TIL is <em>truly objective</em> there should be a way to construct a hint → secret pair that is deterministic.</p><p>Because we have adopted a work token model with slashing conditions, verifiers in a TIL will lose native tokens if they neglect to review applications that are assigned to them (Step III-3) or provide a secret that does not match a valid hint/secret pair. This provides an incentive for verifiers to routinely check for new applications (e-mail/text notifications are possible with some degree of centralization) and perform the necessary work to derive a secret from the provided hint. Verifiers who perform their jobs appropriately will receive predictable rewards in ETH.</p><p><strong>A malicious actor who wishes to admit a faulty application to the registry has two attack vectors:</strong> 1) attempt to communicate with their verifier or 2) verify their own application by owning the assigned verifier account.</p><p>The protocol dissuades attack vector #1. A verifier should <em>never</em> trust an applicant who reaches out in an attempt to “help by telling the secret”. As can be seen in step V-2, a rational applicant should attempt to trick a verifier into committing to an inaccurate secret for a valid hint/secret pair because the applicant is rewarded <em>y</em> ETH from the verifier in such a scenario. A verifier cannot be sure that the provided secret is the actual secret committed on-chain, because what is stored on-chain is a hash of the secret <em>plus </em>a random number that is unknown to the verifier. If an applicant truly wanted to “help out” a verifier, he would have to reveal both the secret and the random number. However, as can be seen in step III-4, a rational verifier that knows the applicant’s random number should simply whistle-blow. The reward for whistle-blowing is greater than the reward for providing accurate verification. For these reasons, it is in the verifier’s best interest to simply do the work of deriving the secret himself.</p><p>Attack vector #2 is akin to the well known 51% attack and other brute force attacks. These attacks are technically unpreventable. Our only option is to design the protocol such that they are extremely expensive, not profitable and (hopefully) not worthwhile even to a spiteful attacker. A malicious entity could set up a verifier account and submit consecutive applications to a TIL until the application is assigned to his own verifier account. At this point, he would know the secret to an otherwise bogus hint/secret pair and gain admittance to the registry. Each failed application costs the attacker <em>x</em> native tokens and <em>y</em> ETH. The cost of such attack is therefore related to the number of verifiers in the work contract (akin to the hash power of a PoW chain), the cost in ETH to apply (value of <em>y</em> * price of ETH) and the cost in native tokens to apply (value of <em>x</em> * price of native token). We presume that, as the registry becomes more desirable, the price of the native token will increase, therefore providing some built-in protection from this attack. However, the parameters should be set such that this attack is prohibitively expensive.</p><h3>Future Work</h3><h4>Private Transactions</h4><p>Both primary attack vectors are related to collusion. This could be made far more difficult by making the verifier assignments private.</p><ol><li>Currently the assigned verifier for an application is publicly known. If this was not the case, it would prove very difficult for an applicant to attempt to bribe a verifier using an off-chain agreement or even another smart contract.</li><li>One way to make attack vector #2 prohibitively expensive is to require multiple verifiers for each application. This allows us to exponentially increase the cost of the attack. While presently possible, there is the concern that co-verifiers will either attempt to coordinate their secrets or worse, co-verifiers will mimic the response of the first verifier who submits a secret.</li></ol><h4>General Trustless Oracle</h4><p>While our burning passion at MedX is to improve healthcare, we have also found ourselves quite far down the decentralized oracle rabbit hole. The crypto ecosystem is still maturing and we may end up building key infrastructure pieces along the way as we build MedX. We are exploring modifications to the TIL protocol which could serve as a trustless and secure method to migrate virtually any piece of objective data to a blockchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*99Jw4R5vvIpmQ3gerMb1yg.jpeg" /></figure><h3>Give it a TRY</h3><p>The Objective TCR (TIL) protocol is in beta 1.0 on the Ropsten Testnet using ERC-20 token metadata as a use-case: <a href="https://tokenregistry.medxprotocol.com/">https://tokenregistry.medxprotocol.com/</a>. Expect bugs!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6abb04aac027" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/a-tcr-protocol-design-for-objective-content-6abb04aac027">A TCR Protocol Design for Objective Content</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A TCR that decentralizes token listing on DEXs]]></title>
            <link>https://medium.com/medxprotocol/a-tcr-that-decentralizes-token-listing-on-dexs-fbfc9288b400?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/fbfc9288b400</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralized-exchange]]></category>
            <category><![CDATA[token-curated-registries]]></category>
            <category><![CDATA[tcrs]]></category>
            <dc:creator><![CDATA[James Todaro, MD]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 15:54:12 GMT</pubDate>
            <atom:updated>2018-11-29T16:47:01.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*QrHVQqDmYzgZFpo6UF4m6Q.gif" /><figcaption>User experience on The Token Registry</figcaption></figure><p>In the development of nascent technologies, protocol design breakthroughs can often be applied broadly. This is certainly the case in the recent explosion of decentralized ecosystems. While a particular development may be designed with a specific use-case in mind, the fundamental game theory, incentive scheme and protocol is likely widely applicable.</p><p>One contemporary example is <a href="https://medium.com/spankchain/a-state-channels-adventure-with-counterfactual-rick-part-1-ce68e16252ea">SpankChain’s state channels</a>. While originally launched in 2015 as a payment system for adult content, SpankChain’s state channels have been widely praised as a potential solution to increasing throughput and decreasing gas costs in the Ethereum ecosystem.</p><h3>alex van de sande on Twitter</h3><p>When I first heard about @SpankChain I&#39;ve dismissed as &quot;whatever, porn&#39;s an early adopter and they want to jump the ICO bandwagon&quot;. Then they started shipping production state channels and working apps and I found it a funny curiosity. But Chelsea makes it about something bigger.</p><h3>Crypto Bobby on Twitter</h3><p>Malta highlight: hearing someone talk down to @ameensol as he describes SpankChain, then their jaw drops when he discusses an algorithmic stablecoin and state channels</p><p>For us, what started out as a Token Curated Registry (TCR) of physicians, has evolved into an entirely new TCR design for curating any list of objective content.</p><p>The MedX TCR was designed for the purpose of creating a decentrally maintained, global network of physicians where verifiers worldwide reviewed physician credentials for admission to the registry. This network of physicians could then be instantly accessed for free by any healthcare or telemedicine application (more details can be found <a href="https://medium.com/medxprotocol/preparing-for-the-launch-of-medx-97d39e1d9e9c">here</a>). This TCR design, however, can be used for a multitude of other applications. Specifically, I’d like to discuss the potential utility of our TCR in decentralizing the token listing process for decentralized exchanges (“DEXs”).</p><h4>One step closer to fully decentralizing DEXs</h4><p>Since the <a href="https://www.sec.gov/news/press-release/2018-258">public release of the SEC report on EtherDelta</a>, DEXs fell under public scrutiny when it became apparent that decentralized exchanges are, in many ways, actually centralized.</p><p>Today, nearly all DEXs have a centralized token listing process whereby exchange owners manually list tokens. Even for DEXs with public/open token listings, the exchange owners manually mark or rank the legitimate tokens so that traders can avoid confusion with undesirable tokens. This process is carefully monitored to ensure that the listed or “verified” tokens have correct contract owner addresses, ticker symbols and logos to prevent any confusion or costly mistakes by traders. This information is currently maintained by exchange owners, MetaMask personnel and other centralized third parties.</p><p>This process can actually be quite burdensome, as stated by the MetaMask team in the <a href="https://github.com/MetaMask/eth-contract-metadata">MetaMask GitHub under <em>Submission Process</em></a><em>.</em></p><blockquote>“Maintaining this list is a considerable chore, and it is not our highest priority. We do not guarantee inclusion in this list on any urgent timeline. We are actively looking for fair and safe ways to maintain a list like this in a decentralized way, because maintaining it is a large and security-delicate task.”</blockquote><p>We believe that our TCR could be the decentralized solution that the MetaMask team describes.</p><h4>The Token Registry for DEXs</h4><p>We propose <strong><em>The Token Registry</em></strong> as a decentrally curated list of verified ERC-20 tokens. The output of this registry is a list of tokens with the following curated information:</p><ul><li>One unique name/ticker symbol per token</li><li>One contract owner address per token</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8PlzGn6GUjtugr4kXtzf4Q.gif" /><figcaption>The REP token listing is being challenged (submitted contract address is incorrect)</figcaption></figure><p>With this verified information, traders on exchanges need not worry about being accidentally or intentionally spoofed into buying undesirable or fraudulent assets. Moreover, by requiring a fee and deposit to register a token on <em>The Token Registry</em>, the registration of spam tokens will be minimized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Bqda5oVDcQreKzJZcQDItQ.gif" /><figcaption>Submit any ERC-20 token registration in minutes</figcaption></figure><p><em>The Token Registry</em> is now available for testing on the Ropsten Testnet at <a href="https://tokenregistry.medxprotocol.com/">https://tokenregistry.medxprotocol.com</a>. With app-native faucets and an easy UI, users can begin registering tokens and verifying submissions in minutes (as shown below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4V-6RXk4U_f3tRJ0lxaQ_A.png" /><figcaption>In-app faucet to quickly obtain testnet TEX/ETH tokens</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScMwMQEHFFRIuVxNUojrPQ.png" /><figcaption>Registry token listing homepage</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Un7PB3twLa734OnMG_rAuA.png" /><figcaption>Stake a deposit in TEX to submit a token for entry in the registry</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6J50ylOp3ItL4TfN2efS4Q.png" /><figcaption>Stake TEX and earn rewards by verifying token submissions</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xP5FNKlt1raPPU-vPHN9-g.png" /><figcaption>Wallet</figcaption></figure><p><strong>After a brief period of bug fixes, we aim to deploy <em>The Token Registry</em> on Ethereum mainnet in early Q1 2019.</strong> As the list of registered tokens grows, we foresee this as an affordable and expedient option for exchanges to decentralize the token listing process.</p><h4><strong>How does The Token Registry relate to MedX?</strong></h4><p>Over the past year, we set out to develop a TCR of physicians. After carefully studying and testing the existing TCR models, we concluded that the incentive structure of these TCRs could be improved for the curation of lists of <em>objective</em> information. This is expounded on in greater detail in <a href="https://medium.com/coinmonks/subjective-vs-objective-tcrs-a21f5d848553">Dr. Praver’s article on Subjective vs Objective TCRs</a>. In brief though, the incentive structure for the adChain TCR model is dependent on disagreements between token-holders in verifying <em>subjective</em> content (e.g. America’s best colleges, New York’s worst restaurants). In the curation of <em>objective</em> content, however, there is rarely disagreement and, in turn, rarely rewards for curating content. This is a problem for decentralized platforms that use the adChain TCR for curating objective content. Despite this challenge, most existing TCRs are still based off the adChain design, which is detailed further in <a href="https://medium.com/@ilovebagels/token-curated-registries-1-0-61a232f8dac7">Mike Goldin’s seminal blog post</a>.</p><p>For the MedX Protocol, we needed a TCR that properly incentivized verifiers of objective content — physician credentials. This required an entirely new TCR design whereby verifiers are properly incentivized to perform quality work even if there is little friction or disagreement with other token holders/verifiers.</p><p><strong>From the ground up with entirely new smart contracts and user interface, we built a new TCR model for objective content.</strong></p><p>Stay tuned next week when Dr. Praver and our development team will publicly release a detailed description and parameters of our TCR protocol!</p><h4>Conclusion</h4><p><a href="https://tokenregistry.medxprotocol.com/"><em>The Token Registry</em></a> could be useful for taking DEXs one step closer toward, well, decentralization. By implementing a decentralized token listing process that is trader-friendly, DEXs would no longer be responsible for manually listing or verifying new tokens.</p><p>Lastly, <em>The Token Registry</em> will serve as a great way to test our new TCR protocol before launching the MedX physician TCR on Ethereum mainnet. This is critical to avoid a situation where potentially fraudulent, non-credentialed physicians could enter the MedX Health System.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbfc9288b400" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/a-tcr-that-decentralizes-token-listing-on-dexs-fbfc9288b400">A TCR that decentralizes token listing on DEXs</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MedX Partners with MakerDAO]]></title>
            <link>https://medium.com/medxprotocol/medx-partners-with-makerdao-d5fa5aaab8b6?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/d5fa5aaab8b6</guid>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[partnerships]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[makerdao]]></category>
            <dc:creator><![CDATA[Moshe Praver]]></dc:creator>
            <pubDate>Fri, 26 Oct 2018 15:01:02 GMT</pubDate>
            <atom:updated>2018-10-26T15:01:02.295Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AgxpaXltEDlaicSDfN3xqw.png" /></figure><p>I am pleased to formally announce our partnership with MakerDAO! Maker provides the MedX ecosystem with a “stablecoin” called Dai. The most important thing to know about Dai is that 1 Dai = 1 USD. This means that patients and physicians who use dApps in the MedX Health System do not have to worry about the volatility of cryptocurrencies like ETH and MEDX.</p><blockquote>The most important thing to know is that 1 Dai = 1 USD</blockquote><p>Interestingly, our partnership with MakerDAO uses their ecosystem in three different ways. Let’s dive into the details.</p><h4>Direct ERC-20 Payment</h4><p>The most direct way that we use MakerDAO is by supporting direct payment from patients to physicians using Dai. Like many other tokens including MEDX, Dai is based on the ERC-20 standard. This means that the smart contracts we write can send Dai just as easily as any other ERC-20 token.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a798f958d64b5102bc2aee14f905645/href">https://medium.com/media/6a798f958d64b5102bc2aee14f905645/href</a></iframe><h4>On-chain ETH:USD price feed</h4><p>At this time ~62M Dai are in existence and they are held in ~7,000 different accounts. While this number keeps climbing, it is still much smaller than the market cap of ETH (currently ~$21B) held in <a href="https://etherscan.io/chart/address">~44M accounts</a>. Knowing that our users need ETH to pay for gas fees anyway, we wanted to find a way to support payment in ETH <em>and </em>offer users a stable price quote.</p><p>Fortunately MakerDAO has an excellent on-chain ETH:USD <a href="https://makerdao.com/feeds/">price feed</a>. This price feed is critical to the underlying collateralized debt position system that is the backbone of the MakerDAO design. This price feed is public infrastructure and we make use of it to quote prices in ETH but fix this to a constant USD value.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/323c19d4a9d0494fbfac707ac936cc76/href">https://medium.com/media/323c19d4a9d0494fbfac707ac936cc76/href</a></iframe><h4>Trading ETH to Dai</h4><p>Finally, because we support payment using ETH, we want to offer our physicians an easy method to switch their ETH into Dai to avoid the possibility of future volatility. MakerDAO provides an extremely easy-to-use on-chain exchange called <a href="https://oasis.direct/">Oasis Direct</a>. We offer Oasis Direct to our users by providing a link to the Oasis Direct exchange within the MedX wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7F_wy2wEPl8lUmug58utw.png" /></figure><p>With the MakerDAO integration now complete, it becomes quite straightforward to add this functionality to additional dApps in the MedX Health System. Here’s looking forward to future collaboration!</p><p><strong>About MedX Protocol</strong></p><p>MedX is a permissionless protocol for launching medical dApps that connect patients and physicians worldwide for medical care. Applications on the MedX protocol can be used to eliminate intermediaries and international barriers to affordable care. OpenCare is the first dApp on MedX and creates a market for telemedicine that reduces global disparities in medical care. For more information, please visit us at <a href="https://medxprotocol.com/">https://medxprotocol.com/</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5fa5aaab8b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/medx-partners-with-makerdao-d5fa5aaab8b6">MedX Partners with MakerDAO</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Work Token — Part I]]></title>
            <link>https://medium.com/medxprotocol/creating-a-work-token-part-i-359cc12e920a?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/359cc12e920a</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[binary-search]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[design-process]]></category>
            <dc:creator><![CDATA[Brendan Asselstine]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 15:01:02 GMT</pubDate>
            <atom:updated>2018-10-16T15:01:02.016Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a Work Token — Part I</h3><h4><em>Worker Selection Algorithms</em></h4><p><em>tldr; In this article we outline two approaches to Worker selection in a Work contract: Stake-weighted and Fair. Stake-weighted selection uses a probability proportional to the stake size, while fair has a uniform distribution. We found Stake-weighted worker selection gas usage, at best, grows linearly with the number of workers. Fair worker selection gas usage is constant, making it possible to support a large number of workers.</em></p><h3>Introduction</h3><p>A Work contract is a mechanism that determines who is able to participate as a “Worker” in a cryptoeconomic system. To become an eligible Worker, a user must stake tokens. When a new Job is available, a Worker is selected to complete it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UjJpCCuAo209HUU7NKgvqg.jpeg" /></figure><p>There are two approaches to the selection of Workers from Work Contracts. The first method is Stake-weighted Worker Selection, which permits a flexible stake size and selects workers using weighted probability. The second method is Fair Worker Selection, which ignores the stake size and instead selects workers using a uniform distribution.</p><h3>Stake-Weighted Worker Selection</h3><p>This method uses the proportional size of a worker’s stake to determine the probability that they are selected for the next job.</p><p>For example: imagine there are two workers where one has staked 1000 tokens while the other has staked 2000 tokens. The workers can be mapped to the probability space using their tokens:</p><blockquote>[0, 1000)[1000, 3000)</blockquote><p>The space consists of intervals, whose length is determined by the number of tokens a Worker has staked. When we wish to select a Worker, we generate a pseudo-random number in this space and select the worker to whom the chosen interval belongs.</p><p>More formally, we are looking to sample from a discrete probability distribution. This is a well-known problem and there are a number of algorithms we can use, each with their own advantages and disadvantages. I will detail the linear search, binary search, and the alias method.</p><h4>Linear Search</h4><p>Linear search is the most naive approach of the algorithms. Here we store a list of Workers that represents the order of the intervals in the space. When we wish to select a Worker we generate a pseudo-random number then iterate through the list to find the interval that contains it.</p><p>We assume we are using a doubly linked list with an index that maps Workers to list nodes.</p><p><strong>Time Complexity</strong></p><ul><li><em>Insertion:</em><strong> </strong>Updating the list of workers would be extremely fast; we can simply append to the end of the list. This can be done in constant time, as the time needed to insert remains constant no matter how many workers are in the list. Constant time is O(1).</li><li><em>Removal:</em> if we use a doubly linked list and index the nodes then we can perform removal in O(1) by using the index to look up the node and unlink it.</li><li><em>Search:</em><strong> </strong>To find the correct interval we would need to look at (potentially) every single worker in the list. Thus it’s O(n), as the time to search would increase linearly with the number of workers.</li></ul><p><strong>Space Complexity</strong></p><ul><li><em>Insertion:</em> O(1)</li><li><em>Removal:</em> O(1)</li></ul><h4>Binary Search</h4><p>This method improves on the Worker selection by sorting the list of Workers and subdividing the search space in iterations.</p><p>We assume that we are using an array to store the sorted intervals.</p><p><strong>Time Complexity</strong></p><ul><li><em>Insertion:</em><strong> </strong>First we find the right spot for the element in the list, and then we insert into the array by shifting the elements. O(log2(n)) + O(n)</li><li><em>Removal:</em> First we find the element in the list, then we remove it and shift the elements of the array back. O(log2(n)) + O(n)</li><li><em>Search:</em> O(log2(n))</li></ul><p><strong>Space Complexity</strong></p><ul><li><em>Insertion:</em> We would make n writes at worst case, so O(n)</li><li><em>Removal:</em><strong> </strong>We would make n writes at worst case, so O(n)</li></ul><h4>Alias Method</h4><p>The alias method allows us to select a worker in constant time. The method works by aliasing elements that are weighted below average to ones that are above average. There are two arrays; the first stores the probabilistic weight of each worker, the second stores the alias of each worker.</p><p>When a worker is to be selected a pseudo-random number between 0 and 1 is generated. That number is normalized to the number of workers and rounded to the next lowest integer to select a worker from the first array. The remainder from the rounding is then used as a ‘coin toss’ to determine whether to select the first element, or it’s alias. If the remainder is less that the probability of the worker, then select the worker. Otherwise select the worker’s alias.</p><p><strong>Time Complexity</strong></p><ul><li><em>Insertion:</em> The algorithm is known to need O(n) to calculate the arrays</li><li><em>Removal:</em> We’d need to recalculate the arrays, so O(n)</li><li><em>Selection:</em> Selection always take the same number of steps, so O(1)</li></ul><p><strong>Space Complexity</strong></p><ul><li><em>Insertion:</em><strong> </strong>O(n) to store the two arrays</li><li><em>Removal:</em> O(n) to re-calculate the two arrays</li></ul><h4>Limitations</h4><p>If we start to consider space complexity in terms of gas, we can see the limitations of each algorithm using rough estimates.</p><p>As seen below, implementing a weighted selection algorithm isn’t feasible for high numbers of Workers with the current Ethereum gas limits (8,000,000). Linear search is fast to update, but the selection is expensive. At 1,000 workers linear search costs 200,000 gas, and that estimate only includes the SLOAD opcode. Binary search and the alias method don’t even begin to approach that efficiency; at 100 workers they’re already hitting 2,000,000 in gas costs.</p><p>For this reason, most Work protocols that utilize Stake-weighted selection limit the number of Workers numWorkers = _numWorkers;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*XTTmBb8ScQVmd-YkXDSLBQ.png" /><figcaption>Gas costs in 3 different Work contract algorithms with 100 Workers</figcaption></figure><h3>Fair Worker Selection</h3><p>Selecting workers using an even probability simplifies the cost dramatically. By removing the weighted probability we no longer need to search to find the matching interval, instead we can simply pseudo-randomly select a worker from an array.</p><p>The most equitable way to structure such a Work contract is to explicitly define the stake size per worker require(msg.value == workerStake); This, admittedly, has the down side of requiring Workers who hold large amount of stakes to run multiple Worker accounts and would disqualify Worker candidates who do not meet the minimum required stake.</p><h4>Array Storage</h4><p>Assume we store the workers in an array and have a mapping from worker to array index.</p><p><strong>Time Complexity</strong></p><ul><li><strong>Insert: </strong>We can push a new worker onto the end of the array in O(1)</li><li><strong>Remove:</strong> We can find the array index using the mapping, then put the last element into that slot in O(1)</li><li><strong>Select:</strong> We generate a pseudo-random number in the range [0, n) and use that to index the workers array in O(1)</li></ul><p><strong>Space Complexity</strong></p><ul><li><strong>Insert: </strong>inserting one element would write once onto the end of the array O(1)</li><li><strong>Remove:</strong> Removing one element will clear the old value and transfer the last in O(1)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*gMsZLgn5blDodLvMv6J-UA.png" /><figcaption>Gas costs in Fair Worker Selection algorithm with 100 Workers</figcaption></figure><h3>Conclusion</h3><p>We have outlined two broad categories of Worker selection: Stake-weighted and Fair. Stake-weighted worker selection selects workers with a probability proportional to the size of the Worker’s stake, while in Fair selection all Workers have an equal chance of being selected. We found that the gas costs of stake-weighted selection algorithms increase along with the number of Workers, whereas Fair selection gas costs remain constant.</p><p>Some stake-weighted approaches limit the number of workers, such as LivePeer which limits it’s number of workers to twenty. If the number of workers is small or capped to a few hundred workers or less, then a stake-weighted algorithm may be feasible. Gas costs for linear search would only be in the hundreds of thousands. If you select a worker far more often than you update the workers an algorithm such as the alias method may be more gas-efficient.</p><p>Fair worker selection, on the other hand, can support an unlimited number of workers (potentially). Its only drawback is that it’s not possible to favor particular workers.</p><p>In summary, the worker selection algorithm you choose will be highly dependent on your use-case. It’s important to consider the limitations of the algorithms before deciding on which one to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=359cc12e920a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/creating-a-work-token-part-i-359cc12e920a">Creating a Work Token — Part I</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenCare powered by MedX is now live on Ethereum Mainnet]]></title>
            <link>https://medium.com/medxprotocol/opencare-powered-by-medx-is-now-live-on-ethereum-mainnet-998b05c23a75?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/998b05c23a75</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[live]]></category>
            <category><![CDATA[telemedicine]]></category>
            <dc:creator><![CDATA[James Todaro, MD]]></dc:creator>
            <pubDate>Thu, 11 Oct 2018 23:16:01 GMT</pubDate>
            <atom:updated>2018-10-20T00:42:55.424Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emEHpPihWPFgkHdpzj9raw.jpeg" /></figure><p>After a year of development and four months of public testing, OpenCare is now live on Ethereum Mainnet! To our knowledge,<strong> this is the first ever healthcare application that uses Ethereum smart contracts to achieve true peer-to-peer consultations.</strong></p><p><strong>In the initial launch, OpenCare makes it possible for referring healthcare providers worldwide to quickly obtain diagnoses and recommendations from a global network of physician specialists.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsMhp94_iPZQ%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsMhp94_iPZQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsMhp94_iPZQ%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/fa850eb918736d0ad29ac172d35aa5d6/href">https://medium.com/media/fa850eb918736d0ad29ac172d35aa5d6/href</a></iframe><p>About half of the world population — 3.8 billion people — do not have access to basic healthcare. Even fewer have affordable access to physician specialists, such as dermatology and ophthalmology. In the USA, according to HRSA, 28% of the population does not have access to specialty care.</p><blockquote>Access to primary care is far from a guarantee that specialty care is available if needed.</blockquote><p>OpenCare makes it possible for every primary care provider to treat ailments that would traditionally require separate visits with physician specialists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*cEcv8cn-FsqfW_nWYKA8cQ.png" /><figcaption>Real screenshots from the live OpenCare dApp</figcaption></figure><p>Imagine primary care clinics now empowered with a user-friendly app that allows them to quickly access a global network of specialists via telemedicine. For any patient with, for example, a skin ailment, a primary care provider could use the app to snap some photos, provide a brief description and submit the case to a global network of board certified dermatologists attached with a small payment. Minutes later, a medical diagnosis and treatment plan will guide the primary care provider in prescribing treatment and follow-up. Primary care clinics that use OpenCare to support subspecialty services will be more convenient and affordable for patients — drawing larger patient volumes. Everybody wins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vafxE32iC_-Zztbp87qqyQ.jpeg" /><figcaption>Healthcare clinic in Malaysia</figcaption></figure><p>On-boarding primary care providers to OpenCare is a big step toward adoption. While patients individually may only use a healthcare app a few times a year, primary care physicians encounter multiple patients daily who need specialist attention.</p><blockquote>A good experience on OpenCare can result in a single primary care provider using the app hundreds of times a month.</blockquote><p>With just 100 primary care providers worldwide on OpenCare, it would be possible for <strong>OpenCare to become one of the most popular dApps on DappRadar.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__qqRROeNtkZHd0vYrRu9w.png" /><figcaption>DappRadar leaders by number of daily users as of October 10, 2018</figcaption></figure><h3>Why doesn’t Teladoc do this already?</h3><p>Teladoc is presently the largest US telehealth company, and is valued at about 5 billion USD. As a centralized company that controls the storage of patient health information, Teladoc cannot launch a global healthcare market. The regulatory framework for cross-border telemedicine and 3rd party control of health information (e.g. intermediary between patient and physician) does not allow it.</p><p><strong>OpenCare is different from Teladoc in that the entire encounter is controlled by the user. </strong>There is no company behind OpenCare that views or stores patient health information. OpenCare uses Ethereum smart contracts to guide the encounter, client-side encryption for health information and IPFS for decentralized cloud storage. This effectively makes OpenCare a “bulletin board” for healthcare services allowing it to bypass international barriers to cross-border telemedicine. The technology and infrastructure to build this didn’t exist 2 years ago. Now it does and OpenCare will be the first platform to make a global market in telemedicine.</p><p>OpenCare is available for public testing or use at <a href="http://opencare.medxprotocol.com/">opencare.medxprotocol.com</a>. If your MetaMask or Coinbase dApp browser is on the Ropsten testnet, you will be able to demo the app for free, although you will not receive a true medical evaluation. However, for a small fee of 10 USD per evaluation, the live version is available on Ethereum mainnet.</p><p>OpenCare is just the first of many potential applications to be powered by MedX Protocol. As an open system, we look forward to working with health innovators around the world to launch healthcare dApps that eliminate intermediaries and artificial boundaries in today’s health systems.</p><p><strong>About MedX Protocol</strong></p><p>MedX is a permissionless protocol for launching medical dApps that connect patients and physicians worldwide for medical care. Applications on the MedX protocol can be used to eliminate intermediaries and international barriers to affordable care. OpenCare is the first dApp on MedX and creates a market for telemedicine that reduces global disparities in medical care. For more information, please visit us at <a href="https://medxprotocol.com/">https://medxprotocol.com/</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=998b05c23a75" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/opencare-powered-by-medx-is-now-live-on-ethereum-mainnet-998b05c23a75">OpenCare powered by MedX is now live on Ethereum Mainnet</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preparing for the launch of MedX]]></title>
            <link>https://medium.com/medxprotocol/preparing-for-the-launch-of-medx-97d39e1d9e9c?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/97d39e1d9e9c</guid>
            <category><![CDATA[tcrs]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[telemedicine]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[James Todaro, MD]]></dc:creator>
            <pubDate>Thu, 04 Oct 2018 17:31:48 GMT</pubDate>
            <atom:updated>2018-12-20T20:14:33.980Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The community asked us to build. And that’s what we did.</strong></p><p>If the current sentiment of crypto enthusiasts could be summed up in one word, it would be <em>build</em>. Here at MedX, that’s what we’ve done. Instead of obsessing over the cryptocurrency price slump, we have taken advantage of this time to increase our development efforts to be one of the few platforms to successfully launch on Ethereum mainnet in 2018.</p><p>From the day we first conceived the vision for MedX in 2016, our mission has been to create a global healthcare market that is freely available to patients, physicians and developers worldwide.</p><p>The technology and infrastructure to build this open healthcare market is just now approaching a state of maturity, and could not have been accomplished even 2 years ago. <strong>Let’s take a step back to see why.</strong></p><p>When I mention that our team is building an “open global healthcare market,” the first question or comment I receive is either <em>Is that legal?</em> or <em>Healthcare is so regulated, tech progress is slow. Good luck.</em> I agree. These are nearly always prudent comments regarding healthcare innovation. However, they actually highlight the advantage of what we are building here at MedX Protocol.</p><p>One of the key regulation checkpoints in healthcare is storage and transfer of patient health information (PHI). There are pages upon pages of compliance guidelines both locally (in the USA, at the state level) and nationally (e.g. HIPAA, GDPR). These guidelines can be difficult to navigate and costly. Moreover, the guidelines for the international storage and transfer of patient health information are not well delineated. These compliance burdens are a barrier to innovation for startups. Even for established companies or systems, the penalties for a breach or mistake in an uncertain area of compliance can be intimidating.</p><blockquote>In the USA, <strong>a breach of HIPAA can cost an HHS fine up to $1.5 million/violation, State Attorneys General penalty up to $6.8 million, </strong>FTC fine of $16,000/violation,<strong> and a lawsuit up to $1000 per record.</strong></blockquote><p>Given the penalties, it is no surprise that centralized companies cautiously tiptoe toward technological progress when the stakes are so high. <strong>As long as centralized companies control patient-physician encounters and are liable for storage of patient health information, it is unlikely that a global healthcare market will exist in the near future.</strong></p><p>What if the direct control of both health information and selection of healthcare provider was entirely in the patient’s hands? Without a centralized company acting as the custodian of PHI and managing healthcare providers, these compliance burdens disappear.</p><p>In essence, I’m describing an open global healthcare market that can be interpreted as a “bulletin board” for health services. <strong>This is the MedX Protocol advantage.</strong> Patients worldwide can immediately connect with a global network of physicians, and provide the relevant health information for diagnoses and treatment plans via telemedicine.</p><blockquote>Studies shows that up to 75% of in-office health visits can be addressed via telemedicine over video or pictures.</blockquote><p>On MedX, at no point does a centralized company have the power to view, control, store or transfer patient health information. It is entirely in the patient’s hands what health information is shared with a physician.</p><p>Again, the technology to build this decentrally maintained global health market was not available until just recently. It requires a public blockchain with smart contract functionality (e.g. Ethereum), IPFS for decentralized cloud storage, mobile dApp browser (e.g. Coinbase wallet dApp browser), and client side encryption. All of this technology is employed in the MedX Protocol. <strong>The result is a global healthcare market controlled by the people who use it.</strong></p><p>Since 2016, we have built out the critical infrastructure to move that mission forward and are rapidly becoming well-positioned for a successful launch of the MedX health system. Let’s go ahead and dive into the layers of the MedX health system that we have developed thus far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeWZrjNYqsgOIIHxTbkT8Q.png" /></figure><h3>Protocol Layer</h3><p>The protocol layer consists of our decentralized physician registry, <strong>MedX</strong>. We have developed the first token-curated registry (TCR) of physicians. For those unfamiliar with TCRs, a TCR is a decentrally maintained list judiciously curated by token holders in exchange for economic rewards. Upon launch of MedX, verifiers around the world will carefully curate and decentrally maintain a global pool of licensed and certified physicians in exchange for MEDX tokens and ETH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKLUUN5xvMdNOymRN5GIiw.png" /><figcaption>Screen capture of Alpha release of MedX. List of physicians interface.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kd99f6-1Lw9EwD5L2Vlf2Q.png" /><figcaption>Interface for viewing and verifying physician credentials.</figcaption></figure><p>The MedX Physician Registry will be freely available for any 3rd party healthcare application or dApp dev team to access. This means that any healthcare application will have immediate access to a global network of physicians from a multitude of specialties.</p><p>The Alpha release of the MedX Registry has been privately tested since June 2018, but is now available at <a href="http://registry.medxprotocol.com/">registry.medxprotocol.com</a>. Alternatively, a <a href="https://youtu.be/mYRv4DNhuOY">video demonstration</a> of the registry is now available.</p><h4>MedX Registry Development Milestones</h4><ul><li>MedX physician registry smart contracts deployed on Rinkeby testnet</li><li>Integration with IPFS for decentralized storage of physician credentials</li><li>Integration with the Civic Secure Identity Ecosystem for convenient physician login</li><li>MEDX wallet integrated with MetaMask and user interface</li><li>Friendly user interface for reviewing, flagging or verifying physician credentials</li></ul><h3>DApp Layer</h3><p>Any 3rd party developer or existing healthcare application can access the MedX registry for an instant pool of physicians. After months of rigorous development, we built <strong>OpenCare</strong> as the first dApp to be launched on the MedX Protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*w8XzZu6kjcUCzgFYRMzRWQ.jpeg" /><figcaption>Applications that can be built on MedX</figcaption></figure><p>OpenCare will give patients and referring healthcare providers access to a global network of specialists for diagnosis and treatment recommendations. Dermatology for the diagnosis and treatment of skin ailments will be the first specialty supported on OpenCare, but it will later include ophthalmology, radiology, psychiatry and general practice medicine.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgifs.com%2Fiembed%2FvoExvm&amp;url=https%3A%2F%2Fgifs.com%2Fgif%2Fvideo-demo-of-opencare-powered-by-medx-protocol-voExvm&amp;image=https%3A%2F%2Fj.gifs.com%2FvoExvm%40small.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gifs" width="480" height="270" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c0606509a655b29ceb3bc25f4f172df/href">https://medium.com/media/6c0606509a655b29ceb3bc25f4f172df/href</a></iframe><p>OpenCare is a true dApp in the sense that the patient-physician encounter is controlled by Solidity smart contracts, patient health information is encrypted on the client side and uploaded to IPFS for decentralized cloud storage, private keys are patient-controlled and physicians are granted access to health information directly by patients in signed transactions. At risk of ad nauseam, the MedX Team cannot view or control patient health information, and OpenCare is essentially a “bulletin board” that connects patients with physicians.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1KAQQySvc5m63kr9UotPA.png" /><figcaption>OpenCare patient interface on mobile</figcaption></figure><p>In public beta testing since July 2018, OpenCare will be launched on Ethereum mainnet by October 11, 2018. The product video demo can be viewed <a href="https://youtu.be/sMhp94_iPZQ">here</a> or you can test it for yourself at <a href="http://opencare.medxprotocol.com/">opencare.medxprotocol.com</a>.</p><h4>OpenCare Development Milestones</h4><ul><li>Integration with IPFS for decentralized storage of patient records</li><li>Automated image compression for faster uploading/downloading</li><li>General-purpose redux-saga library to interact with Ethereum Virtual Machine</li><li>Online/offline pubsub for efficient distribution of patient cases to online physicians</li><li>Built-in faucets for maximum convenience</li><li>Friendly user interface for both patients and physicians with notifications, status bars and MetaMask integration</li><li>Partnership with MakerDAO and integration with DAI token and ETH for payment</li><li>Compatibility with mobile Coinbase wallet dApp browser</li></ul><h4>Formation of OpenCare Clinical Advisory Board</h4><ul><li>Arjun Dupati, MD</li><li>Dhwani Mehta, MD</li><li>Noor Tazudeen, MD</li><li>Nikhil Shyam, MD</li><li>Mario Mitkov, MD</li><li>Ryan Trowbridge, MD</li><li>Newsha Lajevardi, MD</li><li>Ivanka Kovalyshyn, MD</li><li>Geeta Patel, MD</li><li>Rohit Kakar, MD</li></ul><h3>Final Words</h3><p>As is the case with most decentralized systems, there is some initial degree of centralization during the infancy state to ensure that there is a smooth mainnet launch. For OpenCare, this will initially consist of a small pool of licensed dermatologists available to provide recommendations for skin ailments.</p><p>However, once the MedX Registry is launched on Ethereum mainnet in Q1 2019, OpenCare will access the MedX physician registry to be a fully decentralized ecosystem from Ethereum blockchain to application layer, and will support a multitude of medical specialties (not just dermatology). Moreover, any 3rd party will be freely able to launch their own unstoppable medical dApps on the MedX Protocol.</p><p>Lastly, we would like to thank all those in our community for testing and providing feedback these past few months!</p><p>For any questions, we are available on <a href="https://t.me/medxprotocol">Telegram</a> or you can visit us at <a href="https://medxprotocol.com/">https://medxprotocol.com/</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97d39e1d9e9c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/preparing-for-the-launch-of-medx-97d39e1d9e9c">Preparing for the launch of MedX</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Deployment with Truffle]]></title>
            <link>https://medium.com/medxprotocol/continuous-deployment-with-truffle-c4dfd4fcfd96?source=rss----85136d33f8b---4</link>
            <guid isPermaLink="false">https://medium.com/p/c4dfd4fcfd96</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[truffle]]></category>
            <dc:creator><![CDATA[Brendan Asselstine]]></dc:creator>
            <pubDate>Tue, 25 Sep 2018 15:01:03 GMT</pubDate>
            <atom:updated>2018-09-25T15:01:02.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gmn0RvJ05hXBpf5Hju9F1w.png" /></figure><p><em>TLDR; I’ve developed a tool called </em><a href="https://github.com/MedCredits/truffle-deploy-registry"><em>Truffle Deploy Registry</em></a><em> that separates your deployed contract addresses by network from the Truffle complication artifacts. Compatible with all versions of Truffle (up to the latest 5.0)</em></p><p>Continuous deployment is achieved when changes to a codebase are automatically pushed live, whether to a staging or production environment.</p><p>Typically:</p><ol><li>Code is pushed to a repository</li><li>Tests are run on a continuous integration (CI) server</li><li>If tests pass, code is deployed.</li></ol><p>Continuous deployment allows us to iterate rapidly with a product.</p><p><a href="https://truffleframework.com/">Truffle</a> is a fantastic tool for smart contract development that makes testing and deploying contracts a breeze. The only issue preventing it from smoothly integrating with continuous deployment is the fact that it generates very heavy artifacts.</p><p>Truffle artifacts contain the addresses at which the contracts are deployed. These artifacts can be pulled in or referenced by front-end code so that we can interface with them. However, the artifacts also include local filesystem paths that make them unsuitable to commit to the repository. Continuous deployment can only pull information from committed files, so how do we get around this?</p><p>I’ve developed a tool called <a href="https://github.com/MedCredits/truffle-deploy-registry">Truffle Deploy Registry</a> that separates the deployed contract address from the artifacts into files separated by network. You can .gitignore the local development networks, and commit testnet files so that the CI server can pick them up.</p><h3>Truffle Deploy Registry</h3><p>Truffle Deploy Registry works in two stages:</p><ol><li>New deployment entries are recorded in a network-specific JSON file.</li><li>The latest deployment entries are merged with the truffle artifacts after compilation.</li></ol><p>Typically with Truffle you’ll be using migrations to deploy and update your smart contracts. To add contracts to the deploy registry, you must append them within your migrations:</p><pre>// migrations/1_initial_migration.js<br><br>var append = require(&#39;truffle-deploy-registry&#39;).append<br>var Migrations = artifacts.require(&quot;./Migrations.sol&quot;);<br><br>module.exports = function(deployer, network) {<br>  deployer.deploy(Migrations).then(() =&gt; {<br>    return append(<br>      deployer.network_id,<br>      { contractName: &#39;Migrations&#39;, address: Migrations.address }<br>    )<br>  })<br>}</pre><p>Now that contract address will be appended to the registry for the deployed network. If you have deployed to mainnet and Ropsten, you will now have the files:</p><pre>networks/<br>  1.json<br>  3.json</pre><p>Inside each of those files will be a list of deployed contracts. You would see something like:</p><pre># networks/1.json<br>[<br>  {<br>    contractName: &#39;Migrations&#39;,<br>    address: &#39;0x3383c29542b8c96eafed98c4aafe789ddb256e19&#39;<br>  }<br>]</pre><p>Now you have a registry of where those contracts are stored. To merge those addresses back into the Truffle compilation artifacts you would use the <strong>apply-registry</strong> command. It takes the path to the build artifacts as a parameter:</p><pre>$ apply-registry build/contracts</pre><p>This ensures that the artifacts contain all of the *newest* addresses defined in the registries in the networks directory.</p><p>Now, when your CI server builds your front end code and pulls in the artifacts they will all have the correct addresses.</p><p>I hope this helps you in some way. Check out <a href="https://github.com/MedCredits/truffle-deploy-registry">Truffle Deploy Registry</a> on Github!</p><p>Brendan Asselstine</p><p>Medium: <a href="https://medium.com/u/450060e6b469">Brendan Asselstine</a></p><p>Github: <a href="https://github.com/asselstine">https://github.com/asselstine</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4dfd4fcfd96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/medxprotocol/continuous-deployment-with-truffle-c4dfd4fcfd96">Continuous Deployment with Truffle</a> was originally published in <a href="https://medium.com/medxprotocol">MedX Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>