Blue Jeans

By Omar Metwally, MD

August 4th 2021

This is a photo of Salt Lake City, Utah on April 3rd, 2020.

At the end of March 2020, I drove from the San Francisco Bay Area, my home of eight years, back to my home state of Michigan to volunteer in medical units overflowing with patients who were sick with the novel coronavirus. My puppy and my few personal belongings, which had consolidated over the years after frequent moves from one city apartment to the next, are packed into my Honda Civic, the rest of my belongings left behind in an apartment I quickly fled to avoid state border closures. Every fleck of my skin, from my face and lips to my toes, is swollen, red, and painful — a farewell gift from a patch of poison oak that my puppy discovered during one of our last hikes through the East Bay’s eucalyptus forests. I am on fire.

I drove from California to Michigan via interstate highways that traverse the heart of America with prescriptions for steroids to treat my case of fulminant poison oak hypersensitivity and an aloe plant on my lap. As I spent the better part of four days behind the wheel cutting off aloe leaves[1] and rubbing them on my skin to relieve the intense burning that pushed me to the limits of patience, I reflected on how quickly life had changed in such a short period of time: the perpetual line of masked people in front of the deli where I used to walk a block over to pick up a sandwich for lunch and carry home fresh produce; the panic of trying to hunt down dog food after all the local pet stores shuttered their doors indefinitely; driving an hour and a half to Sonoma County in pursuit of milk; the tense, heavy atmosphere at my hospital as it filled up with seriously ill patients – and the limited therapeutic options doctors had at their disposal at the start of the pandemic.

Many people lost their lives and their livelihoods during the pandemic, which continues to take its toll around the world.

This is a photo of Salt Lake City, which I did not take because it wasn’t how I wanted to remember the capital of one of the most beautiful states in America.

After a few hours rest in a nearly-deserted hotel, I wake to continue our journey east. Except for a police patrol and a homeless man, there isn’t a soul on the streets of downtown Salt Lake City, as I walk my dog in search of a cup of coffee. This is not how a city should ever look, except in Cormac McCarthy’sThe Road. Even the national coffee chains one could previously count on were closed, and I resorted to brewing my daily cup of joe on the side of the road with the aid of a propane-powered camping stove.

Michigan was hit early and hard by the COVID-19 pandemic, but finding food for puppy and milk for me was still easier outside of California’s dense urban areas. When the State of California issued the first stay-at-home order in March 2020, it felt like standing on a beach watching tsunami waves roll toward land. While those tsunami waves are just now making landfall in certain countries that managed to dodge the first pandemic wave by means of fast, coordinated action, the aftershocks are being felt acutely by all. Personal loss and economic damage on such a large scale will take time to heal. The cost of basic provisions, from groceries to building materials, has increased markedly in just a few months, and the future is more uncertain now than it was in the pre-pandemic world.

Despite the great difficulty of finding a sewing machine and fabric in the spring of 2020, I managed to purchase my first sewing machine and learned to sew face masks with the help of a tutorial on the CDC’s website. The linen masks I created were far more comfortable and breathable than surgical masks, and I felt empowered to create something that had become as indispensable to daily life as a smart phone, especially at a time when masks were expensive and hard to come by. Just a few months before moving back to Michigan, I was taking my shorts to alterations shops to replace buttons, and I would have never imagined operating a sewing machine myself.

Learning how to sew gave me the knowledge and skills to harness an ancient technology – textiles – to create functional and beautiful things that can’t be made using 3D printers. After using the remaining linen to sew window drapes for our home, my next challenge was denim. A pair of jeans is both a tool and a lasting work of art. Subject to areas of extremely high tensile forces, jeans hold things together to keep us warm while serving as a physical barrier between our bodies and the world. Denim adapts to the shape of our bodies over time, and we hardly notice a comfortable, well-fitting pair of jeans as we go about our business. Jeans have front and back pockets to hold our keys, phones and wallets, and jeans take on a uniquely cool look with each wash, tear, fray and stain.

U.S. Patent Number 139,121 (“Improvement in fastening pocket-openings”) for using rivets to reinforce pockets awarded to Levi Strauss and Jacob Davis on May 20th, 1873.
Source: https://patents.google.com/patent/US139121A/en

Levi Strauss of San Francisco and his business partner, Jacob Davis, a tailor from Reno, Nevada, were awarded U.S. Patent Number 139,121 (“Improvement in fastening pocket-openings”) for using rivets to reinforce pockets on May 20th, 1873 [2]. There is a big difference between sewing trousers and sewing a durable garment that can withstand years of vigorous use. Strauss and Davis’ invention helped improve the longevity of jeans as a tool, a garment worn by people to help them work hard, and a garment that also happens to look nice!

As with face masks, I began sewing jeans out of necessity. Shopping for clothes to replace the wardrobe I left behind in California was impossible or extremely challenging for many months. Even before the pandemic, happening across a well-fitting pair of jeans involved visits to several outfitters and spending a day trying on jeans. If I was lucky enough to find a pair that fit, I didn’t have say in the properties of the denim I would bring home to break in: the fabric color, weight, style and stretch.

Jeans have become staples in apparel and are worn by people of every rank and file all over the world. The mass production methods necessary to achieve the current market prices rely on the sweat and lifeblood of factory workers who specialize in one small step in a complex process overseen by the proprietor. What surprised me most about learning how to sew jeans was the remarkable fine motor skills and intensity of labor which the process entails. With my wife’s help, we can together create a pair of jeans in three days: one day to take measurements, draft a pattern, cut fabric and serge the pieces; another day to sew the pieces; and a third day to add trimmings and hem. The price tags on store-bought jeans betray the immense skill and effort involved in creating a pair of shiny new blue jeans, but there is no price on the joy of achievement.

Whether I’m rounding in the hospital or under the hood of my car, I enjoy wearing a pair of hand-sewn jeans as a reminder that sewing jeans, like the practice of medicine, requires both knowledge and skill, a fruitful marriage of theory and practice. Creating a well-fitting pair of jeans requires a good grasp of human anatomy and the theory of pattern design. It requires an appreciation for how movement – walking, running, sitting and squatting – impart forces on the fabric, and how manufacturing techniques can reinforce these high-stress areas. Sewing jeans also requires appreciation for how denim is woven and dyed, and how its properties can be modulated to yield a certain feel and look. The theory of jeans-making must be combined with outstanding sewing skills to produce an awesome pair of jeans. Learning to work with a heavy fabric like denim takes a lot of practice and patience.

Even if I had an endlessly long list of customers, a mom-and-pop jeans shop operating in the United States cannot compete head-to-head with a jeans factory that outsources its operations to places where the cost of labor is significantly lower. And while I can’t pretend to be an expert seamster as far as sewing jeans is concerned, practice makes perfect.

A pair of custom Ox Jeans made using a computer program that algorithmically generates jeans sewing patterns from a handful of body measurements

My offering:

  • Custom, algorithmically-generated jeans sewing pattern. Includes:
    • Full-size printout containing all pieces for a custom-sized pair of jeans, based on your body measurements
    • 3 business day turn-around
    • Cost: $50
  • A custom-tailored pair of jeans. Includes:
    • Hand-sewn pair of jeans made with 100% American denim
    • Constructed using the algorithmically-generated sewing pattern (above)
    • Cost: $600

A pattern can be purchased separately from the jeans so that people with sewing skills can create their own jeans at home.

To purchase a custom jeans pattern and/or a pair of custom-tailored jeans, request an order form by emailing me (omar@oxjeans.me) with “Ox Jeans Order Form” in the subject line.

References

  1. Aloe vera: a review of toxicity and adverse clinical effects. Guo X and Mei N. J Environ Sci Health C Environ Carcinog Ecotoxicol Rev. 2016 Apr 2; 34(2): 77–96. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6349368/
  2. U.S. Patent Number 139,121. “Improvement in fastening pocket-openings.” Jacob Davis of Reno, NV, and Levis Strauss & Company of San Francisco, CA.

Due to unusually high call volumes

The strain of the COVID-19 pandemic on society and healthcare systems turned fine fault lines into gaping canyons. Reflecting on my writings about U.S. hospitals 5 years ago, I asked myself what had changed and what still must change to rebuild a healthcare system that can deliver medical care wherever and whenever it’s needed. What problems were prevalent in the healthcare system before the pandemic, and how did the pandemic highlight these deficiencies? In my day-to-day work as a doctor, what diverts my time and energy away from the most important and fulfilling aspect of doctoring – patient care?

