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 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 [https://patents.google.com/patent/US139121A/en]. 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 generate 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.

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

A stroll through Victory Mansions

Omar Metwally, MD
Analog Labs
19 November 2018

It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.

Opening paragraph of George Orwell's Nineteen Eighty-Four. 
306 characters, including spaces.

I did some back-of-the-napkin math to calculate how much it would cost today to upload George Orwell’s novel Ninteen Eighty-Four to the Ethereum blockchain.

To upload the opening paragraph using this Ethereum contract (there are much more efficient ways to accomplish this using Solidity), the transaction would cost 290697 gas under current network conditions. If the entire 576,789-character novel were uploaded in the same manner, it would cost 576789 * 290697 / 306 = 54743895.20588 gas. Gas is currently about 2.2 * 10^9 wei [1].

(54743895.20588 gas) * (2.2 * 10^9 wei / 1 gas) * (1 Ether / 10^18 wei) = 1.2 Ether.

The carat symbol (X^Y) here indicates “X to the power of Y”.

In this manner, Orwell’s Ninteen Eighty-Four would cost 1.2 Ether to upload to the Ethereum blockchain, where it would be permanently and publicly available, served by more than 10,000 nodes.

If Ether were regarded in terms of its utility rather than as a speculative or financial instrument, there would likely be much less price lability, assuming society’s utility for a technology in general changes at a much slower rate than a market’s enthusiasm for securities and commodities. For instance, the cost of electricity in the residential setting varied from an average of 11.26 cents per kWh in 2008 to 12.89 cents per kWh from 2007 to 2017 [2]. Contrast this with the cost of Ether ranging from less than $1 in 2015 to more than $1,400 in early 2018.

How much does Ether really cost? A dollar? $100? $1000?

One way to begin answering this question is to study current market rates of cloud hosting services [3, 4]. Google offers a 2TB standard storage tier at $0.000274 per hour, and Amazon’s standard EC2 instances can range from $94 to $2,367 annually. A direct comparison with the cost of uploading Orwell’s novel is inaccurate because:

  • Information uploaded to the blockchain is permanent as long as a majority of nodes continue perpetuating the blockchain. Cloud hosting contracts are only as permanent as a recurring credit card payment, a company’s existence, and its willingness to serve data.
  • Google and Amazon cloud instance capacity is much larger than the 590kb size of Nineteen Eighty-Four as a text file.
  • Cloud hosting companies charge for bandwidth, whereas there are no blockchain transaction costs associated with downloading blockchain data
  • Conversely, running blockchain clients consumes a lot of bandwidth
  • A large, distributed network’s downtime is virtually zero and is theoretically much more resistant to hacking

I offer file storage as an imperfect thought experiment because a significant part of what consumers pay for when purchasing a smart phone is the ability to store large amounts of media, access and share these data. This thought experiment is only a starting point to answering the question of how much one Ether actually costs.

It took decades for the internet’s value to manifest, which today often takes the form of profiling users and using this information to sell digital ads. As one of my academically-minded siblings keenly points out, however, one important difference between the origins of the internet as we know it today and blockchain networks whose tokens are traded on exchanges is that the internet was built in a more farsighted manner without the objective of making money for speculators. ARAPANET, the precursor to the modern internet, initially ran on four Interface Message Processors (IMPs) at UC Santa Barbara, Stanford, the University of Utah, and UC Los Angles [5]. Of course, the internet has changed dramatically since its early years, and technology in general is constantly evolving under the pressures of regulation and free markets.

Crypto markets poisoned blockchain research by muddling networking protocols and stake in open source projects with financial speculation. On one hand, capital is an important element of many large endeavors. On the other hand, skyrocketing prices and price lability can breed greed, resentment, and hinder the ability of programmers, consumers, and researchers to actually use networking protocols. The lower the price of crypto, the cheaper the transactions on the network and the more accessible the protocol is to the average consumer.

So how much does Ether really cost? A dollar? $100? $1000?

One step toward answering this complicated question is to ask: how much would you pay to perpetually host George Orwell’s Nineteen Eighty-Four (or another 590kb text file or image)?

Great Explorers

Omar Metwally, MD
Analog Labs
15 September 2018

 

She was one of the truly fortunate people who discover what they love to do, have the means and the courage to follow their passion, and the gift to share their discoveries.

Robin Hanbury-Tenison on botanical artist Marianne North

Traveling in Japan with friends, Robin Hanbury-Tenison’s The Great Explorers captivated and inspired me with a collection of biographies of courageous individuals who explored and discovered continents, oceans, deserts, caves, and rivers. These people lived in times when large parts of Earth’s surface were unknown to humanity and entirely uncharted, and their stories left me wondering which frontiers stand before their contemporaries in pursuit of advancing society’s collective knowledge.

Most of these explorers lived before the advent of the digital age, relying on analog instruments to study terra nova: magnetic compasses, sextants, pacing beads, and their powers of observation. A journey that spans thousands of miles over years requires a deliberate estimation of the minimum amount of equipment necessary to facilitate their survival and studies without burdening them. In stark contract, we live in a time of abundant and oftentimes superfluous technology. During the past weeks of travel, I meditated on the question of how much technology one actually needs without becoming burdened by it. Every day reminded me of the joys of good company, the mind’s capacity to acquire languages, the utility of answering questions by asking locals rather than searching the web, and a postcard’s ability to distill thoughts into a memorable moment. Translation software and internet access, while sometimes handy, are no substitute for a sound grasp of a foreign language and asking locals how to get around. Google can help translate a phrase in a pinch, but it’s unlikely to know that a typhoon blocked a bus route and that a taxi driver will find the safest way home.

Richard Burton taught himself to speak 27 languages by the time he died in 1890, and his mastery of cultural camouflage opened doors to civilizations in Africa, India, and the Middle East which would have otherwise been closed off to Europeans of his time. Gertrude Bell, the first female officer in British Intelligence, mastered Arabic and Persian, translating poems by Hafiz as she trekked across deserts meeting local sheikhs and tribe leaders.

The tools one has at hand bias one’s approach to discovery. Compare our trip to Japan, for example, with that of Francis Garnier, who embarked on a treacherous journey to explore the Mekong with his crew. Compared to Garnier’s crew, we enjoyed every luxury available to modern travelers: airplanes, hotel reservations at our fingertips, smart phones, and Google Translate. And should we stray from cell reception or forget to charge our phones, my GPS-connected RPI can still pinpoint our whereabouts anywhere on Earth. Unlike the fearless explorers who risked life and limb in pursuit of beliefs, passions, or sheer love for discovery, who immersed themselves in native cultures and dedicated lifetimes to observing and describing, one might say we left Japan only slightly more acquainted with its people and culture as when we arrived.

IMG_3763

Humankind – the individual mind and collective human behavior – is a perpetual frontier. Know thyself, so the wisdom of ancient civilizations. Most interesting to me and pertinent to my research is the question of how human societies can use finite resources to provide better lives for future generations. A solitary zero-sum endeavor has the potential to become a vast leap forward when knowledge is shared effectively with a global village. This is what excites me most about open source collaboration and paradigms of participatory computing, such as peer-to-peer networking and data structures based on them.

Norwegian explorer Roald Amudsen left his medical studies to pursue his childhood dream of traversing the Northwest Passage. Having gone into debt to acquire a shipping vessel and assemble a team that would succeed in achieving his childhood dream – as well as becoming first to reach the South Pole – he departed on his journey hours before debt collectors planned to seize his ship. Debt was a recurring theme in many of these ventures, and many explorers burned through personal fortunes, imperial funds, or private capital to fund their expeditions. Amudsen’s story is an example of humankind’s capacity to lift itself from its own bootstraps, to produce lasting humanistic and technical works that are greater than the sum of individual labors. Amudsen’s successful return converted the same debt collectors into patrons and benefactors eager and proud to support his future voyages.

Screen Shot 2018-09-15 at 4.07.58 PM

Screen Shot 2018-09-15 at 4.07.00 PM

I chronicled our trip on the Ethereum network for the sake of posterity and to illustrate the utility of technologies that have grown into areas of interest and focus for me. For non-technical users, the easiest way to download these points from the Ethereum blockchain is to use the Ethereum Mist Browser (similar to a web browser for blockchain).  They can also be downloaded using numerous command-line frameworks for interfacing with the blockchain, such Web3py.

Fleet Fox contract address:

0xe18FE4Ded62a8aa723D6BE485B355d39d409354d

Link to Fleet Fox ABI

Many colleagues and friends have asked me, in the context of the distractions of financial speculation, why anyone would bother developing an application on a blockchain and forego the relative ease and inexpensiveness of services offered by large, established corporations. The reason why most people, myself included, use services offered by large tech companies is because they sell useful products. It is the logic of a free market. For example, I have a MacBook and iPhone, and I have benefitted from Apple, Google, and Amazon’s products. My work studio is also filled with home-made computers running Linux-based operating systems, and I use the Ethereum blockchain on a daily basis to run my and others’ code, which performs familiar tasks such as networking, storing, and moving information. To enjoy the convenience of mainstream products such as iMessage, iCloud, and iPhone, one must pay the Apple “tax” by purchasing one’s way into the Apple ecosystem, an exclusive gateway to access one’s multimedia, emails, text messages, documents, and personal contacts’ information. To enjoy the convenience of Google’s cloud, one pays the Google “tax” by waiving a certain degree of privacy and control over one’s personal data, which is only as permanent as a recurring credit card payment, the company’s existence, and the output of its machine learning algorithms. The same analogies and parameters can be extended to Facebook and Amazon.

The notion of transaction costs on blockchain networks is the analogous “tax” one pays for the security, persistence, and control over one’s information on a decentralized network, which are sacrificed more or less when relying on corporations. It is the cost of digital sovereignty. At the time of writing, the transaction cost of uploading each individual GPS location onto the blockchain cost 0.0004164664 Ether, or $0.09 at a rate of 1 ETH = $220 USD.

Blockchain technologies are in their infancy. Using a Blockchain Messaging Service today reminds me of sending email in the early 90s, when my uncle (a networking engineer) and a few hobbyists in the UK and Japan, whom I had never met, were the only people in my address book. One of my first books was a kid’s guide to the internet, which listed a handful of websites, such as Nickelodeon, Kellogg’s, and NASA, along with the authors’ advice to have a pencil and paper handy to doodle because some images (very low-resolution by today’s standards) could take up to 30 minutes to load on slow dial-up connections. Like those early days of the internet, blockchain applications still have a long way to go. And that’s what makes working with this technology fun and worthwhile. It’s a new frontier.

Fleet Fox (Github repo | Fleet Fox receiver) is an application that allows decentralized exchange of information and value tied to one’s physical location. It’s built on the same open source infrastructure I’ve used to chronicle our trip to Japan, and I’m excited to pilot the technology as a backend for vehicle fleet-sharing services in coming months. I would be grateful for and humbled to receive feedback from fellow explorers using it to collaboratively build a behavior-centric map of the world on the Ethereum blockchain.

IMG_3747

Take-Home Lessons:

  • What you really need is good friends. Technology is optional.
  • Anything can be learned.
  • Transaction costs on blockchain networks contribute to security, persistence, and control over one’s information on a decentralized network

Participatory Computing

One of my family friends congratulated me recently on the success of the ‘Ether startup,’ leaving me briefly puzzled. While the parallels between issuing common stock, stock options, and digital tokens are relatively intuitive, this was the first time I heard an open source community described as a company — by someone unfamiliar with open source software. Technically, Ethereum isn’t a startup but an organization rooted in open source communities working to develop decentralized, logic-gated information and value exchange. There are similarities, and differences, between open source communities funded by digital tokens and traditional startup equity.

Transitioning from a Clinical Informatics fellow at UCSF to starting an R&D lab has provided me an opportunity to reflect on the valuable mentorship I’ve been lucky to receive along the way.

Analog Labs is an applied research laboratory aiming to:

  1. Educate societies about blockchain technology and emerging paradigms in Participatory Computing
  2. Apply this research directly toward social good
  3. Be financially and environmentally sustainable

The excitement surrounding cryptocurrencies drew attention to a field in tech that had been niche until relatively recently. Capital allows companies to grow and subsequently create value for society. However too rapid influx of wealth into cryptocurrencies can outrun the ability of these technologies to mature and evolve. Rapidly increasing prices of cryptocurrencies can bring wealth (and ruin) to speculators and can also discourage the spending of Ether to actually run applications. The excitement surrounding the industry, despite being a source of attention and potential investment funds, needs to keep pace with the development of these technologies for the sake of the long-term health of these technologies.

Since I started purchasing health insurance last month — $902.04 per month for medical insurance and $32.52 per month for dental insurance — I’m reminded of the dizzying cost of healthcare in the United States — the glaring economic and public health problem that sparked my interest in Ethereum several years ago. Analog Labs’ flagship project is a study of grassroots primary care models on the Ethereum blockchain. This living experiment is an opportunity to tap into a body of literature in Global Health and international communities’ experience with designing creative solutions to the challenge of funding healthcare’s perpetual journey to better.

Analog Labs is also seeking to help develop 2-4 projects that further the lab’s goals of applied research for sustainable social good by providing funding, technical expertise, and collaborative work, especially in the areas of:

  • health insurance
  • environmentally-friendly shipping materials
  • public transportation

 

I’m grateful to Betty Tran, Steven Truong, Peter Mikhail, Royd Carlson, The Haham-Grossman family, Linh Tran, Darlene Nguyen, Dr. Blake Gregory, Dr. Indhu Subramanian, Dr. Taft Bhuket, Dr. David Avrin, Dr. Sidhartha Sinha, Dr. Scott Enderby, the Highland family, the UCSF community, Bella Shah, Seth Blumberg, Dana Gersten, Tanner Irwin, Youssif Abdulhamid, Shahzad Ahsan, and friends at UCSF’s Aldea community for their support, mentorship, and contributions to this work.

 

Omar Metwally, MD

 

 

Re-programming the developing world: the tobacco problem

Omar Metwally, MD
University of California, San Francisco

If I were a government or private health insurance company trying to improve public health and reduce costs associated with treating cancers, chronic obstructive pulmonary disease, cardiovascular diseases, and many other preventable tobacco-related illnesses, how would I take on this challenge? Would offering nicotine addicts cash or subsidizing their insurance premiums curtail these unhealthy behaviors? While there’s some evidence that paying smokers works in the short-term, the effect is modest and has not been shown to be a successful long-term strategy.  The 2017 recipient of the Nobel Prize in Economic Sciences, Professor Richard Thaler’s work demonstrates how humans’ bias toward short-term rewards contributes to poor long-term decision making. Especially in the case of chemical dependence, immediate positive reinforcement (e.g. a puff of a cigarette) trumps the relative abstractness of long-term planning. Who doesn’t want to live a long, healthy life free of suffering, expensive healthcare bills, and the loss of independence associated with frequent trips to the hospital? But to an addict, a drag from a cigarette is more attractive than the prospect of being rewarded with something like health, time, or disposable income in 10, 20, or 50 years time.

Breaking chemical dependence, and modifying behavior (such as a sedentary lifestyle, unhealthy eating habits, and compliance with preventive healthcare) in general, depends to a large extent on modifying one’s environment. This includes things like eliminating triggers (ashtrays, packs of cigarettes and lighters lying around), and enablers. More effective than paying someone to ditch unhealthy habits may be helping someone with an addiction change their social context. I’m skeptical about the efficacy of an incentive program that would, for example, pay smokers cash in exchange for urine tests that verify an individual’s nicotine-free status. The desire for long-term abstinence from substances, weight loss, or regular exercise must be intrinsic and reinforced by the company one keeps. A chronic smoker is more likely to smoke among a group of friends who also smoke than in an environment where they’re constantly subject to inconvenience, protest, or punishment whenever they reach for a cigarette. The corollary is the hypothesis that helping a smoker and their group of smoking friends quit together may be more effective than limiting an intervention to individuals.

Continuing the thought experiment, how does a health minister or surgeon general help people modify unhealthy behavior while changing one’s entire psychosocial situation? Instead of an intervention like a urine test, which people may find embarrassing or perhaps not worth the inconvenience of extra pocket money paid at the conclusion of a research study, what might a reward system look like which compensates individuals based on a convenient, dignified, and inexpensive  “proof-of-motivation”? If I’m a smoker interested in quitting  and make my intentions clear to my family, friends, and co-workers, could their vouching for me serve as such proof-of-motivation? If I truly muster the willpower to not smoke for a week, month, or year, could the people closest to me supplant something as sensitive/specific as a blood or urine test?

A hacker-mind will be quick to point out that a nicotine addict, if determined to do so, will find a way to game simple trust-based systems, whether it means stepping into -20C weather, walking for a mile to a secluded smoking spot, or sneaking cigarettes while driving to and from work. Moreover, a smoker could easily convince others to lie about their behavior in exchange for sharing the reward with colluders. What is necessary is a more perfect mechanism for allowing individuals to vouch for one another’s behavior. Earlier in my career, I had a tendency as a technologist in general and blockchain researcher in particular to reach for technology XYZ and ask, what can I do with this technology? I see this bias throughout Silicon Valley; we love to build things, and technology is an easy starting point for our desire to effect change.

The organizational and technological merits of my specialty’s distributed, peer-to-peer paradigms are rather clear. The other half of the blockchain equation, proof-of-work, makes sense in the context of value stores, a feature common to the two predominant cryptocurrencies (Ethereum and Bitcoin) — in addition to Ethereum’s Turing completeness and logic layer. In the excitement of embracing new technologies, one should be wary of shoehorning technologies into domains where a logical fit doesn’t exist. Bitcoin as a digital asset makes sense. Ethereum as a value store — and much of its organizational functionality  — makes sense.

But with the goals of promoting healthy behaviors, helping developing countries kick a terribly addictive habit, and improving air quality as our starting point, how does one begin to effect change without burning up the planet’s resources in the process (one Bitcoin transaction wastes enough energy to power a household in a developing country for weeks)?

I would love the feedback of people thinking about this problem from different points of view. More than a billion human lives, which will be claimed by the tobacco industry in the 21st century, depend on it.

 

 

 

The Nile and the Ethereum Blockchain

Omar Metwally, MD
University of California, San Francisco

Distributed Data Sharing Hyperledger (DDASH).
=============================================
   Github repository
   -----------------
   Project website
   -----------------

Like blood rushing through a major artery, the Nile flows north from its origins in eastern Africa, nourishing hundreds of millions of people in Ethiopia, Sudan, and Egypt. Through millenia, the world’s longest river has turned otherwise uninhabitable deserts into fertile farmland, giving birth to civilizations that depend on its water for sustenance and trade. Herodutus, the ancient Greek historian, described Egypt as “the gift of the Nile,” and in the southern Egyptian cities of Aswan and Luxor, the Nile’s critical importance into modern times is ubiquitously apparent.

I step outside Aswan airport into a warm, brilliant January morning. A sweet breeze and southern Egyptians’ lightness greet us, a stark contrast from Cairo’s frenetic bustle . A charming Nubian man drives us to our hotel, and as we pass acres of hydroelectric generators and the Aswan High Dam, the Nile’s modern day importance to a country dependent on its every last drop comes into focus.

The Ethiopian government began constructing The Grand Ethiopian Renaissance Dam in 2011, making it Africa’s largest hydroelectric power plant. Although the $6.4 billion project is well underway, the ramifications of this project remain incompletely understood. The potential threat of depriving downstream countries (the Nile flows from south to north) of water and hydroelectric energy has raised concerns about its potential impact on human life.

While hydropolitics is a step removed from my field of Clinical Informatics, this complicated situation involving numerous parties with conflicting interests (sound familiar?) piqued my interest. The U.S. healthcare system, like this sensitive hydropolitial situation, is plagued by the major problem of many conflicting interests with little incentive to cooperate. Stifled health information exchange has bred a climate of competition rather than cooperation, ultimately to the detriment of individuals. I began my career as a blockchain researcher in 2014 when I realized this paradigm’s potential to create equity and promote cooperation. The conflict surrounding the Nile and the Renaissance Dam is a vivid demonstration of how the Ethereum blockchain can help nations solve a geopolitical conflict surrounding a scarce natural resource through cooperation rather than competition. My core thesis on blockchain, a technology that bridges computing, psychology, and economics, is that opportunities for cooperation will arise naturally as individuals benefit from increasing opportunities to participate in decision-making on all scales.   

To demonstrate these principles and test the above hypothesis, I spent several jet-lagged nights deploying a Nilometer contract on the Ethereum blockchain. This Ethereum contract lets parties bid for a minimum Nile water level and send a variable amount of Ether to support their bid. If the next month’s water level meets this minimum, these funds move from digital escrow to a pre-determined recipient (for example, a government, non-profit, or corporation). 

nilometer

Hydrological Time Series data were obtained from Technical University of Munich (Deutsches Geodätisches Forschungsinstitut an der Technischen Universität München).

 

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 connect 3+ Ethereum nodes in a private Ethereum network.

Omar Metwally, MD 
University of California, San Francisco 

Distributed Data Sharing Hyperledger (DDASH).
=============================================
    Github repository
    -----------------
    Project website
    -----------------

How to create a private Ethereum Network, Part Deux

By: Omar Metwally, MD

Background and Prerequisites:  This tutorial picks up where part one (“How to create a private Ethereum network”) left off.

 

Numerous people have asked me how to connect 3+ nodes in a private network after reading my previous tutorial. There are scripts out there that will pseudo-automate the process, but I believe in understanding the fundamentals and building it yourself from the ground-up without obfuscating layers between you and your network. Many people got hung up on obtaining a machine’s enode address (basically your Ethereum client’s public key) using the bootnode application. Depending on which machine you’re running and how you installed geth (the Go Ethereum client), chances are you don’t have bootnode installed. I realized that most people out there are not running Linux machines and therefore are getting stuck here.

The good news is that creating a network with any number of peers is possible without having to install bootnode.

A crucially important difference between private Ethereum networks and the main Ethereum network

is that, unlike the main Ethereum network (where real money is used to power the Ethereum supercomputer, create contracts, and move money around the network), private Ethereum networks do not automatically let anyone join the network. In a private network, each peer must identify all other peers to which it wants to connect. In networking parlance, a node becomes a peer when it connects to a fellow node.

Nodes are identified via enode addresses, which are basically public keys.

To illustrate how to create a private network with 3+ nodes, I’ll use the private blackswan network I created to run one of our projects, called DDASH (Distributed Data Sharing Hyperledger). You’re welcome to follow along and join the blackswan network or take notes and create your own private network.

Step 1: Create a genesis block 

All peers must use the exact same genesis block specified by genesis.json:

/Users/omarmetwally/Desktop/blackswan/genesis.json

For more information about the contents of this file, see my previous tutorial.

The exactly location of the genesis.json file will probably differ on your machine, depending on your operating system and how you installed geth.

Step 2: Clear old chain data

This will allow you to start from a blank slate and is necessary whenever you change the genesis block because you can’t merge two chains with different genesis blocks.

rm -r /Users/omarmetwally/Desktop/blackswan/data/geth

Step 3: Reinitialize the genesis block 

Again, this needs to be done on each node.

geth --datadir=/Users/omarmetwally/Desktop/blackswan/data init /Users/omarmetwally/Desktop/blackswan/genesis.json

Step 4: Discover each node’s enode address

To create a private network, each machine needs to know every other machine’s address.

geth --verbosity 1 --datadir=/Users/omarmetwally/blackswan/data console

Then type in:

> admin.nodeInfo

Copy the enode address, including quotation marks. It will look something like this (without the ellipsis):

 "enode://0f2a26.....730c"

Step 5: Create the static-nodes.json file on each node

This step is critical and a common point of failure for many people creating a private Ethereum network. This file identifies other network peers using their enode addresses. Create a file called static-nodes.json in the local geth data directory of each node, and paste the enode of every peer in your private network, such that it looks something like:

[

"enode://164c8...cf3eb815a7@12.167.347.338:30303",

"enode://c49d9...7343bac665@104.236.141.200:30303"

]

Note the quotation marks, the commas, and the format:  enode@ip_address:port.

Save this file as static-nodes.json in your local geth data directory, which in my case is:

/Users/omarmetwally/Desktop/blackswan/data/static-nodes.json

Step 6: Launch your private network.

Run this command on each node

geth --verbosity 2 --datadir=/Users/omarmetwally/Desktop/blackswan/data --networkid 4828 --port 30303 --rpc -rpcport 8545 --etherbase "0xYourEthereumAddress" console

The flags in the above command are important.

networkid

The blackswan network id is 4828, but your own private network will contain its own identifying network id which you should create to be unique.

verbosity

How much information geth will spew, which can help with troubleshooting or be too much unnecessary information cluttering your screen.

datadir

This must correspond to your own local geth data directory. You will not get a helpful error message if this does not correspond to a real directory on your machine, so be careful here.

etherbase

This is your Ethereum address on the private network.

rpcport and port 

The port and rpcport flags are networking parameters which I will not get into here. Make sure that your firewall will not block the ports you’re trying to use, and be careful when opening your machine to the outside world. Be very careful when exposing the RPC API to the outside world to prevent theft of real Ether and loss of real money! Any real Ether you might own should be kept completely separate from your development environment.

Step 7: Mining on your private network

Mine Ether by running:

geth --verbosity 4 --datadir /Users/omarmetwally/Desktop/blackswan/data --networkid 4828 --port 30303 --etherbase "0xYourEthereumAddress" --mine --minerthreads=1 

Then open a new Terminal window (if you’re using a Mac) or new Terminal tab (Ctrl-tab) and check your balance:

geth attach /Users/omarmetwally/Desktop/blackswan/data/geth.ipc console

> web3.eth.getBalance(web3.eth.accounts[0])

You should see your account balance increase fairly quickly as you mine.

Acknowledgements

Royd Carlson’s (UC Berkeley) feedback was instrumental in conceiving this article. The comments and emails I receive from readers of this blog help make these articles relevant to the Ethereum community .

Knowledge is power, and my goal is to empower the readers of this blog with the information necessary to create blockchain applications with the potential to re-program institutions, level playing fields, and take a huge step toward more democratic societies. I’m humbled to welcome visitors to this blog, especially from nations where access to and dissemination of  knowledge is much more difficult than we sometimes take for granted in the Western world.

“…the poor catch up with the rich to the extent that they achieve the same level of technological know-how, skill, and education, not by becoming the property of the wealthy.”  (Thomas Piketty, Capital in the Twenty-First Century)