Into the Ether: Walkthrough, Gotchas, and Tips for Ethereum Development

I’ve written countless lines of code in my life, but I’ve recently deployed code that will live forever. It resides on the Ethereum blockchain and can be executed decades from now, outliving any domain name I’ve ever purchased and outliving every internet company that has ever existed. Long after I pass away, when there’s no one to update the code base, no one to pay App Store fees, no one to renew domain names or pay server fees, this code will keep on running. This code runs not on a monolith tech company’s servers, but will run on millions — billions — of people’s computers, making it perpetual and unstoppable.

This is the promise of Ethereum, an emerging platform for decentralized, blockchain-based applications. The promise of a democratic, transparent, and decentralized Internet version 2.0 has fueled the skyrocketing price of Ether — the cryptocurrency powering the platform — from 4 Ether per Bitcoin (at the time of launch, about 1 Bitcoin was about $500) to $15 per Ether, an astronomical increase during the past 2 years. Ethereum can no longer be dismissed as a tech cult. While the world sleeps, household names such as Microsoft (which has incorporated Ethereum’s new Solidity programming language into Visual Studio) and JP Morgan Chase, recognizing how revolutionary the concept of Ethereum is, are investing in the vision. Ethereum has made headlines in the New York Times, and children of Ethereum such as The DAO (Decentralized Autonomous Organization) have also been featured in widely-read publications such as the Economist.

In this article, I offer practical pro-tips and gotchas for writing and submitting contracts on the Ethereum blockchain, along with a vision for Ethereum’s future. The process of running the Ethereum client will vary depending on which version of the client you use and your operating system. I’m a die-hard Linux user and prefer the Ethereum Go client over others; if you’re running Mac OS X or Windows (or another client), your experience will be slightly different.

You’ll note that both the Ethereum Wallet (Mist) and the Mix IDE are featured on the Ethereum homepage as graphical interfaces that allow users to create, debug, and deploy contracts. I eagerly await a mature version of the Mix IDE, as the current version is still in concept stage. I’ve always preferred command line to GUIs for the control and transparency they offer, and so, after experimenting with different clients, I ended up choosing the Go client.
The Ethereum website now has several handy code samples for things like creating a new currency, an autonomous organization with its own voting mechanisms, or launching a crowdsale — tasks conceivable only through the novelty of Ethereum’s decentralized structure. Running the simple “hello world” Greeter contract can be challenging for newbies. Here are a few tips that will hopefully get you up and running more quickly:

  1. After installing the geth client, follow these instructions to create a new account and remember the password! Remember it like your own name but guard it like your biggest secret.
  2. Now you’ll have to download the blockchain to your node. This process can take several hours and will begin once you run the geth command. The terminal will print out which block is being downloaded, and you can track your progress by comparing that block with the latest block on the chain.
  3. Once your node is updated, open another terminal window and enter geth attach. This opens the geth console while creating a single concurrent session between the two windows.
  4. Within the console, try eth.accounts to see your account addresses. You might want to copy these somewhere convenient but safe for your own reference. eth.getBalance(eth.accounts[0]) will print out the balance in wei (1^18 wei = 1 Ether). If your balance is zero, you will have to add Ether to your account before you can deploy contracts to the blockchain. Pro users can upload their presale wallets, or if you’re coming later to the game (or want to be cautious) you can buy Ether on an exchange such as Kraken and transfer Ether to your account address. This reddit post describes the process well. Note that after successfully transferring Ether (the transaction itself shouldn’t take more than a few seconds), your client will need to be fully synced to the network before eth.getBalance(eth.accounts[0]) command will show your updated balance. You can verify that your transaction was successful on this website by entering your address, while you’re waiting for your client to sync.
  5. Nice work if you’ve made it this far (it may take a few days, depending on your experience and if you already have Ether or a trading account). Now you can start deploying your contract to the blockchain so it can bask in immortality. Close all terminal windows, open a new one, and enter: geth –unlock=0 –password=”/path/to/your/password” where “/path/to/your/password” is a file containing nothing but your account password from step #1.
  6. Open another terminal window and enter geth attach. This will open the geth console. Then follow the steps in the Greeter tutorial to launch your first Hello, World! contract. Common reasons for not succeeding at first are not unlocking your account (or using the wrong account), not having enough Ether in your account, and not completely syncing the blockchain on your node. More precisely, you must have downloaded at least the block that contains the transaction in which you transferred Ether into your account (if this sentence doesn’t make sense, don’t worry — just sync your node and be patient while this happens) so your local Ethereum client can “see” the transaction.

After working through these steps and browsing StackExchange and Ethereum forums while you get up and running, the fun part really starts. So you’ve become a believer in Ethereum. You’ve even bought some Ether and deployed your first contract. The big question now is, what makes Ethereum a revolutionary act rather than just another blockchain startup based on yet another programming language called Solidity.

 

If you’ve ever read (and comprehended) Hofstadter’s Gödel, Escher, Bach: An Eternal Golden Braid, you’ll appreciate that meaning is intrinsically tied to form. Ethereum’s significance lies in the fact that Solidity is a Turing-complete language running on the blockchain. That is, it is entirely decentralized and contracts are fully transparent. I’ve jumped on innumerable hot new technologies and platforms in the 18 years I’ve been coding, some of which take off, many of which fizzle away in a cloud of hype. I believe that Ethereum may be one of the most substantial events I will witness in my life due to its form (i.e., a Turing-complete language running on a blockchain).
Surprisingly, several dozen Ethereum-powered dapps (as they’re called) are already live. Ethereum developers are still trying to wrap their heads around the essence — the form — of a dapp, which are largely in concept or early beta stages. The fact that Ethereum is not yet mainstream means that the pool of potential dapp users consists of a small number of tech savvy individuals, in contrast to the huge pool of iOS and Android users who can effortlessly download apps via the App Stores.

 

What many people, who don’t understand the technical underpinnings of the Ethereum Virtual Machine (EVM), don’t realize, is the following:

“Roughly, a good heuristic to use is that you will not be able to do anything on the EVM that you cannot do on a smartphone from 1999. Acceptable uses of the EVM include running business logic (“if this then that”) and verifying signatures and other cryptographic objects; at the upper limit of this are applications that verify parts of other blockchains (eg. a decentralized ether-to-bitcoin exchange); unacceptable uses include using the EVM as a file storage, email or text messaging system, anything to do with graphical interfaces, and applications best suited for cloud computing like genetic algorithms, graph analysis or machine learning.” (Ethereum Wiki)

Keep this in mind as you dream up your dapps, contracts, and DAOs. This isn’t just another app platform; this is Ethereum. To give birth to revolutionary ideas on the Ethereum blockchain, you need to respect its form.
 

I’m thrilled to be part of a small but growing community of dreamers writing code on the blockchain. What are you working on? Send me a line and let’s connect.
Omar Metwally, MD (@osmode)
omar.metwally@gmail.com

Find me on LinkedIn
Read this on Quora
My consulting website

Doctor will work for Ether: Decentralized autonomous health insurance

Once Upon a Time a young man named Vitalik Buterin presented the concept of “Ethereum” to the cryptocurrency community. Vitalik became a Thiel Fellow and persuaded the world that there’s a better way to write laws, organize ourselves politically, and conduct transactions using a Turing-complete language built on the blockchain.

I would have never imagined, when I began developing on the Ethereum platform, that the concept of a decentralized autonomous organization (DAO) would make popular media headlines so soon. This is the start of something remarkable.

When I presented my vision for decentralized autonomous health insurance in June 2014 at the BitTorrent headquarters, Chris Peel, the founder of the Ethereum Bay Area Meetup, asked me how I would realize my vision. “Well…” I began, “operating health insurance is a big undertaking!” I said, scratching my head. Two years later, the time for a better way to insure our health and pay for health services is here. By cutting out the middle people, Ethereum-powered smart contracts and DAOs promise to dramatically reduce the cost of health services. Why should most of our outrageously over-priced health insurance premiums feed bloated corporations and their executives?

Ancient Chinese physicians practiced preventive medicine par excellence. In ancient China, physicians were compensated when their patients enjoyed good health, not when they grew ill – the opposite of our reactive, fee for service-based health system. Ethereum is our opportunity to end the healthcare crisis, and it’s incumbent on us to carry forth this effort.

DOCTOR WILL WORK FOR ETHER.
NOW ACCEPTING NEW PATIENTS.

Send me a line at omar.metwally@gmail.com

Omar Metwally MD
@osmode

Carly, a voice-activated health coach for Amazon Echo

carly_cropped

Since my team won MIT’s Hacking Medicine hackathon 2 years ago with an app that generates structured documentation from an unstructured patient-doctor interaction (by passively listening and watching the interaction), I’ve taken on the challenge of natural user interfaces. Recently, APIs such as Google’s WebSpeechAPI, which I’ve used in the setting of academic research, proved their ability to convert speech to text with enough fidelity to be useful in real-life applications. With devices like Amazon Echo and wide-range microphones capable of discerning speech through ambient noise, we’ve bypassed the second major hurdle in natural user interfaces.

Now it’s time to start bidding farewell to keyboards, mouses, and ugly software that looks like an Excel spreadsheet. Instead of scrolling through a mind-numbing list of vital signs and lab values in an electronic health record, a provider should simply be able to say: How high did John Doe’s blood pressure get in the past 4 hours? or Trend Jane Doe’s creatinine level over the past week. This is what I mean by natural language interface: software that allows humans to interact with it in the same way humans think, which is through natural speech.

If you have an Amazon Echo, check out my new Alexa Skill, Carly, a voice-activated health coach for Amazon Echo. The next stop will be introducing doctors to Carly and the joy of natural user interface.

Conceptualizing health and illness through word embeddings

20 minutes into her conversation with a patient with a diagnosis of irritable bowel syndrome (IBS), Dr. Zurcher realizes that she and her patient aren’t at all on the same page. With her own concept of “IBS” in mind, she tries her best to convey the fact that IBS is a syndrome characterized by constipation and/or diarrhea . Her patient, on the other hand, is less interested in discussing his constipation or medication for IBS than he is in bringing to his doctor’s attention his crippling social anxiety, which disrupts his life much worse than any of his gastrointestinal complaints. Dr. Zurcher’s grasp of IBS as a diagnosis established according to the Rome III criteria, while medically sound, has little to do with her patient’s conceptualization of his diseases, and unless she appreciates this, the encounter is unlikely to be productive.

As much as medical schools and residencies train physicians to listen carefully to their patients, physicians invariably approach the patient encounter with an agenda (to document a patient encounter, generate ICD-10 codes, and establish a problem list and plan) that doesn’t always coincide with a patient’s agenda.

To better understand how my patients conceptualize health and illness, I trained gensim’s word2vec implementation on 2 million disease-specific tweets. The beauty of this method is its capacity to uncover both obvious and less obvious semantic relationships among words. I challenge healthcare professionals to contrast their understanding of disease with their patients’ conceptualizations of  illness.

Try searching for “heart failure”, “obesity”, “alcohol”, or “IBS”, for example. Each query returns the 10 semantically and/or lexically nearest neighbors in 100-dimensional space, along with their cosine similarity to the query term. The closer to 1.0, the closer they are in hyperspace.

Screenshot from 2016-03-04 23:56:44

Machine Understanding

I’m at the opera house watching The Nutcracker. Toward the end of Act II, Scene 1, one of the lead ballerinas stumbles, nearly falling over. The audience falls silent, but before anyone can grasp what’s happening, she leaps into her role again. Thunderous applause follows the curtain’s fall, despite the less than perfect rendition. In the next scene, a robot replaces Ms. Akhmatova, and robo-ballerina executes an immaculate interpretation of the “Dance of the Sugarplum Fairy.”