Direct and effective communication with patients is the most important aspect of healthcare, in my view. A doctor working in the community who is licensed and certified has demonstrated a body of knowledge and skills to provide medical care within a certain scope of practice. Someone with a health concern is arguably not seeking the smartest doctor they can find; they want a doctor with whom they can communicate their concerns, understand their health issue, and make a mutually acceptable treatment plan. In daily practice, I feel that 95% of my time and energy are consumed by tasks that do not relate directly to patient care. Even more unfortunate is the fact that these 95% of tasks are the ones by which doctors are evaluated and compensated: clicking through electronic health records (EHR), wrestling with flawed communication systems (such as hospital phones, pagers, texting, and email) to receive and share information with other members of the healthcare team, answering “queries” from hospital administration for the purpose of billing patients and insurance companies, and wasting life-years trying to wrangle health information systems as mandated by hospital administrators and insurance companies.

1. The world wide web

The pandemic pushed the role of “telemedicine” (healthcare rendered by phone or digitally) into the foreground as a way to deliver healthcare efficiently while reducing the spread of the coronavirus. Regrettably the first and biggest problem with healthcare is internet connectivity and how EHR software sends and receives information between a doctor’s phone/computer and the hospital server. Even in the year 2020, reliable, high-speed internet is a scarce resource in the United States. Most Americans have no choice of internet service provider, if they are lucky to even have access to one. In a time where human resources are stretched thin and inefficiently used, trying to reach a human in the event of a service interruption can easily waste hours if not days waiting on hold or confined to chatbot purgatory. Many doctors now work remotely to a large extent, if not entirely. Reliable, fast internet is prerequisite to being able to deliver good healthcare. This is especially true because of the nature of EHRs, which use “Virtual Machines” and “Remote Desktops” that require a reliable, low-latency, high-speed internet connection. A client that runs at a snail’s speed and frequently disconnects, requiring 10 minutes to repeat the authentication process before dropping the connection again, is severely detrimental to patient care.

2. Electronic Health Records

EHRs are essentially spreadsheets in fancy packaging. They’re not smart in the sense that a phone is smart; they don’t learn, predict, or automate tasks. In fact software that is slow, requires a lot of clicking and non-intuitive behavior, and which wastes a lot of time with authentication and logging in, is not much better than typing text into the simplest text editor and saving it in a rudimentary database. That is the core of a hospital or clinic’s information system: text and media files saved chronologically and accessible to the right people at the right time. I prefer to type or dictate notes freestyle rather than use templates because it’s faster for me, gives me more control over the document, and helps me communicate my assessment and treatment plan more effectively than relying on a template created by someonen else who may conceptualize a diagnostic process and treatment plan much differently than their peers. An ideal EHR to me would simply be typed into a Unix terminal (for a reader unfamiliar with Unix, imagine a black screen with a flashing white cursor) and piped into a hospital server, which would then use the text to help doctors appreciate the clinical Gestalt or “big picture”: what could harm or kill the patient in the next few hours? And beyond the first 12-24 hours, how to safely discharge the patient? As an EHR user, I don’t want a fancy front-end trickling through a lagging virtual machine; I want a simple, low-latency, text-focused interface and a smart backend, in other words, very simple software that looks dumb but is actually smart.

3. Communication

On top of the pressure of having to synthesize a huge amount of dynamic information to make fast and sound decisions about patient care, doctors are inundated and constantly interrupted by communications from other members of the care team. Doctors work closely with nurses, aids, phlebotomists, lab and radiology technicians, doctors from different specialties, clerks, social workers, insurance companies, and hospital administrators. There is a lot of information constantly moving back and forth in real-time between all parties. This flow of information is often like a waterfall rather than a water faucet – the communications are not prioritized and frequently fail to reach the right person at the right time. There are times when a doctor’s attention should be focused entirely on the task at hand, for example when assessing or speaking with a patient at bedside. This is no time to be interrupted with billing queries or non-urgent questions about other patients’ care. A constant stream of unprioritized and unfocused information can make it extremely difficult to focus on the critical 1% of information which can hurt patients if this information is not processed correctly at the right time. In order to hold people accountable for their decisions, they need to be given a fair chance, with tools that work without draining life out of the users. A page or phone call that may or may not find the intended recipient, and a note left in the EHR saying, “tried to call you but you didn’t answer your phone,” is subjective and not constructive without a way for all parties to track communications from their origin to their destination.

Automated spam calls, a nuisance in daily life, can be harmful to patient care by hindering timely and effective communication

In addition to the right tools, there is a need for sound systems. A doctor’s extensive education and training culminates in a highly specialized set of skills and knowledge. Doctors should take pride and joy in their work; they endured long, grueling training out of a desire to help humanity. Out of training, doctors traditionally became their own bosses, working in community hospitals or private clinics, practicing medicine the way they were taught in a style that becomes their own. Nowadays doctors are managed by administrators who are not doctors. There is a reason why healthcare systems look and function the way they do, an evolutionary end-product of decades of legislative, financial, operational, and societal forces exerting themselves on doctors and hospitals. Back in the day, doctors saw their own patients in their own clinic and treated their patients when they were hospitalized too. This is exceptional nowadays. There was no, “I’m your doctor for today,” or “I’m your doctor this shift, until 8pm.” The reality is that this mode of doctoring has become rare. Having experienced the modern-day flavor of corporate medicine in urban areas and the more traditional model in rural areas, I appreciate the pros and cons of both models. “I’m your doctor, period” can be spoken by a doctor lucky enough to escape corporate medicine, but also a doctor prepared to withstand the stress of not having any personal or protected time away from work. Too many talented doctors nowadays burn out after short-lived clinical careers, depriving patients of the care of great doctors who fell victim to the 95% non-clinical burden on top of the already stressful 5% clinical work.

4. More communication

There is a clear line between “outpatient” and “inpatient” medicine in most doctors’ minds, that is, healthcare delivered in a clinic, where a patient goes to an appointment and returns home, compared to a hospital, where a patient stays overnight. Patients don’t think in terms of “inpatient” and “outpatient.” A patient who wakes in the middle of the night with a fever and shortness of breath, or a patient with a growing breast lump, have concerns that needs to be addressed immediately by someone who actually cares. It sounds obvious, but I could not copy and paste this phrase too many times: by someone who actually cares. Not a voice menu, not a chatbot, not “Due to unusually high call volumes…,” and not a tired, under-paid clerk who is poorly equipped to do their job. A doctor has the knowledge to assess whether a problem is urgent or not urgent, concerning or likely harmless. It’s not fair or realistic to expect patients, lacking specialized knowledge, exposed to the vast informational waste littering cyberspace, biased by personal experience and anxiety about a health condition, to make those calls.

“Due to unusually high call volumes…” has become this year’s mantra. Nearly every call I attempt to place to an insurance company, hospital, or clinic is met with this phrase and indefinite wait times, now nine months since the start of the pandemic. Most negative feedback about doctors and hospitals relates to what goes on beyond the few minutes a doctor spends interacting directly with the patient: a medical assistant having a bad day, a disorganized clinic, the insurance labyrinth, bills…human concerns not being reciprocated by a human in a place to care and do something about it. Most of the time and energy spent by patients trying to get help for a health concern is burned in the friction of waiting on hold and clicking through websites to try and make appointments or navigate insurance and billing departments. Putting this burden on healthy people is absurd. This is a lot of life wasted by a lot of people. There needs to be a much less painful way to pick up the phone and route a health concern to someone with the expertise to address the concern. Putting this burden on someone who is sick and possibly dying is criminal.

5. Paying for healthcare

Healthcare is too expensive to fund primarily through private insurance. This is the clearest take-home point of the pandemic to me as a doctor and as a patient. I recently “downgraded” my health insurance because it is by far my biggest monthly expense after my mortgage. For the past year, I purchased expensive health insurance and hardly used it. Miss a payment, and insurance companies will not hesitate to end coverage as soon as the clock strikes twelve, as swiftly and thoughtlessly as a robot. I am fortunate enough to have a job. Many people do not and were already barely just getting by before the pandemic. We no longer have the luxury of deciding whether or not a single payer system is good for America. We are well past that point. Healthcare, especially now, can only be funded by a payer pool on a national level. In my view, healthcare is a human right. This is not a political issue to me. This is a human issue. Everyone should have access to at least a basic level of healthcare: when you have a health concern, you should be able to see a healthcare professional as quickly enough as the issue warrants, without breaking the bank, without bankrupting society.

I had the opportunity to work in German hospitals during my medical school international rotations. There is no such thing as uninsured in Germany, and many other countries with nationalized healthcare. Everyone can get urgent and non-urgent healthcare without going bankrupt. In my view, universal healthcare (and access to universally affordable education) is the foundation of a sound, healthy society. How much money one has in the bank should not delay access to healthcare. Those with the means to purchase private health insurance are free to do so, along with the benefits this might entail. The reality is that healthcare is expensive. Diagnostics and therapeutics – CT scans, MRIs, lab tests, prescription drugs – cost money to develop and deliver. We are all humans, and illness is inseparable from the human experience. Everyone will have contact with the healthcare system at some point in their life, and most Americans are born and die in hospitals. The sooner we accept this reality and have empathy for the suffering of others, the sooner we can make better decisions for how our healthcare system will look and function in the recovery period following the pandemic.

