Uncensored Content on Ethereum: How Chinese Activists Inspired Civil
On April 23rd, 2018, a curious transaction appeared on the Ethereum blockchain. An anonymous activist sent 0 ETH to themselves, but the transaction contained many extra bytes beyond the ones used to complete the transaction. These extra bytes were the text of a letter written by Yue Xin, a student at Peking University, detailing a pattern of intimidation and threats made against her by the school in response to her attempts to investigate claims of sexual assault made against a professor (you can read the full letter by clicking “view input as” and selecting utf-8 on the etherscan page). She had initially posted the letter on the social media site WeChat, where it was widely shared before censors began to purge all copies from the platform. Chinese censors have consistently targeted the #MeToo movement, forcing whistleblowers to find creative means of sharing their stories like esoteric hashtags such as #RiceBunny, or 米兔, which is pronounced similarly to “me too.”
By using Ethereum, activists have found a new and unique avenue to disseminate information and resist censorship for Xin’s letter. Because every computer running a full Ethereum node has the complete transaction history, Yue Xin’s letter is replicated across thousands of independent computers. These computers are all controlled by individuals and organizations without any centralized oversight or shared government, making it virtually impossible to remove the letter’s content from the network. The same technique was used again in late July to protect a censored story about corruption and negligence at a Chinese vaccine manufacturer.
Empowering journalists in places hostile to press freedom is part of our mission at Civil. We’ve been following stories like these closely, and such inspiring acts of resistance and resiliency have influenced the tools we are building to help journalists all over the world. In this article, I’ll show how combining the methods used by the Chinese activists with Civil’s newsroom contract can create a subscribable stream of content for a newsroom that is invulnerable to the efforts of governments or billionaires who may wish to censor it.
Under the hood
Ethereum is a cryptocurrency like Bitcoin, except it has a shared virtual machine. When executable code, called a smart contract, is deployed to this network, users can interact with it via transactions. Transactions can be used either to update data stored in a smart contract or send value between users.
When Yue Xin’s letter was added to Ethereum it was done in the form of a transaction. Each transaction contains a few distinct components that are called:
Nonce: A number that keeps track of the amount of transactions an account has made. The nonce is used to protect users from replay attacks where an attacker attempts to steal from a user by using a single authentic transaction over and over.
GasPrice: The amount a user is willing to pay the miners per unit of computation (for more on gas read this explainer).
GasLimit: The maximum amount of computation you expect the transaction to require.
To: The address of the receiving wallet of contract.
Value: The amount of ETH you are sending. The value is often 0 when interacting with smart contracts.
Data: When interacting with smart contracts, this field is used to send instructions about how the contract should be updated. When sending money to another user’s wallet, this field is completely ignored.
Because the “data” field is ignored in simple ETH transfers, you can safely put any arbitrary data in that field without it affecting the transaction. When a Chinese activist wants to store a message on the Ethereum network, they send any amount to any address with the message they’re trying to protect in the data field. Using the web3.js library, that looks like this:
To recover this message from the blockchain, you need to know the unique identifier for that transaction, known as the “transaction hash.”
The message is now stored permanently on the Ethereum network. To share it, you need to spread its transaction hash by traditional means. This could be hindered by censorship efforts and makes it very difficult to share a body of work instead of a single article. How can this process be adapted so that an institution wary of censorship can share its content directly with readers? At Civil, we are doing this by combining the same technique with our newsroom smart contract.
The Civil newsroom smart contract has two parts: a simple index of content and revisions from a newsroom, and a list of approved editors who can publish to that newsroom. Every time an editor adds a new article or revision, the contract emits an event. Each piece of content indexed is stored as a struct that contains a hash of the content and a URI for retrieving the content. The URI can point to any storage solution. It can be IPFS, swarm, an S3 bucket, your web server, or, as in the following case, the transaction used to create the entry. To put it into the same transaction, we need to include both the data needed for the contract and the article we’re trying to store in the data field. We also need to be able to recover that message later.
Luckily, adding extra data to a transaction is pretty straightforward. All transactions follow a consistent form, so the computer that executes the smart contract code can extract the relevant information. Storing a message is as simple as attaching it onto the end of the hex encoded transaction data, since all extra data attached after the bytes expected by the contract goes ignored. The tricky part is recovering the message later: to retrieve it, we need to know where it starts. We can do this by adding the size of the original transaction to end of our combined hex code. Here’s how adding the article content and retrieving it from the newsroom contract looks:
Adding transaction data in this way increases the amount of gas used by the transaction by an insignificant amount. If we gzip the content before we attach it, we can store this article as HTML with a fair amount of metadata for 540991 gas. This means that at a gas price of one gwei, (1/1000000000 of an ETH) it costs only 17 cents to publish this article to the newsroom contract. (At time of writing, the standard gas price was around 6 gwei, raising that cost to about $1.02.)
The bright future
On top of this publishing method, we can build a Dapp (decentralized application) that subscribes to updates from the newsroom contract and displays all the newsroom’s articles. As long as the reader using the Dapp can connect to any node in the Ethereum network, they’d be able to access all of the newsroom’s content. The content published to a newsroom contract would be completely uncensorable.
To reach a greater audience, the newsroom could apply to have their contract listed on the Civil Registry. If approved, this anonymous and uncensorable newsroom would also be held accountable to the ethical standards of the Civil Constitution. Additional contracts added to this system could add ways for people to support the newsroom or create curated networks of similar newsrooms.
For Yue Xin and the 7 other students trying to investigate claims of sexual assault at Peking University, this could radically change the way they reach their audience. Instead of secret hashtags and bundles of hex strings passed from person to person, software distributed as a webpage, on IPFS, or installed and run locally could connect to Ethereum and display real-time updates from their newsroom. The Civil Registry and other contracts could connect them to new readers. And they could be confident that their stories could not be taken down simply because a state-run platform or powerful actor wanted them removed.
Much remains to be seen about how blockchains will affect journalism, but Civil is committed to preserving newsroom archives and protecting shared historical records from those who would seek to censor them. Our code is open source and we encourage others to build on this protocol, amplifying its value for all. Visit our github repo to learn more.