As I wait in the long line to the men’s restroom in this fictional opera house, I ask myself which of the ballerinas, Ms. Akhmatova or robo-ballerina, has a better grasp of the ballet. If the essence of a ballet lies in its execution, does the robot, with its flawless performance, “understand” the ballet more completely than Ms. Akhmatova, whose occasional missteps fail to escape the seasoned observer?

With “Recursive Neural Networks Can Learn Logical Semantics”, Samuel Bowman, Christopher Potts, and Christopher Manning successfully trained recursive neural networks (RNNs) to apply logical inference to natural language. Like many other pivotal scientific works, the significance of this phenomenal work won’t become fully appreciated or manifest except in retrospect. Machine learning (ML) researchers have been applying neural networks (NNs) to a variety of problems, from image recognition to signal processing, but as a student of natural language processing, this work renewed my faith in neural networks’ capacity to live up to the term “deep learning” and uncover profundity in data.

There is a tendency among non-technical admirers of ML to regard these methods as beyond their creators: independent entities that will one day, given refined enough algorithms and enough energy, out-comprehend their human creators and overwhelm humanity with their artificial consciousnesses. The term “neural networks” is itself a misnomer that doesn’t at all reflect the elaborate complexity of how human neurons represent and acquire information; it’s simply a term for nonlinear classification algorithms that began catching on once the computing power to run them emerged.

The question of whether or not Samuel Bowman’s NN, or the robo-ballerina in the opening scenario, are capable of “understanding” is largely a theoretical concern for the ML practitioner, who spends the bulk of his or her time undertaking the hard work of curating manually labeled data, fine-tuning his or her neural classifier with methods (or hacks) such as dropout, stochastic gradient descent, convolution and recursion, to increase its accuracy by a few fractions of a percentage point. Ten or twenty years from now, I imagine we’ll be dealing with a novel set of ML tools that will evolve with the rise of quantum computing (the term “machine learning” will probably be ancient history, too), but the essence of these methods will probably remain: to train a mathematical model to perform task X while generalizing its performance to the real world.

I don’t mean to detract from the brilliance of Sam Bowman’s work. I don’t remember the last time a scientific paper excited me so much (in contrast to the medical literature, with its mantra of randomized control trials and cohort studies), and I can’t help but let my imagination wander at the thought that a RNN can actually learn logical inference. As exciting as I find Bowman et al’s paper, it also led me to grapple with the hairy question: What is understanding, and what is mimicry? Trying to answer this question (without using the word “consciousness”) led to a great deal of mental turmoil that culminated in the writing of this essay.

Professor Timothy Winters, a philosopher from Oxford University, praised man’s ability to name as his/her greatest gift. Implicit in this statement, I think, is man’s ability to conceptualize. When I call the energy illuminating my desk lamp “electricity,” I’m not just associating a phonetic time series with my halogen bulb’s white glow, I’m also instantiating an abstract class of natural phenomena and associating with it a body of hypotheses (for instance, Ohm’s Law and Kirchoff’s circuit laws). Had I called this “light” instead of “electricity”, I would have been operating under a different set of hypotheses using different mental schemata.

So what is understanding? To understand is to admit that one doesn’t comprehend anything at all. To understand is to use our uniquely human ability to create mental schemata of the world, models for how things and people interrelate and to systematically test and revise these hypotheses. These models might be inspired by a combination of personal experience, bodies of scientific thought, religion or spirituality, but they represent models nevertheless that are subject to change, and we ought accept them as such else we one day discover our worlds as brittle as the models themselves.

My understanding of people as inherently good, or my understanding of myself as a member of society with a moral duty to serve others, or my belief in human reason, are models subject to change based on my own experiences and the experiences of those who influence me. The word “understand” is itself utopic, an attempt at an ultimately impossible feat.

5 years in pursuit of meaning

There is a zen to hard work that leaves one too weary to think deeply about anything. I’ve spent the past week working 14-16 hour days, caring for patients and not writing code. It was a typical week on the medical wards. These are days of fasting, days that leave me spiritually satisfied but intellectually starved.

But today I’m rested and at peace with my thoughts for the first time in a long time. A question that has been whirling about in my mind’s undercurrents for years now resurfaces, as it does on days like these, bobbing up and down, restlessly spinning on its way downstream. Cool mist sweeps over San Francisco; my French press stands at the edge of my desk, the smoky taste of dark coffee lingers on my tongue.

I sift through the bold, curly lines my Uniball pen leaves on my Moleskine’s thick pages in pursuit of meaning. This act is mechanically easier when I write on paper than when I type on my PC, but the search is just as fruitless. I comb through words and brush them off the notebook’s lined pages until I’m staring at a blank page, and I start to make out an image of a cold, overcast day in October 2012. I’m reading Wittgenstein’s Tractatus logico-philosophicus in the original German on the balcony of my Berlin apartment. A woman next to me sips her coffee and lights a cigarette. All around us Berlin is perpetually becoming but never being [1]. I blink, and a new skyscraper appears. The young woman puts out her cigarette, and passengers exit a new train station that wasn’t there moments ago.

Wittgenstein’s words overtook me like a hallucinogen, profoundly changing the way I would think and perceive the world thereafter. The zen-like opening lines “Die Welt ist alles, was der Fall ist” (“the world is everything, that happens to be the case”) lead into crisp deductive reasoning that uses logic to piece together a Weltbild as sound and beautiful as a diamond. The truth is in logic, I thought, that unadulterated fabric holding the world together — free, unbiased, untainted by language, loyal to no school of thought and no civilization of the Occident or Orient. And so I felt, for the subsequent years, that I had stumbled upon something extraordinary. Pull the fabric here, and this happens. Pull it there, and that will happen.

My faith in logic and love for words led me to the discipline of “natural language processing”, a term I grow to dislike the more experienced I become in the field. Nearly every day for the past year, I spend a few hours dipping my bucket in the endless ether, collecting data and running calculations. The results themselves are scientifically interesting, but the more data I have, the more removed I feel from that original goal of understanding semantics, to hold the word “coffee”, squeeze it between my fingers, and watch the dark drops of meaning stain my pages, drops whose coarse texture I can feel between my fingers, drops whose bitterness I can taste on my tongue, smear across the page, and say: “Here it is! Here is the meaning of the word!”