Omar Metwally, MD // 16 December 2020

omar@analog.earth

Xin chào Việt Nam!

We’re walking through Hanoi’s Old Quarter on a warm spring day, dodging motorbikes on crowded streets, passing cafes and crowded curbside restaurants. The smells, sights and sounds of an endlessly lively Vietnam are constant companions. For miles in all directions, mom & pop t-shirt shops line the streets selling variations on common designs, many inspired by political satire. The shirts range from 60,000 VND (~3 USD) to about 10 USD, the final sale price depending on one’s skill in haggling, ability to establish rapport with the seller, and the extent of one’s Vietnamese. What’s original today will quickly be copied and re-copied until it becomes a jaded afterthought in the public domain.

IMG_5985

A dragon lurks in the corner of my eye: black dragon on grey background, a striking image. The shop owner says he’s the only one selling it Hanoi, and after acquiring a new wardrobe during the course of my travels from Saigon to Hanoi, I have no reason to doubt him. Only – it’s a size too small, and I want two custom shirts made with black and red dragons on white background. He assures me he’ll have the shirts printed in just a few minutes, and indeed, 10 minutes later he sells them at a steep profit for $5 each, in time to greet the next group of visitors admiring the shirts hanging in the entrance.

Sleeping Dragon
Original design by Truong Thanh Duc

Two weeks in the Land of Smiles was a remarkable lesson in good humor, fine coffee, delicious cuisine, and business savvy. Haggling with Vietnamese merchants was endless fun, in large part because of the opportunities to get to know the beautiful families who greeted us with kindness and generosity.

Cà phê đên
The joy of Vietnamese coffee

One eye-opening take-home business lesson as it relates to my team’s work on a 3D-printed e-bike has been the value of 3D printing in quickly putting highly customized products in customers’ hands, the manufacturing industry’s equivalent of a custom-printed t-shirt or a handmade leather wallet. In a time of intense competition in global marketplaces, there is value in custom-made products, and there are those who appreciate their significance – in Vietnam, and in America.

Saigon
Saigon’s motorbike-filled streets

Trolling for a wealthier world

Omar Metwally, MD 
University of California, San Francisco

“No,” said the priest, “you don’t need to accept everything as true, you only have to accept it as necessary.” “Depressing view,” said K. “The lie made into the rule of the world.”  – The Trial (Franz Kafka)


Goal

To understand what motivates people to create and share knowledge.

Plot

Larry, is a cafe owner on a mission to brew the world’s best cup of coffee.

larry
Larry’s on a mission to brew the world’s best coffee

The Cast:

Roy Bender:  Australian-American physician who invented Roy’s Retractable Needle in 1990. His patents in Australia, America, and Germany brought him great success and have since expired.  

surfer.jpg
Dr. Roy Bender enjoying his patents’ success

Ernesto Bernal: Ernesto is an altruistic Mexican inventor whose outrage at the cost of American “Epi Pens” (life-saving medical devices used to treat potentially fatal allergic reactions by delivering epinephrine into the thigh muscles) inspired him to invent Ernie’s Excellent Pen. Ernie’s Excellent Pen uses the technology behind Roy’s Rectractable Needle to make this life-saving medication more affordable for patients.

ernesto.jpg
Dr. Ernesto Bernal building “Ernie’s Excellent Pen”

Dr. Xu: Chinese scientist looking for a way out of a dead-end postdoc. He spends a lot of time trolling websites like reddit in between experiments.

xu.jpg
Dr. Xu, Full-time redditor, part-time postdoc

Dr. Chang: Chinese scientist who invented China Pen in 2005, her own version of the epi pen. Dr. Chang, a brilliant scientist without business aspirations, quickly forgot about her invention and moved on to other research projects. She and Dr. Xu were postdocs together and longtime friends. 

chang.jpg
Dr. Chang mentoring her student

Part I

Looking for inspiration for his next big invention to save him from a stagnant postdoc, Dr. Xu browses the blackswan network, a database of inventions and ideas, on a quiet afternoon in his lab. He likes the website because it’s like a nerdy version of reddit, a website that has occupied a lot of his time recently. While browsing blackswan he stumbles upon Ernie’s Excellent Pen (a medical device built using Roy’s Retractable Needle), which immediately reminds him of his old friend’s China Pen. He creates an “attribution” on the blockchain, an association between two devices/components, that looks like:


To a human, this attribution looks something like:
[Appraiser's (Dr. Xu's) Ethereum address, Resource1* (Roy's Retractable Needle), Resource2* (Dr. Chang's China Pen), Timestamp, Transaction Handle]

To a machine, this same attribution might look like:
[0x6060604052341561000f576, Qmt3z9320ba, Qz429ccr082, 1508029285, 0xc6a493eb108266c548906c8b]

This attribution allows others to see that Roy’s Retractable Needle and the China Pen are related to one another. Others can “upvote” this association as a useful one and create their own associations (so that Dr. Xu can learn about related inventions which he wouldn’t have otherwise encounter). For someone on the hunt for the next big idea, this is a great way to find inspiration and learn about what others are building. All community members can vote on how useful an attribution is and can create their own attributions.

*As a side note, resources are named something like Qmt3z9320ba , and these names also function as locations (addresses) of files with detailed information about each invention, including schematic drawings and textual descriptions. If any of the files to which these addresses point are modified, the entire address changes — one way to make sure each timestamp accurately reflects the information with which it’s associated. 

Part II

Larry owns a hip cafe in Tel Aviv and has invented many gadgets on his quest to brew the perfect cup of coffee. As he sips on a cup of coffee and browses the blackswan network, inspiration strikes, and he has a new idea for a modified French press that could be built using the spring-loaded mechanism underlying Roy’s Retractable Needle. Larry draws up some sketches and a description of how his Better Coffee Press would work and confidently uploads the information to the blackswan network. He doesn’t need to worry about someone else claiming ownership of his ideas because there’s a timestamped record of this information on the blackswan network. 

Part III

The owner of Oakland Standard, a manufacturer in Oakland, California, discovers Larry’s sketches a week later and calls him in his cafe. He loves the idea, he tells Larry, and wants to bring his product (Better Coffee Press) to the U.S. market. One of Oakland Standard’s designers suggests using a slightly modified component from Ernie’s Excellent Pen (Larry’s never heard of Ernie or his epi pen, but he likes Oakland Standard’s suggestion). Larry seals the deal with Oakland Standard. 

Oakland Standard eventually takes the product to market, and it’s a hit among hipsters and coffee connoisseurs across the U.S.. After Oakland Standard (and Larry) make their millions, the design for Better Coffee Press appears on the blackswan network around the same time that the patent is published and viewable on Google Patents and the US Patent and Trademark Office website:


Type: device
Name: Better Coffee Press
Function: hand-operated coffee brewing device
Content-addressed hash: Qbb4a27e6783
Author1: Larry Bucks
Timestamp: 1601036650
Classifier1: Food and Beverage
Classifier2: Brewing System

Part IV

Dr. Xu is having another rough day in his lab. He heard about the Better Coffee Press on reddit and bought one so he can brew coffee in between experiments. As soon as his coffee press arrives in the mail, Dr. Xu brews his first cup of coffee, sets his laptop on his lab bench, and pulls up a stool. Sipping an extraordinarily delicious cup of coffee, he admires the technical genius of this new coffee press and begins dismantling the gadget. As he takes apart the coffee press, he records the following attributions (logical associations between the coffee press and its underlying components) on his quest for inspiration for his own inventions:


Human version:
[Appraiser's (Dr. Xu's) Ethereum address, Resource1 (Roy's Retractable Needle), Resource2 (Larry's Better Coffee Press), Timestamp, Transaction Handle]

Machine version:
[0x6060604052341561000f576, Qmt3z9320ba, Qbb4a27e6783, 1508029285, 0xa8e493eb108266c548906331]

[Appraiser's (Dr. Xu's) Ethereum address, Resource1 (Ernie’s Excellent Pen), Resource2 (Larry's Better Coffee Press), Timestamp, Transaction Handle]

[0x6060604052341561000f576, Qz429ccr082, Qbb4a27e6783, 1508029285, 0xd8a493eb106206a448906257]

Part V

Oakland Standard sells tens of millions of dollars worth of the Better Coffee Press, and Larry makes a fortune in licensing fees. Meanwhile, Roy, Ernie, and Dr. Chang have also made millions — in tokens.

Whenever blackswan community members like Dr. Xu appraise information by creating and voting on the quality of attributions, inventors like Roy, Ernie, and Dr. Chang receive tokens on the blackswan network. 

But why would anyone care about earning tokens when they could earn real money like Larry and Oakland Standard? Aren’t these tokens just monopoly money? Larry and Oakland Standard earned their wealth by operating within the intellectual property systems of each respective country where they manufactured and sold the Better Coffee Press. They had the financial resources to pay intellectual property attorneys tens of millions of dollars in fees to draft and review contracts, and even more to enforce their patents by taking infringers to court.

But what about all the smart people out there who don’t have the same access to intellectual property attorneys and millions of dollars in investment capital? 

Larry may be a clever capitalist, but he also sees the value of the novel economy emerging around the blackswan network. As he sips on a cup of coffee, Larry is already planning his next big venture. He announces on his cafe’s website that he’s on a quest to build an even better coffee brewing system and drafts an Ethereum contract that will award $5 million to all the tinkerers out there who make the most meaningful intellectual contributions to his future invention. Larry types up his Ethereum contract, buys $5 million worth of Ether, and sends these funds to be held in digital escrow. He then creates this entry for his future invention on the blackswan network, which he calls Best Coffee Press:



Type: device Name: Best Coffee Press 
Function: hand-operated coffee brewing device that keeps coffee warm and serves up to 6 people 
Content-addressed hash: Qzt7w201e55j 
Author1: Larry Bucks 
Timestamp: 1720015640 
Classifier1: Food and Beverage 
Classifier2: Brewing System

Part VI

One year and many blockchain transactions later, new records of device components and devices have been created on the blackswan network, new attributions have been made, and millions of makers have earned tokens for their contributions. Larry has also amassed a personal fortune as a result of his second contract with Oakland Standard to manufacture and sell his latest invention, Best Coffee Press. 

Larry’s smart contract then distributes the $5 million that have been held in escrow for the past year to 280 inventors on the blackswan network whose work has contributed to the creation and success of Best Coffee Press. Rather than dividing $5 million equally among 280 people (each receiving $17,857.14), Larry wrote his contract to reward inventors proportionally to their contributions; the more frequently a device or component appears in the blockchain in the form of attributions (as they relate to Best Coffee Press), the greater those inventors’ piece of the $5 million pie. 

While making his own personal fortune (and bringing wealth to Oakland Standard, teams of attorneys, factory workers, and international governments), Larry also brought wealth to 280 inventors who would not have otherwise contributed to or benefitted from Larry’s success he had operated solely under existing systems of information disclosure, such as the US Patent and Trademark Office. Through his foresight in adopting the blackswan network, Larry was able to create his Best Coffee Press in half the time it took to create his less innovative (and less successful) Better Coffee Press.

One of Larry’s childhood friends, now a famous Professor of Medicine, read a newspaper article about Larry and came to visit his old friend in his cafe. 

Larry greeted his old friend with a warm hug and insisted on brewing the best cup of coffee for him using his latest invention. As they enjoyed what Prof. Grossman admitted was truly the best cup of coffee he had ever tasted and watched people hurrying beyond the cafe’s windows, Prof. Grossman began, “I’ve heard of billionaires who’ve made fortunes building monopolies…but a billionaire who’s made fortunes by dismantling monopolies?”

turkish_coffee.jpg
Larry pouring coffee for his childhood friend

Larry’s face wrinkled with laughter. “Most people think that wealth can be made only at others’ expense,” he answered. “The secret is, the more you give, the more you get. And here I’ve found a way to do just that.”

“From a certain point onward there is no longer any turning back. That is the point that must be reached.” ― The Trial (Franz Kafka)

How to create a private Ethereum network

 

Omar Metwally, MD 
University of California, San Francisco

DDASH - Ethereum Operating System for Knowledge Creation and Sharing
=============================================
    Github repository
    -----------------
    Project website
    -----------------

Objectives:

  1. To create a private Ethereum network
  2. To deploy a simple contract to your private Ethereum network
  3. To interact with a contract on your private Ethereum network

Target audience:  

Ethereum developers.

Necessity: 

The need for this tutorial arises from outdated Ethereum documentation, resulting in hair-pulling, heartburn, and insomnia.

Precautions:

Isolate your development environment, and your private Ethereum network, from any real Ether you might have. It’s easy to compromise your machine and lose real money if you slip up.

Part Two

After you finish this tutorial, check out Part Deux: How to connect 3+ nodes in a private Ethereum network.

Step 1: Set up a virtual server and install Ethereum command-line tools

Many tutorials guide you through deploying contracts using the Ethereum wallet GUI. I’m using the Go Ethereum client (geth) and encourage others to learn how to use the command line interface (CLI). The better you understand the Ethereum client’s internal workings and the anatomy of a blockchain, the more power to you. It doesn’t matter which hosting service you use,  but these instructions assume you’re running an Ubuntu server. [Geth Installation instructions for Ubuntu] 

My private network is called “UCSFnet” at this (fake) IP address 101.102.103.104

Very important: make sure you set aside at least 2GB RAM on your virtual server in order for mining to work. If you skimp on RAM, mining may not work.

Now open a new terminal window, log into your Ubuntu server via SSH and create your working directory called “ucsfnet”

ssh root@101.102.103.104
mkdir ucsfnet
cd ucsfnet
mkdir data
mkdir source

Step 2: Create genesis block

The genesis block is the first block of any blockchain and its parameters are specified in “genesis.json”, which I saved under /root/ucsfnet/genesis.json. My genesis block looks something like this:

{
"config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },

  "alloc"      : {
  "0x0000000000000000000000000000000000000001": {"balance": "111111111"},
  "0x0000000000000000000000000000000000000002": {"balance": "222222222"}
    },

  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x00001",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000000107",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

Note that chainId=1 refers to the main Ethereum network, so it’s important to create a unique chainId for your network so your client doesn’t confuse your private blockchain with the main network. For the sake of illustration and testing, set mining difficulty to a low value. Also make sure you specify a unique nonce to start out with. The alloc field allows you to pre-populate accounts with Ether.

Now navigate to the directory where you created your genesis.json file and initialize the bootnode, a node through which your Ethereum client can join your private network and interact with other nodes connected to your private network.

cd /root/ucsfnet/data
geth --datadir=/root/ucsfnet/data init /root/ucsfnet/genesis.json
bootnode --genkey=boot.key
bootnode --nodekey=boot.key

Pay attention to the enode address that the previous commands results. You’ll need this for the next step.

Step 3: Connect to your externally reachable bootnode

The bootnode you created in the previous step is externally reachable, and in this step we’re going to connect to that node to create a one-node network. As you go through this tutorial and expand your knowledge of Ethereum networking, you’ll be able to add infinitely many nodes to your private network. The following commands create the geth.ipc file you’ll need to interact with your network in the subsequent steps. However after completing this tutorial, you’ll be able to skip this step the next time you connect to your network if you’re developing/testing and not using any networking protocols.

Open a new terminal window:

ssh root@101.102.103.104

geth --datadir=/root/ucsfnet/data --bootnodes=enode://148f3....@101.102.103.104:3031

Replace 148f3…. above with the enode address from Step 2. Make sure to include the enode://  prefix.

Step 4: Create a new account and check your balance

Start by opening a new terminal window and connecting to your virtual server via SSH:

ssh root@101.102.103.104
geth attach /root/ucsfnet/data/geth.ipc 
> eth.accounts

You’ll notice that there are no account addresses yet. Now you’ll create your first account. Be sure to replace “mypassword” with a strong password. Remember it and keep it safe; Ethereum is unforgiving in that there is no way to unlock your account if you forget your password!

> personal.newAccount("mypassword")
> web3.fromWei(eth.getBalance(eth.accounts[0]), "ether")

Remember your account’s address, which is prefixed by “0x”. Notice that your account has zero Ether, but don’t be discouraged. I’ll soon turn you into an Ethereum billionaire (but alas, the Ether you collect on your private network is only good on your private network).

Step 5: Mine on your private network

The purpose of mining here is two-fold. First you create Ether which you’ll need to power your transaction through gas (an Ethereum sub-unit). Second, mining incorporates your transactions into the blockchain. Open a new terminal window and connect to your private server:

ssh root@101.102.103.104
geth --datadir=/root/ucsfnet/data --mine --minerthreads=1 --etherbase=0x...

The etherbase parameter specifies the address which should receive the Ether you generate by mining. This should contain your wallet address from Step 4. If you check your account balance again (Step 4), you’ll find that you quickly became a billionaire. Congratulations! Again, the Ether you generate on your private network is only good on your private network, but that’s OK. Your newfound knowledge of how to develop for Ethereum is more valuable than all the Ether in the world.

Step 6: Compile a simple contract

Unfortunately, the official Ethereum documentation has not been updated to reflect the fact that compiling using the solC compiler is no longer possible via RPC. This means that you will end up in a rabbit hole if you try to follow the instructions on the official Ethereum documentation and many other tutorials based on official documentation. There are 2 ways to compile contracts, and I encourage you do try both so you understand what’s going on under the hood.

First install the command-line compiler, solC:

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

Now open a new terminal window, connect to your server via SSH, and navigate to the directory where your source code will live:

cd /root/ucsfnet/source

And save this demo “greeter” contract in /root/ucsfnet/greeter.sol:

contract mortal {

/* Define variable owner of the type address*/
 address owner;

/* this function is executed at initialization and sets the owner of the contract */
 function mortal() { owner = msg.sender; }

/* Function to recover the funds on the contract */
 function kill() { if (msg.sender == owner) selfdestruct(owner); }
}

contract greeter is mortal {
 /* define variable greeting of the type string */
 string greeting;

/* this runs when the contract is executed */
 function greeter(string _greeting) public {
 greeting = "UCSFnet lives!";
 }

/* main function */
 function greet() constant returns (string) {
 return greeting;
 }
}

Now compile this contract using solC:

solc --bin --abi  -o /root/ucsfnet/source /root/ucsfnet/source/greeter.sol 

In the above command, the bin and abi flags tell the solC compiler to generate Ethereum Virtual Machine (EVM) bytecode and an Application Binary Inferface (ABI) file, respectively. The o flag defines an output directory where these files will be created, and the last argument is the location of the contract (*.sol file) you want to compile.

Compiling a contract this way generates two files:

EVM file, indicated by the *.bin extension. This corresponds to the contract bytecode generated by the web-based compiler, which is easier to use and will be described below.

ABI file, indicated by an *.abi extension. An application binary interface is like an outline or template of your contract and helps you and others interact with the contract when it’s live on the blockchain.

Open both files using vim or your text editor of choice to see what they contain. Understanding what these files contain will make deploying and interacting with your contracts much clearer.

Alternatively, you can use the online compiler. This is easier because you can just copy-paste your Solidity code. However both methods are equivalent, and I’ll elaborate on this below. Copy and paste the code in greeter.sol (above) into the online compiler. Give it a second, and then click on the “Contract details…” link. Notice that the contents of the Bytecode field are equivalent to the greeter.bin file that you created using solC. Also notice that the Interface field is equivalent to the contents of the greeter.abi file you created when you compiled using the command-line solC compiler.

Step 7: Deploy a “Greeter” contract to your private network

Copy the contents of the Web3 deploy field in the online compiler. Paste them into a text editor on your computer and note the bolded changes I made:

var _greeting = 'UCSFnet lives!';

var browser_ballot_sol_greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"type":"constructor"}]);