Five years into my pursuit of meaning and I catch myself in a free-fall, grasping for “it” but reaching only that logical fabric connecting words with one another. I can hardly even make out the individual words. Dangling from the fabric holding together “cool” and “mist”, my fingers cramp, my muscles ache…I can’t hold on any longer…

…I fall…

…and catch myself on the fabric connecting “sweeps” and the prepositional phrase “over San Francisco.” My fingers slip, and I fall again…This continues, again and again and again, until I begin to wonder, in my exhausted delirium, whether words themselves are entirely devoid of meaning. Does meaning lie in associations between words rather than the words themselves? To know “Omar Metwally” the hacker, the physician, Twitter handle “osmode” is not to know Omar Metwally at all. But to know Omar Metwally, the son of Moustafa Metwally, the husband of Marwa El-Hamidi, the father of Ismail, the neighbor of Evgeniy, is to begin to know him — as a node in a web of inter-relationships, and it is these inter-relationships, I believe, which correspond to “meaning” as we understand it.

I’ve read Kafka’s The Metamorphosis at least a dozen times in English and German [2]. When meaninglessness overwhelmed me, I turned to Kafka’s writing for its rich, layered meaning, each sentence woven to the preceding and succeeding ones by time (the few seconds it takes to read each flowing sentence) and space (their arrangement on the page). In pursuit of meaning, I unravel The Metamorphosis, splitting the story into sentences, breaking its spatial and temporal semantic bonds, and reconnect them based on lexical similarity (that is, how many words they share) [3,4]. Kafka must be rolling in his grave now; forgive me for the sake of this thought experiment.

 

Kafka2Kafka1

 

What new meaning, if any, does this text now have? Certainly not the literary grace it once carried; gone is the melancholic apartment Gregor Samsa shared with family until the day he woke to find himself a cockroach. Gone is his angry boss, his family, his miserable job as a traveling salesman — as Gregor the cockroach observed it from the cold walls of his former home. The above looks more like a story written by a search engine. In place of that sad apartment, which Gregor’s family rented out to strangers to support themselves (now that their son-turned-cockroach became unable to help the family pay off its debt), is an ugly, urban mess: apartment buildings filled with people who don’t know each other and don’t want to know each other, buildings connected by fiber optic cables, high-speed rails, and crowded streets.

The result is far from meaningless, but it certainly lacks meaning in the sense that it once carried, as it exists in the crumbling yet very much living pages on my bookshelf.

My attention wanders across the bookshelf, to a 3-ring notebook from my first-year linguistics seminar on discourse, which I had the privilege of attending with Professor Jon Swales, a pioneer of the field (and one of the most cultured Englishmen I have ever met). My semester project was “An interdisciplinary examination of textbook interactivity,” in which I analyzed the grammars of history, calculus, and chemistry textbooks to understand how grammatical structure correlates with a textbook’s perceived interactivity. I smile at the memory of spending Thanksgiving break during my first college semester at the University of Michigan circling second-person pronouns, manually counting words in textbooks. If I were to repeat the project in the year 2016 rather than the year 2003, I would have probably written a Python script to do the task in a few seconds.

But there was something romantic about holing myself up in my apartment, watching that winter’s first snowfall, and circling words, as there was about the “natural language processing” that Professor Swales pioneered. He would cringe if he ever heard me describe his work as NLP, and in fact, his work on discourse is too artistic and not quantitative enough to be called NLP [5]. Yet it’s precisely the fact that he is neither a machine learning practitioner nor a computer scientist that his work is so far reaching in the linguistics community. He is the proverbial Englishman at the polo club who has traveled so much that his ears can recognize any Arabic dialect and poke fun at linguistic nuances that go over most of our heads.

My search for meaning continues somewhere between the statistical methods currently in vogue and Professor Swales’ softer, almost literary approach. Quantifying linguistics helps us identify patterns and test hypotheses, but sacrificing art at computation’s stake, as I hope this essay illustrates, can divulge into meaninglessness if we are not careful.

–Omar Metwally

 

[1] These are Schopenhauer’s words. He described the perpetually becoming but never being world (“die immer werdende aber nie seiende Welt”) in his Die Welt as Wille und Vorstellung.

[2] The English version of The Metamorphosis used for this experiment is from the Gutenberg Project.

[3] The 500 commonest English words (such as this, and, a, the,…) are excluded here.

[4] Email me for my code. I’m happy to share it.

[5] NLP and computational linguistics are different but overlapping fields, and linguistics itself is a very broad discipline. I will not get into that here but simply acknowledge these facts.

 

Trumping political discourse on Twitter

Trumping political discourse on Twitter

In this political netnography study, my goal was to map clusters of conversation about Donald Trump on Twitter. I randomly selected subsets tweets from a database of ~20,000 tweets collected with the Twitter API by searching for “Donald Trump” over the past week. I vectorized these tweets and calculated the cosine similarity between them. Using the Python networkx module, I created edges between all nodes with cosine similarity >=0.65. All terms containing the words “Muslim” and/or “Islam” are colored red.

The result is a lexical topography of Twitter discourse about GOP candidate Donald Trump. This method nicely clusters lexically related tweets: notice the tentacular pattern emerging from the center of the figure and the smaller clusters closer to the periphery. The closer to the center of the graph, the higher the centrality of the tweets (the more connected they are to other tweets). Interestingly, there is a lot of red in the central part of figure, corresponding to tweets with high centrality and lexical power about Muslims and Islam.