var browser_ballot_sol_greeter = browser_ballot_sol_greeterContract.new(

  _greeting,

  {

    from: web3.eth.accounts[0],

    data: '0x6060604052341561000f57600080fd5b6040516103dd3803806103dd833981016040528080518201919050505b5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6040805190810160405280600d81526020017f48656c6c6f2c20576f726c642100000000000000000000000000000000000000815250600190805190602001906100b99291906100c1565b505b50610166565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061010257805160ff1916838001178555610130565b82800160010185558215610130579182015b8281111561012f578251825591602001919060010190610114565b5b50905061013d9190610141565b5090565b61016391905b8082111561015f576000816000905550600101610147565b5090565b90565b610268806101756000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806341c0e1b514610049578063cfae32171461005e575b600080fd5b341561005457600080fd5b61005c6100ed565b005b341561006957600080fd5b61007161017f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b25780820151818401525b602081019050610096565b50505050905090810190601f1680156100df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561017c576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b610187610228565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561021d5780601f106101f25761010080835404028352916020019161021d565b820191906000526020600020905b81548152906001019060200180831161020057829003601f168201915b505050505090505b90565b6020604051908101604052806000815250905600a165627a7a7230582069d50e4318daa30d3f74bb817c3b0cb732c4ec6a493eb108266c548906c8b6d70029',

    gas: '1000000'

  }, function (e, contract){

   console.log(e, contract);

   if (typeof contract.address !== 'undefined') {

        console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);

   }

})

Save the above as myContract.js.

Before we proceed, make sure your account balance is non-zero and that your account is unlocked. If your balance is too low, or if your account is locked, you won’t be able to deploy your contract. Follow the above steps to make sure you generate Ether by mining, and unlock your account as follows (replacing mypassword with the password you invented while creating your account):

Open new terminal window:

ssh root@101.102.103.104 
geth attach /root/ucsfnet/data/geth.ipc 
> web3.fromWei(eth.getBalance(eth.accounts[0]), "ether")
> personal.unlockAccount(eth.accounts[0], "mypassword")

If I’ve lost you, pay attention here because this is important. This is where the Ethereum documentation hasn’t been updated yet, creating confusion regarding how contracts are compiled. Note that the web3.eth.contract() function takes as an argument an ABI. This is the same as the greeter.abi file you created using the solC compiler! Also note that the data field is equivalent to the greeter.bin EVM bytecode, with the exception that it’s prefixed by “0x”. 

Time to deploy your contract:

loadScript(myContract.js)

You should see something like:

Contract mined! address: 0x4000737c8bd7bbe3dee190b6342ba1245f5452d1 transactionHash: 0x0a4c798467f9b40f2c4ec766657d0ec07c324659ea76fcc9c8ad28fc0a192319

Congratulations! Your contract lives at the following address on your private blockchain:

0x4000737c8bd7bbe3dee190b6342ba1245f5452d1

Make a note of this. You’ll need your contract’s address to interact with it (and allow others to do the same).

If this didn’t work, make sure you’re actively mining in another window so that your transaction is incorporated into the blockchain.

Step 8: Interacting with a contract

Again, this is another place where the Ethereum documentation hasn’t yet been updated and refers to deprecated functions. With your geth client fired up, try the following:

> var abi = '[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"type":"constructor"}]'
> var abi = JSON.parse(abi)
> var contract = web3.eth.contract(abi)
> var c = contract.at("0x4000737c8bd7bbe3dee190b6342ba1245f5452d1")
> c.greet()

The first 3 inputs above define what the contract looks like via its ABI. The contract.at() method takes as an argument the address where your contract lives.

You should see the following output:

UCSFnet lives! 

Big caveat: geth chokes if any of your inputs contain illegal characters. Id est:

“ (illegal) is not equal to  " (legal) 

        and

‘ (illegal) is not equal to ' (legal) 

Conclusion

We covered a lot of ground here, from setting up your own Ethereum network to compiling your contract (and avoiding rabbit holes created by outdated documentation) to deploying the contract and interacting with it. Whew! If you ever get stuck and need to start over, just reboot your server and delete your blockchain (understanding the implications of what this means…):

rm -R /root/ucsfnet/data/geth/chaindata

 “Wir werden von so manchen Despoten – etwa Institutionen, Überzeugungen oder auch Neurosen – beherrscht, die wir aus dem Weg räumen können, wenn wir sie analysieren und verstehen.”

We are ruled by so many despots — institutions, convictions, and neuroses — which we can clear away, if we analyze and understand them

— Isaiah Berlin

Portland smoke

Support my research!

If you find this information helpful, please consider supporting my research by donating Ether or Bitcoin. Equitable, transparent, high-quality healthcare for all!

ETH donations:  0x1b4Ba9c1811233805dC4f12Ca32F22cfD85DB212

BTC donations:  1Ef7oYi1zVpA4bw7hUcD8841wbdtCw4Xen

Suggested reading:

  • Nice low-level description of networking in Ethereum (uses the Python-based client):

https://ocalog.com/post/10/ 

  • Setting up private network or local cluster

https://github.com/ethereum/go-ethereum/wiki/Setting-up-private-network-or-local-cluster

  • Connecting to the network

https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network

  • The Go Ethereum client

https://github.com/ethereum/go-ethereum

  • Official Ethereum command line tool documentation

https://ethereum.org/cli

Learn Ethereum the hard way

Clear Paper

 

Note: In the spirit of open collaboration, I’m  keeping a public lab notebook of my work as a Clinical Informatics Fella at UCSF. Whether you cite or steal this, remember to build cool things that help people live healthier lives.

 

Educational objectives

There are a number of excellent technically focused blog posts on Ethereum out there. If you are interested in building Ethereum applications, I recommend making your way through these technical references (see end of article). This article is intended for non-technical readers interested in understanding, on a high level, the real-world implications of Ethereum’s application paradigm. More specifically, you should be able to answer these questions after reading this article:

  • What is Ethereum and how does it work?
  • Should I use Ethereum for my project?
  • What are the pros & cons of Ethereum?

 

Welcome to Hell

Let’s pretend you have a crazy boss (let’s call her Mary) who’s set on making your life difficult. You and Mary meet every month to check in and make sure you’re both on track. Mary takes out her notebook and takes notes while you share with her what’s going well and what’s not going as well. Because you’re an honest (and somewhat naive) person who hasn’t yet encountered someone like Mary, you start using these meetings as opportunities to speak openly, give and receive feedback, finding comfort in the fact that Mary’s faithfully keeping a record — a ledger — of your conversations. A month passes, and then two months, and Mary’s insanity pervades the workplace. With each subsequent meeting with Mary, she seems to glare at you with wider crazy-eyes, clench her teeth until they sound like they’re about to crack, and stabs her pen ever harder into her notebook while she keeps records of your discussions.

Three months into your job, you’re fed up with her madness and decide to resign (fortunately, you’re not a medical resident or other indentured servant and have the freedom to do so). Mary leads you to a quiet corner, throws a death stare at you, and growls: “If you resign, I will personally make sure you never find a job ever again.” By this point, the stench of bodies in Mary’s closet is overwhelming, and you email Mary to give 30-day notice. Then all hell breaks loose.

In following month, Mary copies you on several emails to her bosses. One of the emails accuses you of harassing her assistant (whom you’ve never interacted with). Another email warns you of several missed deadlines (for projects which never existed). Some emails state that no one has been able to reach you by email or phone (you’ve answered every call and email in the most timely fashion). You’re neither the first nor last of Mary’s victims, and you quickly learn that she’s more than a psychopath, she’s also written the book on psychological manipulation, deception, and torture. She’s creating a fictitious paper trail by sending contrived emails and writing a book of alternative facts, which her complicit assistant is co-authoring.

How can you shed light on Mary’s evil tactics and show others that her ledger is as legitimate as an acid trip? Because you’re a clever hacker, you decide to use Ethereum to shed light on a rancid situation.

Magic-Mushrooms-768x443.jpeg

 

A Distributed Ledger 

Pretend the Ethereum “blockchain” is a magic notebook that serves as a ledger. This notebook can appear in anyone’s hands, and every copy of this notebook is identical. This magic notebook is so smart it can understand your commands and write on its own pages. When one of its pages is written on, the other notebooks vote whether to accept the new page. If they do accept the new page, this change is reflected in every magic notebook. These magic notebooks follow you into meetings with Mary and record their own version of “the truth.” Each page in this notebook is analogous to a “block” in a “blockchain.”

So you buy yourself a magic notebook and bring it to your next meeting with Mary. As usual, she’s preparing her own notebook of alternative facts.  Her assistant, Karen, also shows up to the meeting with her own notebook of alternatively alternative facts. So there you are, in Mary’s office with Mary and Karen, everyone clutching their notebooks.

You:  "I quit."  (magic notebook hears this and writes it on page 1)

Mary:  "Good riddance." (magic notebook hears this and writes it on page 2)

You:  "Before I leave, you still owe me a paycheck." (magic notebook hears this and writes it on page 3)

Karen:  "You picked up the paycheck last week. We owe you nothing." (magic notebook hears this and writes it on page 4)

You:  "No you didn't. I've been asking you for that paycheck for weeks."(magic notebook hears this and writes it on page 5)

Realizing this is going no where, you walk out of Mary’s office carrying your magic notebook.

You next see Mary and Karen in court: you’re suing them for unpaid wages, and you bring along your magic notebook to set the facts right. When the judge asks you when you announced that you’re quitting, your magic notebook recites what’s written on page one: your statement (“I quit”) along with a timestamp. Mary and Karen jump to their feet and hold up copies of their own notebooks. However, the judge did her research on this new magic notebook, which is reputed to be the best ledger in the history of mankind because it doesn’t rest in any one person’s or organization’s hands. The truth doesn’t rest in Mary or Karen’s notebooks or email inboxes (or in either of their minds); the truth — the Ethereum ledger — is the account provided by the magic notebook, which is in everyone’s hands and is guaranteed to contain the same text on every page .

It’s worth repeating emphatically here that the Ethereum blockchain is a distributed ledger. 

Realizing the signifiance of this jargon-laden statement, you decide to go further than just shedding light on Mary’s career of lies and deception. You’re going to make Mary pay for all of the people she’s abused and manipulated over the years, and you’re going to do it with Ethereum. As you study this article and read more about how Ethereum works, you realize that the magic notebook is more than just a record of events. The notebook can execute logic (in the form of “contracts”) and store/modify/delete data. This is one big difference between Bitcoin and Ethereum. A Turing-complete system, such as Ethereum, can execute logic; unlike Bitcoin, the Ethereum Virtual Machine (EVM) is a stack machine. You can write contracts that transfer money and include basic logic to allow others to interact with your contract in a transparent manner. Anyone interested in examining a contract can do so.

If you had heard of Ethereum before you started working for Mary, you could have written a contract that states something like:

 

MARY SENDS MAGIC NOTEBOOK $100,000 EVERY MONTH

EVERY 2 WEEKS, MAGIC NOTEBOOK SENDS ALL EMPLOYEES $5,000

IF AN EMPLOYEE RESIGNS:

    MAGIC NOTEBOOK SENDS THEM A FINAL PAYCHECK

    MAGIC NOTEBOOK REMOVES THEM FROM LIST OF EMPLOYEES

 

Unlike a traditional contract, Ethereum contracts:

  • are transparent and can be examined by anyone
  • are trustless, meaning they execute faithfully and automatically
  • do not need lawyers or courts for interpretation

As your knowledge of Ethereum grows, you realize that you would have been better off writing your employment contract on the Ethereum blockchain rather than relying on Mary and her team of corporate attorneys. Had your contract been written on the Ethereum blockchain, you wouldn’t have had to rely on Mary’s sanity or lack thereof to get paid. The codified contract would execute autonomously, can be reviewed by you or anyone else, and does not need middlewomen/middlemen to interpret or execute (Auf Wiedersehen lawyers, HR staff, administrators, etc). In case Mary was still delusional enough to argue with the Ethereum ledger, the magic notebook would quickly provide proof of payment (or lack thereof) and the conditions under which the logic was executed. The logic on the Ethereum blockchain is transparent.

The current paradigm of hosting applications on a private server is analogous to doing business with Mary and Karen. The logic is centralized and opaque. I trust most applications about as much as I trust Mary and Karen. The average application is hosted on one or a cluster of privately owned and operated servers, and most applications are not open source (and even if they are open source, the average user doesn’t have the means to perform checksums and make sure they’re running the code they think they are). If the server crashes or the application behaves in unexpected ways, well, hard luck fella. Why would anyone trust the software equivalent of Mary & Karen when they could trust a decentralized ledger running autonomously executing logic?

Without getting too bogged down in details, I include this simple example of an Ethereum contract that creates a simple voting mechanism.