Here are a handful of tweets with high clustering coefficients:

  • “seeking to alter jury selection, lawyer in terror case cites donald trump’s muslim remarks”
  • “trump digs the hole deeper as he justifies his creepy sexism by blaming hillary clinton”
  • “man how did this country even allow donald trump to run”
  • “this year will be remember by terrorist attacks and donald trump. what a time to be alive”
  • “tyrese blasts donald trump for bigotry on Instagram: watch america show you how we really feel”
  • “my mom said if donald trump becomes president we’re changing our names and moving to mexico”:
  • “bernie sanders explaining what’s so dangerous about donald trump running for president”
  • “donald trump saw a boy who was lost in new york and didn’t tell anyone. is this the man we can trust as president?”
  • “gael garcia bernal: donald trump calls mexicans rapists and drug dealers”

As the saying goes, it doesn’t matter what they’re saying about you, as long as they’re talking about you. Provocative, Islamophobic comments seem to be kindling wood feeding the fire of Mr. Trump’s political campaign, winning him the attention he needs on social media.

 

— Omar Metwally

If hospitals were run like startups

I turned down offers from 3 large healthcare systems to become their Chief Medical Informatics Officer and walked away from a blossoming health tech startup that I had founded to return to life in clinical medicine. I reached this difficult decision just over a year ago. Before that, I was spending most of my waking hours writing code with one foot in San Francisco and the other in NYC.   The differences between startups and hospitals are dramatic and have their roots in organization (or lack thereof).

 