pragma solidity ^0.4.0;
contract Ballot {

struct Voter {
 uint weight;
 bool voted;
 uint8 vote;
 address delegate;
 }
 struct Proposal {
 uint voteCount;
 }

address chairperson;
 mapping(address => Voter) voters;
 Proposal[] proposals;

/// Create a new ballot with $(_numProposals) different proposals.
 function Ballot(uint8 _numProposals) {
 chairperson = msg.sender;
 voters[chairperson].weight = 1;
 proposals.length = _numProposals;
 }

/// Give $(voter) the right to vote on this ballot.
 /// May only be called by $(chairperson).
 function giveRightToVote(address voter) {
 if (msg.sender != chairperson || voters[voter].voted) return;
 voters[voter].weight = 1;
 }

/// Delegate your vote to the voter $(to).
 function delegate(address to) {
 Voter sender = voters[msg.sender]; // assigns reference
 if (sender.voted) return;
 while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
 to = voters[to].delegate;
 if (to == msg.sender) return;
 sender.voted = true;
 sender.delegate = to;
 Voter delegate = voters[to];
 if (delegate.voted)
 proposals[delegate.vote].voteCount += sender.weight;
 else
 delegate.weight += sender.weight;
 }

/// Give a single vote to proposal $(proposal).
 function vote(uint8 proposal) {
 Voter sender = voters[msg.sender];
 if (sender.voted || proposal >= proposals.length) return;
 sender.voted = true;
 sender.vote = proposal;
 proposals[proposal].voteCount += sender.weight;
 }

function winningProposal() constant returns (uint8 winningProposal) {
 uint256 winningVoteCount = 0;
 for (uint8 proposal = 0; proposal < proposals.length; proposal++)
 if (proposals[proposal].voteCount > winningVoteCount) {
 winningVoteCount = proposals[proposal].voteCount;
 winningProposal = proposal;
 }
 }
}
[Source:  https://solidity.readthedocs.io/en/develop/solidity-by-example.html%5D

 

Why develop on Ethereum?

Now that you know how Ethereum works, you have the luxury of living to witness one of the most interesting, exciting, and important developments in computing, and you too can design and develop applications on the Ethereum blockchain. Why not write an employment contract on the Ethereum blockchain that gives you and your peers a democratic way of removing problematic elements in the workplace? Or an employment contract that distributes an organizations profits more equitably and transparently? But before you can decide whether it makes sense to ditch a virtual server running your standard Python/Ruby/NodeJS/PHP/[fill in the blank] stack in favor of Ethereum, you should note a few more pros and cons of Ethereum:

Unlike the Bitcoin protocol, which is a distributed ledger of transactions based on monetary (Bitcoin) inputs and unspent transactional outputs, Ethereum is account-based. This is getting into technical details that may not interest the intended audience of this post, but it should be noted that in Ethereum there are account addresses identify users as well as individual contracts written to the Ethereum blockchain. Like Bitcoin, the Ethereum protocol is based on a cryptocurrency called Ether, which is used to fund all transactions on the Ethereum blockchain (more on this below). And just like an address that you can use to send and receive Bitcoin and Ether payments, your Ethereum contracts also have addresses which function as handles to allow users to interact with your code and identify it on the Ethereum blockchain.

 

Basic anatomy of an Ethereum contract

An Ethereum contract consists of the code you write and the state of the contract (i.e. the data associated with the contract). As described in the Solidity documentation, the magic happens in between the curly brackets, the body of a contract:

contract requestFile {

    // stuff happens here ...

}

The “stuff” consists of state variables, functions, function modifiers, and events, which will look familiar to you if you’re fluent in one of many programming languages that use these paradigms.

State variables are permanently stored in contract storage and include types such as integers (int and uint), booleans (bool), addresses (address, address.balance, address.transfer), fixed and dynamically-sized byte arrays (bytes, string), string literals, enums, structs, and mappings (similar, but not identical to, hash tables). The EVM uses standard logical operators, including comparison operators, bit operators, and index access. See the reference above for more details.

How large is a contract storage area? Vitalik Buterin answers this here. Bottom line: 2^261 bytes. That means that you’ll never really be limited by size, but rather, by the cost of conducting transactions on the Ethereum blockchain (see “Economics of Ethereum contracts” below).

Functions work similarly to other programming languages and take the form of:

function audit() returns (address addr) {
    // stuff happens here...
}

As described in the Solidity documentation, functions can be called internally or externally and have different levels of visibility, like in programming languages such as C++, Java and Python.

Function modifiers “amend the semantics of functions in a declarative way.” I’ll skip the technical details here.

Events are basically functions that use the EVM’s logging mechanism. If you’ve developed Android apps, you’ve probably used something similar.

If you’re itching to deploy a real contract to the Ethereum blockchain, check out my earlier tutorial.

 

Economics of Ethereum contracts

On a macro scale, Ethereum is a giant computer powered by every machine running the full Ethereum client. Just like every step and breath we take costs energy, so too does every computation performed by your computer require a finite amount of electrical energy. The Ethereum network is no different. The energy required to keep adding blocks to the blockchain, transfer Ether, and execute contracts is provided in the form of “gas” (an Ethereum subunit). Unlike a local machine such as your laptop, and unlike a virtual server (which runs on a real machine too), Ethereum contracts are interpreted by the Ethereum Virtual Machine, the stack machine that converts Solidity code into instructions to interact with the Ethereum blockchain.  Unlike the Bitcoin protocol, in which each transaction has a predictable cost to the network, the cost of transactions on the Ethereum blockchain depends on bandwidth consumed, computational power, and the size of data that’s being manipulated. Each transaction specifies how much gas it is willing to consume and a gas price. In the event of unused gas, the sender receives gas_rem * gas_price, and the miner of the block receives a reward of (startgas-gas_rem) * gas_price. Id est, there is a cost of conduction transactions, and miners, are rewarded financially for using their own computational power to create new blocks on the blockchain and keep the ledger going.

The economics of current application development profoundly shape how software is developed and used. Many consumer-facing applications are available for a cost on app stores or can be downloaded for a fee; many other consumer-facing applications are supported by adverts, in-app purchases, and subscription fees. Ethereum’s transactional economics were designed to safeguard against malicious agents, and understanding the Ethereum blockchain economy is important to understanding how applications on the Ethereum blockchain will function. This is illustrated in the “Security considerations” section below.

There are some good websites with details on Ethereum economics, including Ethereum’s Design Rationale and Ethereum Gas Economics.

 

Security considerations

What better way to learn good security practices on the Ethereum blockchain than to confront the most malicious of actors, your former wicked boss? While you’ve been writing Ethereum applications, Mary learned a thing or two about this Ether thingy and wrote their own contract to hinder the Ethereum network and suck your account dry of Ether. Let’s say that Mary tricks her next hapless victim into executing an Ethereum contract that does the following:

contract youGotPunked {

    function newEmployee(address dest, uint employeeId) {
        while(true) { };
    }
}

Mary is tricking her next batch of employees who aren’t savvy enough to study the contract into calling an infinite loop. If you’ve ever written an infinite loop on your machine, you know you can hang your machine by wasting all of your machine’s computing resources on executing a loop that does nothing forever. Mary’s new employees call the contract, which then runs forever, wasting computing resources across the Ethereum network. Because each transaction (such as calling the above contract) costs gas, Mary can’t use this old trick to lock up the Ethereum network.

Mary goes back to the drawing board and comes up with another contract (this example is also provided in the Solidity documentation):

contract TxAttackWallet {
    address owner;

    function TxAttackWallet() {
        owner = msg.sender;
    }

    function() {
        TxUserWallet(msg.sender).transferTo(owner, msg.sender.balance);
    }
}

When Mary’s hapless new employees call this contract, it empties all of their funds (msg.sender.balance) into Mary’s account (address owner). People have used their understanding of Ethereum’s blockchain and simple tactics such as this account emptying trick to transfer hundreds of millions of dollars worth of Ether in unexpected ways. Bottom line: there is no such thing as a perfectly secure system. The amount of energy expended in securing a system should be proportional to what’s at stake. Ethereum is no more or less inherently secure than Google or Microsoft’s applications.

 

Ethereum in healthcare 

I’m drawn to an Ethereum-based electronic health record for the same reasons I wouldn’t want anything to do with Mary and Karen. The next generation of EHRs on a blockchain should:

  • be secure, with fail-proof access control
  • be infallible, with mechanisms to deter malicious attacks on the network
  • be distributed, so that patients, providers, and researchers can benefit from responsible use data
  • be distributed, so that inter-operability is a given
  • be distributed, so that data is never lost (while preserving consensus)
  • be transparent, so that there’s an audit trail of who is accessing what
  • be transparent, so that there’s an audit trail of all transactions on the blockchain
  • be transparent, allowing health services to be rendered in the most cost-effective way possible
  • be autonomous, allowing health services to be rendered without costly third-parties who currently monopolize health data

 

Now enough White, Yellow, Mauve and Clear Papers. Let’s see some code!

 

Acknowledgements

“It’s only work if you’d rather be doing something else” (JM Barrie). I couldn’t think of a better way to spend my time, thanks to this opportunity to be a Clinical Informatics Fella at UCSF Medical Center. I’m grateful to UCSF’s Department of Hospital Medicine, my mentor, Dr. David Avrin, and my colleagues Dr. Michael Wang and Dr. Steven Chen, for their support and feedback.

 

References

  1. https://solidity.readthedocs.io/en/develop/solidity-by-example.html
  2. https://remix.ethereum.org
  3. http://ethdocs.org/en/latest/
  4. https://github.com/ethereum/wiki/wiki/Design-Rationale
  5. https://en.wikipedia.org/wiki/Bloom_filter
  6. https://ethereum.github.io/yellowpaper/paper.pdf
  7. http://whatthefuckisethereum.com/#nerd

 

 

 

 

 

 

Comments on the California Department of Public Health’s proposed regulations on medical cannabis

Note: The opinions I express here should not be construed as medical or legal advice. Marijuana is classified by the federal government as a Schedule I drug. Protect your freedom and your health by consulting a lawyer and your doctor for legal and medical advice.

In response to the California Department of Public Health’s invitation to comment on proposed regulations on medical cannabis:

I welcome the State of California’s proposed regulations for the manufacturing of medical cannabis, which I believe will help protect the safety of individual consumers and communities. I offer here my opinions on these proposals.

Despite its federal status as a Schedule I drug, cannabis is used medicinally by millions of Americans. Although only a small handful of compounds produced by plants in the Cannabis genus have been characterized, this number continues to grow as evolving legislation opens doors to medical and scientific research. Many of these compounds are known to possess therapeutic potential, individually or in synergy with other compounds. In the absence of a comprehensive body of scientific literature on C. sativa and C. indica, patients and recommending providers have few tools to help them tailor cannabis-based therapeutics, largely relying on empiric observations and trial-and-error. Each strain has a unique portfolio of psychoactive and non-psychoactive compounds which affect individuals uniquely.

Safeguarding health consumers’ safety should be the primary goal of these proposed regulations. Protecting communities and preserving the environment are also of paramount importance. The proposed regulations offer many theoretical benefits. My critique stems from a concern that these regulations, whether intentionally or unintentionally, place the interests of larger growers over smaller growers. I fear the rise of the cannabis industry’s equivalent of “Big Tobacco.” The proposed regulations disproportionately burden smaller growers with financial and bureaucratic hurdles which I worry will render so-called “Cottage” operations non-viable. The proposed regulations would impose a higher fee-to-revenue ratio for “Cultivation Licenses” for Tier 1 operations, defined as those yielding less than $100,000 in annual revenues, compared to higher tier operations.

For instance, Section 8305 and Section 8313 (“Cannabis waste management”) do not discriminate between small and very small growers, and large operations which pose much greater threats to the environment and water supply.

Favoring larger growers over smaller growers poses a threat to medical cannabis’ genetic diversity by incentivizing growers to produce the most profitable strains, rather than supplying the market with a variety of strains to meet the diverse needs of patients. This is the case with conventional as well as organic produce.

I urge the State of California to consider creating a separate category for “micro-entities,” which I define here for the sake of argument as growers possessing no more than 6 plants. Regulations should also discriminate between micro-entities who manufacture medical cannabis for their personal consumption, and micro-entities who sell what they produce. The current definition of “commercial cannabis activity” as activities that include “cultivation, possession, manufacture, processing, storing, laboratory testing, labeling, transporting, distribution, or sale of medical cannabis or a medical cannabis product” is problematic because it does not make the aforementioned distinction. The rationale for imposing regulations on large growers to protect consumers, communities, and the environment does not apply equally to large and small growers. Micro-entities should be subject to regulations that do not disproportionately burden them and should be exempt from much of the administratively burdensome language of these proposals. Because micro-entities do not share the same financial incentives as large growers, I hope that making it easier for micro-entities to manufacture medical cannabis would promote the genetic diversity of medical cannabis.

I would also like to briefly comment on the language of a few other statements which caught my attention. Section 8401 describes a “Track-and-Trace” system that would allow the State of California to account for the production and dissemination of medical cannabis products. We should apply our experience with other industries to prevent State and private monopolies from hindering innovation. I use the example of Electronic Health Records because of my familiarity with the healthcare industry: stringent regulation on electronic medical record vendors has promoted the formation of monopolies to the detriment of innovators who would have otherwise worked to develop more functional and less expensive software. It is crucial that a State-sponsored Track-and-Trace system feature an open API which would facilitate the growth of an ecosystem of tools to help growers and manufacturers comply with these regulations.

I also advocate against a separate “Nursery License”, particularly for smaller growers, because it would impose further licensing hurdles for these growers.

Article 1, Section 8000, Subsection (f) states: “Commingling is prohibited in Section 8207 of these proposed regulations to retain the integrity and clear accountability of the product.” I strongly agree with this statement for the aforementioned reasons.

Subsection (t) defines “outdoor cultivation” as “a method of cultivation techniques that does not use light deprivation techniques. Outdoor growers who rely entirely on natural sunlight can utilize light deprivation to harvest up to 4 times annually. I find the definition of outdoor cultivation inaccurate and misleading. Outdoor cultivation could instead be defined by whether or not electrical energy is the primary light source for marijuana plants.

My final comments pertain to county regulations rather than state regulations, but I would like to express them here since state regulations supersede county regulations. Mendocino County imposes regulations on marijuana farms which also apply to vineyards, such as having restrooms in greenhouses, limits to the maximum incline grade leading to a greenhouse, and the construction of greenhouses. Again, safety of patients, cannabis industry workers, communities, and the environment is paramount. At the same time, It’s worth bearing in mind that the nature of a medical marijuana farm is much different than a vineyard. To consumers of medical cannabis, marijuana is medication. A vineyard is a recreational area and its product has no therapeutic indication accepted by the medical community. I again urge the writers of these regulations and California voters to consider a more nuanced definition of “commercial cannabis activity” than the current one.

Thank you for the opportunity to comment on these proposed medical cannabis manufacturing regulations.

Respectfully,

Omar Metwally, MD

 

Letter to my Family on Christmas Eve

Dear Father and Mother,

I can imagine how cozy it must be now in Michigan, and I wish I could have shared the season with you. I had a beautiful day starting with yoga, then a trip to the farmer’s market, where I had a half-hour conversation with a farmer famous for growing the best pomegranates ever. I bought his last 15 pomegranates; he was retiring and moving to a gorgeous country estate in Montana. He had made his wealth in business then started farming as a hobby, and made a killing doing that too! He was the wisest person I’ve ever met. He said that he has everything because he has his health.

I got sunburned on the way back with my moonroof down. I’m as white as mom.

When I got home, I started chatting with my neighbor for the first time, and he invited me into his place to meet his wife and 2 children — such a beautiful family, a Nepalese couple and their 2 kids. I gave them some pomegranates, and they fed me dinner. It was delicious.

And tonight I’m working the 10pm to 10am shift at the hospital. I couldn’t think of a better way to spend Christmas Eve, taking care of people. It was a day of adventures. I think I live the happiest and most interesting life.

I told them I was vegetarian (something I’ve recently started), and he looked so disappointed. He was like, I know about your religion. I joked that my religion is yoga, and he continued, I know about halal and I don’t eat pork either. It turns out we both make our own yoghurt, too! So I said what the heck, if it came from your hands it must be delicious. It was chicken, tofu and vegetables cooked in a spicy broth with curry. It was heavenly.

I ate every last piece of ricepom

Your Very Affectionate Son,

Omar

Minimally Invasive Software

If I could gaze into my profession’s crystal ball when I was still a pre-med college student 10 years ago, I would have been stunned by contemporary doctors’ dysfunctional relationship with electronic health records (EHRs). I have more than a half-dozen free apps on my phone that empower me to video chat with friends and family continents away, cloud-based apps that let me create and share media-rich documents on any device — yet I’m stuck spending half my workday fighting with EHRs that look and function like mind-numbing spreadsheets. Not what I signed up for!

I grew up shadowing, and later working, in my father’s private medical practice and had the privilege of getting to know his patients and their families on a personal basis. When medical school exams kept me from spending my Saturdays in the office, my dad would come home and say over dinner, “By the way, Ms. Muller asked about you today,” as if she were an aunt asking about her nephew. His patients became in many ways a large, extended family that inspired me to devote my life to a profession I regard as sacrosanct. The work is selfless, the science fascinating, but what I love most are the personal connections I make with people everyday: sitting eye-to-eye and listening to others’ problems, fears, and dreams, and helping them live better lives.

It took me by surprise. While I was busy taking exams, a handful of EHR oligarchs emerged to save us from ourselves and our own handwriting. Hospital by hospital, clinic by clinic, our profession succumbed to “Spreadsheet Syndrome.”

Before entering Mr. Jones’ exam room, Dr. Patel glances at her EHR to see her patient in numbers: tabulated lab values, an archive of old notes, imaging reports, and test results. Laptop in hand, she enters Mr. Jones’ room, offers her hand and a tired smile, and immediately starts typing her note, checking and ordering tests, and entering prescriptions and referrals — while Mr Jones fades behind the wall of numbers on her screen.

I first heard of Amazon’s Echo while developing a voice-activated web app, in the context of an academic research project, which passively “listens” to a patient-physician encounter and delivers relevant reference information. My research mentor and I both thought that it might be interesting to port the app to Echo, and I invested $150 and a few weeks of time to build my first two Alexa “skills” (apps for Amazon Echo): a health tracker and a yoga coach (which has been used by more than 3,000 yoga fans at the time of this writing).

How software is designed profoundly influences how we think. I watch both amused and saddened as medical students and interns’ eyes glaze over endless rows of numbers only to find themselves drifting further and further away from their patients rather than actually knowing their patients. Instead of stopping by a patient’s room to ask him or her why they hospitalized last month when visiting their family in the Midwest, we find it easier to just review the EHR from the comfort of our desk. In the process of drowning healthcare professionals in minutia, EHRs obscure our ability to see the forest for the trees.

I believe strongly that the patient-physician conversation is the cornerstone of medicine. The best technology we can implement in the healthcare setting should be invisible – or as inconspicuous as possible.

One of my early endeavors along these lines was a Google Glass app (Vidrio) that passively “listened” and “watched” during patient-physician encounters to generated structured documentation from unstructured audio/video data. We won the 2014 MIT healthcare hackathon with this app, which was intended to liberate healthcare providers from the need to type their notes while interviewing patients. While my colleagues loved the concept (and countless doctors have asked me to pilot the app in their own practices), it seems to solve one problem while creating another. I’ll be the first to admit that I wouldn’t feel comfortable having a candid conversation with my own doctor if they wore a pair of Google Glass during the visit.

Rather than letting a device stand between patients and their doctors (literally and metaphorically), the Amazon Echo can quietly sit in the corner of an exam room, answer questions when called upon (“Alexa, give me a trend of Mr. Jones’ kidney function over the past year”…”Alexa, did Mr. Jones get his flu vaccine this year?”), then quietly fade out of the conversation. How’s that for minimally invasive software?

I’m working to save my profession from Spreadsheet Syndrome by helping doctors use Amazon Echo to interface with their EHRs. It’s about time we start using technology to help us spend more time doing the most important and satisfying part of our work: listening to our patients.

Omar Metwally, MD

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