1. If hospitals were run like startups, electronic medical records such as Cerner’s Powerchart and eClinical Works would be laughed at, not adopted.
(I recently counted how many mouse clicks it takes to write a patient note in  Cerner’s Powerchart. Each “progress note,” of which physicians can write two dozen or more each day, takes about 250 mouse clicks to navigate (not including the textual content of the note!). A “history and physical” takes about 350 clicks to document — this again does not include the actual textual content of the note, just navigating awkward menus.
(Would anyone use Facebook if updating one’s status took 350+ clicks?)
2. If hospitals were run like startups, they wouldn’t adopt software so poorly designed and non-intuitive that it takes months to train people how to use it.
Can you imagine holding a week-long training course to teach employees how to use an iPhone, hiring a team of full-time employees to “support” these captive users, and constantly reinforce how to use tragically chosen hardware and software?
3. If hospitals were run like startups, there would be transparency in how organizations operate and how decisions are made.
Scrum would be the name of the game, and yes, even the Scrum Master can be overthrown as spectacularly as the most entrenched Middle Eastern dictator.
I speak from personal experience both as a startup guy selling hospitals software, and now as a hospital employee, when I say that politics frequently predominate an organization’s decision to purchase particular enterprise software. “IT committees” don’t choose the best piece of software for the job; much of this decision-making is based on kick-backs and sales that lead directly or indirectly to an individual(s) gains.
(The authors have no conflicts of interest to declare.)
4. If hospitals were run like startups, decisions regarding the implementation of technology in the workplace would be made by experts and thought leaders.
Instead, this critical task is relegated to IT committees headed by retired nurses and physicians with little to no grasp of how modern web and mobile technology works.
5. If hospitals were run like startups, no one would hesitate to invest in sound software and hardware because this is the highest-yield investment an organization can make in the year 2015.
6. If hospitals were run like startups, they wouldn’t spend hundreds of thousands of dollars for enterprise software only to realize a few months later that it doesn’t run on any of the hospital computers. 
(Yes, I’ve seen this happen. Seriously.)
7. If hospitals were run like startups, personal merit, not seniority, would determine who is allowed to call shots. 
8. If hospitals were run like startups, machines would run Unix-based operating systems.
Many hospital PCs have not been upgraded in decades and still run Windows XP (or older versions of Windows).
Yes, I’m serious.
Operator
(why Google when you can call the Operator?)
9. If hospitals were run like startups, they would nourish and celebrate innovation from its employees.
Large companies like Google and small startups alike give their employees ample time to learn new technologies and cultivate side projects.
Realizing how inefficient one hospital’s current paging system is, I started writing a web app while working the night shift to make this process more efficient. In that particular hospital, nurses randomly page one of the on-call MDs at night, ask if they are responsible for patient John Doe, and hope that they reached the correct physician. The page consists of a 4-digit “callback” number that gives no information on how emergent or non-urgent the call is (which is important in hospitals, as you can imagine). Making things more interesting, the hospital contains many “black holes,” such as the emergency department, where pages can’t be received, and critical pages can disappear into cyberspace.
Our app lets users look up a room number and send a prioritized, SMS-based message within seconds. The recipient can then acknowledge receipt of the message or respond via SMS (which is not possible with the current antiquated pager system). Building the app was the easy part. Our physician, pharmacist and nursing colleagues were thrilled to start using it, but we were asked to get formal approval from the “IT Committee” before using it. The app was 100% HIPAA complaint, in fact more HIPAA compliant than the hospital’s legacy Windows PCs running versions of IE that predate Javascript. It took months to get a meeting set up, and 15 minutes for the IT committee to shoot it down.
One of my physician-coder friends makes a living running a gaming website. He avoids healthcare like the bubonic plague. Now I understand why.
10. If hospitals were run like startups, they would use their resources to do more inspiring things than set up firewalls and encrypt hard disks.
“IT” in most hospitals is synonymous with internet security. What about apps that engage patients, monitor patients with chronic illness at home using wearable technology and apps, help patients engage with physicians, and help healthcare professionals do their work more efficiently — so they can spend more time doing the most important, and enjoyable, part of their work: listening to their patients?
I’ve come across a small handful of physician-coders since moving to San Francisco. There aren’t many of us. We are idealists. We love the practice of medicine. We are deeply frustrated that hospitals are run more inefficiently than the most poorly run post offices. We can build things and are effervescing with ideas and enthusiasm.
Our battle with uninspired hospital administrators constipating the flow of innovation may be perpetual. So should our hunger to re-invent this industry.
Omar Metwally
@osmode

Baby Steps

I received a worried phone call from a physician friend of mine in Michigan. After a grueling shift, he had to spend another few hours writing notes documenting his patient encounters. Just when he was about to submit them, on the verge of exhausted delirium, the electronic medical record crashed, and he lost his work. He sent an angry email to his hospital’s health IT department but lost restraint in his diction, coloring his inquiry with language none of his colleagues have ever heard him use.

Among other healthcare professionals, this story has mostly fallen upon sympathetic ears. We suffer the agony of having to use dysfunctional software in hospitals on a daily basis, software that has changed little since the advent of Microsoft Windows, software inconsiderate of user interface and design, software solely preoccupied with the desire to satisfy the Center for Medicare and Medicaid Services’ security checklist without attempting to make its users lives easier.

I’ve recently had the pleasure of reviewing abstracts for this year’s Medicine X conference at Stanford, one of the largest health tech conferences in the world. Some of the applications were along the lines of established trends in health tech: wearable technology, personalized genomics, health information analytics. A few abstracts touched upon terra nova as “Meaningful Use” continues to unfold. After reviewing a batch of abstracts, I called up an old friend I had met back in NYC. We had actually met during my weekend on the MIT campus, when we won the 2014 Hacking Medicine hackathon with our Google Glass app. Our call inspired me to ring up fellow founders, many of whom I had met in NYC, others back here in San Francisco. Incubators function like venture capital firms. For every batch they incubate, a few land most of the investment funds by demo day, the rest are left hungry.

So what is the secret to cracking healthcare? A good starting point is the reminder, especially to techies, that healthcare does not want to be disrupted. The name of the game is baby steps. Find a point of friction in the healthcare workflow (you won’t have to look hard), understand the current solution, and offer an incrementally better solution. The barrier to entry must be minimal or you can guarantee that no hospital bureaucrat or private practice doctor will bother to even view a demo.

Individuals and organizations in the healthcare industry are constantly in defense mode. Our line of work is loaded with risk, and healthcare professionals tend to be risk-averse. Compounding this is are the Department of Health and Human Service’s threats of draconic punishment which lead to the adoption of outdated software written in Visual Basic by industry monopolies. HIPAA and Meaningful Use are prime examples of laws written by healthcare monopolies who want to ensure that smaller, more agile players run out of funds before they finish jumping through bureaucratic hoops.

Our tech-enabled home healthcare startup found enthusiasm among tech-minded clients in the Bay Area and southern California, but wearable technology is too expensive and immature in its current form to appeal to most patients and physicians as a practical tool. While our team was writing code to integrate with activity trackers, the director of a large NYC-based home health agency told us to ditch the tech toys and build a call center. At the time, we scoffed at the idea, a former Google employee and a physician-coder yearning to bring fire to man. In retrospect, he was right. The barrier to entry to this approach is far lower than trying to make wearables work. I can say the same thing about Google Glass startups. I can imagine a day when healthcare professionals might actually use a Glass-like wearable device in their practice, but that day is not today.

Omar Metwally, MD

 

Building smart contract-based health insurance

This post elaborates on a 6/19/2014 presentation I gave at the BitTorrent HQ on decentralized autonomous health insurance, and on a prior blog post. My goals here are:

  • To quantify and qualify the problems with the US healthcare system, especially as they pertain to the payer system
  • To introduce my vision for decentralized autonomous health insurance
  • To outline key components of successful health insurance systems
  • To start laying the groundwork for applying these concepts in practice
1. The U.S. spends more on healthcare than any other country — for subpar health outcomes

1.1 The U.S. spends 17.7% of its GDP on health-related expenditures, with the Netherlands (11.9%), France (11.6%), and Germany (11.3%) landing a distant second, third, and fourth place, respectively (OECD Health Data 2013). 52.2% of U.S. healthcare spending is private rather than public. The United States, Chile, and Mexico are the only OECD countries whose health expenditures are less than 50% public (OECD Health Data 2013). Despite our country’s disproportionately high healthcare spending, life expectancy among Americans has fallen to about 81 years (as of 2011), comparable to Chile and the Czech Republic and lagging behind most other OECD countries.

1.2 To change individuals’ behavior, change their incentives. To create a sustainable system, align individuals’ incentives. I’ve identified below several flaws in US healthcare’s payer systems, all of which relate directly or indirectly to financial incentives, and discuss potential solutions later in this post.

(i) Large uninsured population. According to the US Census Bureau, the number of Americans without health insurance exceeded 48 million (15.7% of the population) in 2010.

 (ii) In the US, 2.5 physicians serve 1,000 people on average, compared to the OECD average of 3.2 physicians per 1,000 people. The American Medical Association projects a shortage of 124,000 physicians (46,000 primary care physicians) by 2015.

(iii) Physicians have traditionally been incentivized financially to perform procedures, not optimize health outcomes. A surgeon is reimbursed tens of thousands of dollars for resecting tumors resulting from lifelong smoking, while general practitioners are hardly reimbursed for taking time to counsel patients on smoking cessation.

(iv) Tort laws keep physicians on the defensive and incentivize them to err on the side of excessive testing.

(v) Uneven distribution of healthcare resources

(vi) Burdensome administrative overhead to perform tasks such as preadmission certification, utilization review, membership management, collection of funds and claims, and quality assurance. Operational hurdles are a common reason for health insurance systems to fail, according to the World Bank.

(vii) Discrimination based on medical diagnoses (“pre-existing conditions”)

(viii) Disparate attitudes toward end-of-life care. Healthcare spending in the last year of life is 6 times greater on average among Medicare patients: $39,975 versus $5,993.

2. Building a smarter healthcare system

An optimal health insurance system has yet to emerge in response to the Affordable Care Act. Social and national payer systems like those in Scandinavia, Germany, and Switzerland are good working solutions, but they’re imperfect systems. Smart contracts don’t promise a utopian solution; however they allow us to iterate toward an optimal set of parameters within a dynamic actuarial system. 

2.1 An insurance system in the era of smart contracts will admit its shortcomings in terms of knowledge and financial resources and instead focus on establishing malleable rules than can be updated iteratively based on outputs such as health and financial outcomes.

2.2 Each decentralized autonomous health insurance system will be constructed in a modular fashion with a uniform parameter set, such that each system represents an actuarial experiment based on community-generated contracts.

2.3 The parameters in 2.2 and aggregate financial/health outcomes will be available publicly to facilitate iterative refinement of these smart contracts governing decentralized autonomous health insurance.

2.4 Decentralized autonomous health insurance (DAHI) will shift influence away from private insurers and toward individuals. DAHI systems hold the potential to provide just and universal access to healthcare. These smart contract-based systems will not be burdened by administrative overhead and will not be victims of political consensus or lack thereof.

2.5 Decentralized autonomous health insurance will protect the socioeconomically disadvantaged. “Unless designed to be pro-poor, health insurance can widen inequity as higher income groups are more likely to be insured and use health care services,” warn Wong et al (World Bank Health Insurance Handbook). Existing health insurance tends to draw resources away from the poor. The World Bank identifies 3 mechanisms to protect vulnerable groups, including rural communities, self-employed individuals, informal workers (“black market”), small businesses, the homeless, and orphans:

(i) Compulsory universal coverage to prevent the rich opting out of the pool
(ii) Require redistribution among multiple fund pools
(iii) Financially incentivize providers to serve poor areas

The implementation of these mechanisms, however, has proven challenging because the rules governing private health insurance favor the affluent, both in their scope and execution. DAHI governed by smart contracts will enable the formation, and more importantly the automated enforcement of, fair rules ensuring the inclusion of socioeconomically disadvantaged groups.

2.6 The World Bank identifies several key considerations in designing a sustainable health insurance system:

(i) Political feasibility and political mapping

(ii) Sociocultural norms
These can strongly influence the ultimate success or failure of health insurance programs (boxes 2.2 and 2.3). In some societies, for instance, people believe that planning for inauspicious events can harbinger bad luck. A more germane example of the importance of sociocultural norms is the debate surrounding the end-of-life care in the United States.

(iii) Financial capacity
In the context of traditional government-funded health insurance, financial capacity is determined by the number of people who buy in, the size of the formal sector of the economy that is taxable, and per capital GDP (Wong et al). The World Bank also identifies the capacity to collect, pool, and spend funds efficiently and effectively as determinants of feasible and sustainable health insurance systems.

(iv) Provider capacity
The number of healthcare professionals available to provide healthcare services

3. Guiding principles
Early adoption of DAHI will rely to a large extent on a group’s social cohesiveness. As Wang and colleagues point out, social cohesiveness generally tends to correlate positively with the success of community-based microinsurance. Individuals may be more likely to buy-in if they know that risk is being shared among individuals in their communities, to whom they can relate on a personal level. Initially, smaller insured groups will mean fewer ways for the system to fail as well as greater agility in creating and modifying rules ad libitum. Associated with smaller groups however is greater financial risk. As these groups grow larger, they also become more financially insulated. Therefore, the gradual growth in the size of an insured pool translates into an opportunity to refine gradually the mechanisms governing DAHI, which are outlined below.

3.1 Health insurance based on smart contracts provides an opportunity for societies to engineer redistribution mechanisms that preserve socioeconomically disadvantaged individuals’ access to healthcare resources. The goal here is to establish rules that promote the amalgamation of insured groups, such that wealth and resources flow from the wealthy to the poor, from the healthy to the unhealthy. Each member pays according to how much she or he can afford to pay. These rules will also promote diversification of insured pools to further strengthen the group’s financial insulation. Without such rules, smart contract-based health insurance would only recreate the same inequities in access to healthcare that traditional insurance creates, namely the formation of wealthy insured groups with the exclusion of the poor. One example of a redistribution mechanism is a quota for the sponsorship of disenfranchised individuals, in which an insured group agrees to provide X% of its funds to cover for low-income individuals who could not otherwise afford health insurance.

3.2 The decentralized nature of smart contract-powered, community-based microinsurance bypasses the political roadblocks and administrative challenges that continue to hinder the implementation of the Affordable Care Act. It’s also central to the essence of DAHI as a series of actuarial experiments that allow societies to iteratively approach an optimal set of financial parameters that maximize the just distribution of healthcare resources. One question that arises, however, is the following: what will be the role of federal and state governments? Will they hinder its implementation? If DAHI does in fact become widespread, will it constitute health insurance in the eyes of the law? I believe that governments will play the important role of “the stick” by continuing to incentivize or even mandating membership in a health insurance group, akin the the Affordable Care Act. The mechanics of health insurance, however, are best left to algorithms.
3.3 Medical practice focused on health outcomes, rather than procedures, will require a corresponding shift in reimbursement. Accountable Care Organizations reflect this tendency, which is borne from the federal government’s recent reforms. Analogously, smart contract-based DAHI will be instrumental in incentivizing providers to practice health outcomes-based medicine.

3.4 This was already stated in 1.2, but because of its centrality to the concept of smart contract-based DAHI, I repeat it here. DAHI is based on the admission that no optimal solution to the current payer problem exists. There are numerous potential solutions. Each insured group in DAHI represents a controlled experiment in health economics and policy. Therefore, DAHI must be designed modularly with replicable components, a consistent set of parameters, and transparency of both inputs and outputs to allow iteration toward optimal parameter sets.

3.5 Buy-in from providers will rely foremost on their perceived value of cryptocurrency. This is a matter of time, in my opinion, as cryptocurrencies gradually become more accessible to the general public and more prevalent in commerce. Furthermore, the rate at which DAHI grows will depend to a large extent on legislators’ reaction to smart contract-based DAHI.

4. Proposed mechanisms

Sample Serpent code is available on my Github repository:
Each DAHI system will include a set of parameters including, but not limited to, the following;

(i) Maximum/minimum number of members

(ii) Percentage of member votes necessary for approval of an insurance contract in order to become active

(iii) Enrollment period start and end

(iv) Coverage period

(v) Cancelation penalty

(vi) Premium (either a range or a fixed amount)

(vii) Adjustment formula: this allows adjusting premiums based on individuals’ relative cost to a healthcare system – without ever excluding anyone. One possibility is creating an actuarial score, for example a ratio of benefits received to premiums paid over an individual’s lifetime, which can then be transferred from one contract to the next.

(viii) Maximum plan dollar limit

(ix) Terms of care provided, including access to specialists and physician reimbursement

(x) Utilization

(xi) Number of mid-level providers and physicians from each specialty, including a voting mechanisms to allow members to vote providers into or out of a group.

(xii) Reward pool to promote good health outcomes

4.1 Both beneficiaries and providers will be subject to a peer-based application process. This will be predefined in the contract’s rules, for instance as a minimum percentage of the vote, to safeguard against discrimination.

4.2 All financial and health outcomes (in anonymous aggregate) will be publically available to allow assessment of a group’s financial feasibility/sustainability, allow quality control of providers’ practices, and promote iterative refinement of the parameter set in subsequent groups. Quality control may also take the form of reputation systems for healthcare providers.

4.3 Both patients and providers will be rewarded for good health outcomes in the form of a bonus at the end of the coverage period.

5. From theory to practice
Smart contract-based decentralized autonomous health insurance, executed correctly, can provide citizens of developed and developing countries alike equitable access to healthcare resources. It has the potential to do what traditional health insurance has frequently failed to do, namely protect the interests of the most socioeconomically vulnerable, and politically weakest, individuals. While adoption of DAHI likely will be a slow process that depends upon the rate at which cryptocurrency becomes mainstream, implementation need not be an all-or-nothing process. First steps will include running simulations and eventually using DAHI in the context of coinsurance, or health insurance for specific contexts such as outpatient visits. A few interesting open questions include how existing health insurers will react to smart contract-based health insurance, and to what extent, if any, DAHI will be truly decentralized. Ultimately, federal and state legislation governing cryptocurrency and smart contracts will shape how smart contract-based insurance is implemented.

Appendix

8. Actuarial anatomy

8.1 Risk pooling := collection of funds from members of a group to finance the cost of a catastrophic event (Wang et al, 11). This allows a group, rather than an individual, to bear the financial risk of paying for catastrophic costs. The larger and more diverse the group, demographically and economically, the more effectively the risk is spread (WHO 11). The concept of risk pooling is closely tied to moral hazard (see below): how can financial risk be distributed without corrupting individuals’ incentives to exercise precautions?

8.2 Risk aversion := converting a low-probability of a catastrophic event into a certain, low-burden event. Let’s say for instance that a dentist pays $40,000 to insure his hands over the course of 20 years. He has a 1% chance of losing one or both hands, but this would cost him $2 million in lost income. He can convert a 99% chance of making $2 million and keeping his hands (and a 1% chance of losing his hands and $2 million in income) into a 100% chance of losing $40,000.

8.3 Moral hazard : = when the behavior of an insured person changes – usually to become less risk averse – because they no longer bear the full cost of their behavior (Wang et al, 25). For example, let’s say that Larry has a family history of heart disease, and that the cost of treating a heart attack is $100,000. Given his family history, smoking habit, and sedentary lifestyle, his risk of a heart attack in the coming 10 years is 15%. Quitting smoking, losing weight, exercising, and regular checkups would reduce his risk of a heart attack to 7%. But what’s the point of going through all the hassle, Larry thinks, if his insurance will pay for it anyway? Possible solutions to the problem of moral hazard include:

(i) Coinsurance: the insured person still bears some of the costs and therefore retains incentive to adopt and maintain healthy behaviors

(ii) Preconditions to insurance: for instance, Larry’s health insurance requires him to get regular checkups and do an annual urine test to prove non-smoking status

8.4 Adverse selection := tendency of higher-risk individuals to be more likely to enroll in insurance. Unhealthy patients with worrisome family histories or concerning health findings buy health insurance, driving up the cost, whereas healthy individuals become less likely to purchase insurance as it becomes uneconomical.

9. Anatomy of health insurance
The following is an overview of actuarial terminology and common forms of health insurance.

9.1 Terminology
9.1.1 Coinsurance := health insurance plan in which the insured person pays a given percentage of medical expenses after the deductible amount, if any, is paid

9.1.2 Deductible := fixed dollar amount during the benefit period (usually one year) that an insured person pays before the insurer starts to make payments for covered medical services

9.1.3 Premium := fees paid for coverage of medical benefits per unit time

9.1.4  Copayment := health insurance plan requires insured person to pay a fixed dollar amount when a medical service is received; the insurer pays the rest
9.1.5 Gatekeeper: individual who coordinates and authorizes medical services, laboratory studies, specialist referrals, and hospitalizations. This is often the primary care provider.

9.2 Types of health insurance plans
9.2.1 Preferred provider organization (PPO)
Patients receive care from healthcare providers in a given network. Patients are incentivized to remain within the network by being charged premiums for heathcare services received from providers outside the network.

9.2.2 Health maintenance organization (HMO) is both insurer and healthcare system. This includes organizations such as Kaiser Permanente.

9.2.3 Accountable care organization (ACO). Federal or state governments pay ACOs a lump sum to provider care for X number of individuals in a given geographic area for Y units of time. This is a new reimbursement model that emerged from increasing pressure by the federal government on healthcare systems and providers to control costs and practice outcomes-focused medicine.

Acknowledgements
I’m grateful to Vitalik Buterin, Ethereum creator and recent recipient of the Thiel Fellowship, and to Christian Peel, who runs the Silicon Valley Meetup group, for their productive feedback.

References
  • OECD Health Data 2013.

http://www.oecd.org/unitedstates/Briefing-Note-USA-2013.pdf

        http://www.oecd.org/berlin/47570194.pdf

  • United States 2010 Census.
        http://www.census.gov/prod/2010pubs/p60-238.pdf
  • Wang H. et al. Health Insurance Handbook: How to make it work. World Bank Working Paper No. 219, 2012.
  • Wood, Gavin. “Ethereum: a secure decentralised transaction ledger.”
        http://gavwood.com/Paper.pdf