Web3 and Advertising

February 5, 2023

Marc Andreessen famously attributes the proliferation of internet advertising today to browser’s lack of built-in payment support from the beginning. He calls it the original sin of the internet. The downstream from advertising, he argues, is everything people are anxious and worked up about today: privacy, user data collection, misalignment of the incentives, etc. The assumption is that if crypto were around in the early internet, it would be much easier to incorporate financial transactions into the browser and the landscape of the internet economy could look vastly different compared to what we’ve seen today.

Read More

Deep Dive into Ethereum Logs

January 22, 2022

Logs in Ethereum are very useful since they are the underlying mechanism for events, which is the recommended way for smart contracts to communicate with the outside world. They also provide a significantly cheaper way to store data on-chain.


Read More

Alephium Stack on GKE

January 9, 2022

Alephium is the first operational sharded blockchain that brings scalability, ETH-inspired smart contracts and dApps capabilities to Bitcoin’s proven core technologies while ensuring better performance and improved energy efficiency. Alephium is one of those rare gems in the crypto space that has solid innovations, high code quality and great mindset for decentralization.

Read More

Some Challenges of Freedom of Speech

August 24, 2021

If there exists a superintelligence system that posesses all the knowledge and truth of the world and is able to always process it with the most “optimal” algorithm, no matter what circumstances are, perhaps planned economy would become a better mechanism for resource allocation and growth generation than market economy. In fact, if such a superintelligence system happens to have the capacity and intention to advance human society as a whole, maybe the most sensible thing for us to do is to follow its lead.

Read More

Constraints and Liberties

July 3, 2021

In The Shawshank Redemption, Brooks Hatlen was released from the prison after being locked up for 50 years. He finally regained his liberty and yet his inability to adjust to the outside world gives him constant fear and desperation. He commited suicide. The freedom from the constraints of the prison killed him. Similiarly, after Booker T. Washington was emancipated as a slave, his initial rejoicing was soon overwhelmed by the sense of deep gloom due to the realization that without money, education, skills and property, life is not significantly different after liberation.

Read More

Emacs is the 2D Command-line Interface

December 25, 2020

One of the most popular arguments against Emacs is that it is “a great operating system, lacking only a decent editor”. The promotion of the idea of “Living in Emacs” by some of the hardcore Emacs users only make this argument more compelling. At the first glance, using a single program for “everything” does seem to contradict the Unix philosophy, which favors single-purposed programs that compose really well instead of monolithic systems that try to solve many complex problems at the same time. In this article, I’d like to argue that Emacs largely follows the Unix philosophy in its problem domain: working with text, and can be seen as a two dimentional version of the command-line interface (CLI).

Read More


September 1, 2020

When we think about commitments, we think about couples making commitment to their relationship, a group of talented and enthusiastic people determined to bringing power to the morden consumers, or a country pledged to land a man to the moon and return him safely on earth. It is an obligation of being dedicated to a cause, an activity or an entity, a process of focusing on something with all neccessary resources at the expense of opportunity cost. It is the force that transforms a promise into reality.

Read More

zk-SNARKs Explained with Bellman

August 27, 2020

Zero knowledge proofs (ZKP) is one of the the most exciting cryptographic inventions since Public-key cryptography. zk-SNARK is a specific type of ZKP which allows one party (the prover) to convince other parties (the verifiers) that the prover faithfully executed a program with some secret information, without conveying any knowledge about the secret information itself. zk-SNARK also generates succinct (hundreds of bytes) proofs that can be verified within the range of miliseconds even though the original computation might be much larger, which means that other than the obvious privacy benefits, zk-SNARK can also be used to trustlessly outsource expensive computation.

Read More

Bitcoin Full Node on GKE

Learn You Some Crypto for Good

March 22, 2020

TL;DR. We live at a time when states and companies tend to get more and more powerful at the expense of individual rights, when government and corporate surveillance becomes the status quo, when people always have to sacrifice privacy for convenience, when Keynesian school of economics seems to be kicking the can down the road all the time. Cryptocurrency and its related technologies can potentially offer alternatives that make the world a more balanced place.

Read More

Anatomy of Bitcoin's Raw Transactions

December 19, 2019

Recently I added a feature in nioctib.tech to display bitcoin transactions in their hexadecimal format, with internal structure illustrated by different colors and tooltips describing what those numbers actually represent. The hope is that this could offer a direct visual impression about how serialized transactions look like and can potentially be used as a debugging tool as well.

Read More

The Derail of Desires

October 5, 2019

If we were to build a specie that would survive and prosper within a dynamic enironment of arbitrary complexity, one of the design choices we have to make is whether we should build a finite number of powerful enough individuals who can last “forever” or start with a dynamic set of significantly weaker individuals who can constantly adapt to the environment through the mechanisms of micro-adjustment and iterations.

Read More

A Scala 'debug' Macro

June 2, 2019

If you are one of those guys who do not use a debugger and felt that the more efficient way to navigate a complex codebase is still through “careful thought, coupled with judiciously placed print statements”, then here is a nifty macro that I wrote to make it hopefully slightly easier in Scala.

Read More

Scriptless Script

April 6, 2019

TL;DR, Scriptless Script was initially invented to solve the problem of encoding smart contracts in Mimblewimble where signatures are the only way to express ownership. A key observation is that the aggregation and substraction of the schnorr signatures can be used to capture the semantics of a class of offchain protocols, leaving blockchain as an engine for verification as opposed to computation. This not only enables the smart contract capabilities for systems like Mimblewimble, but can also be used to improve the efficiency, fungibility and privacy of other blockchains such as Bitcoin.

Read More

Payment Channels in Lightning Network

February 16, 2019

One of the fundamental aspects of the lighting network protocol is how payment channels are established and utilized to transfer funds. Just like TCP connection, payment channel is virtual in the sense that it is achieved by carefully designed smart contracts which gives user the illusion that there exists a channel. In this post, the smart contracts expressed in Bitcoin script in different types of transactions within the lightning payment channel are discussed in details, with graphs illustrating their potential behaviors under different scenarios.

Read More

An Incomplete Survey of Bitcoin's Privacy Technologies

February 4, 2019

TL;DR, Bitcoin has never been anonymous since its inception. Making it more private becomes one of the most vibrant research areas in the space. While some proposals have made (or are making) their way into the Bitcoin’s reference implementation, others were either implemented in altcoins or get abandoned altogether. In this post, the following privacy enhancing technologies are categorized and surveyed based on the information they are trying to hide.

Read More

Worth Moving to Sweden as Engineers?

December 17, 2018

TL;DR, Even though wages have risen a lot for engineers in fast growing economies like China or India. From my perspective as a Chinese who’s been working here for many years, Sweden might still be a very attractive place to work and settle depending on who you are, primarily for the following reasons:

Read More

Nioctib.tech, a Bitcoin Education Site

November 23, 2018

Recently I launched nioctib.tech, a Bitcoin education site which currently supports searching and displaying Bitcoin transactions as well as interpreting the locking and unlocking script associated with those transactions.

Read More

Blockchain with Scala

November 21, 2018

Yesterday I gave a talk in the Gothenburg Scala meetup titled Blockchain with Scala. A few things were covered in the presentation and I really enjoyed the discussion.

Read More

Thoughts on Ralph Merkle's "DAO Democracy"

November 1, 2018

The legendary scientist Ralph Merkle talked about his paper DAO democracy in a Epicenter podcast around 2 years ago, and the episode was re-posted this summer when all the Epicenter hosts were travelling at the same time. As the result, I listened to this episode three times and really enjoyed it.

Read More


April 8, 2018

区块链爱好者总爱提起:比特币在人类历史上第一次解决了去中心化的信任问题。 这个提法既对,又不对。

Read More

The Tale of the flatMap


December 9, 2017


Read More

Two Thoughts on Fintech and Blockchain

November 23, 2017

1) As much as people’s initial hope of how decentralized internet should be when it was first invented, we see very centralized services over the years for various reasons (convenience, efficiency, human nature, need for trust) at the same time when it flattens the world as humanity has never seen before.

Read More

A Bitcoin Library

October 7, 2017

One of the nice things about living in Sweden is the “pappaledighet” (parental leave). In the last two months I took that and had a lot of fun spending time with my lovely son Filip. But when he is asleep, I worked on a small Bitcoin library to help myself understand the intricacies of this amazing technology. After diving deeper into the blockchain space since March this year, I am gradually convinced of its potential to advance our societies because of one thing it enabled which was never possible before: dicentralised trust.

Read More

Scala, the Startup Way

February 28, 2017

My colleague Marcus Lönnberg and myself gave a talk at the Scala Meetup today titled Scala, the startup way. We structured the talk with the idea from the exellent presentation On the spectrum of abstractions given by Cheng Lou a few months ago, to reason about making technical decisions such as asynchrous programming models, dependency injection, data types, CRUD vs Event sourcing, kubectl vs our in house testing environment tools, etc. It was an inspiring night with a lot of insightful discussions with all the Scalaentusiaster.

Read More

Some Thoughts after the Trump Victory

November 14, 2016

As many people out there, I have strong and bitter feelings towards Brexit and the Trump victory. I thought it represents a major setback from the globalisation which have brought so much cultual and economical prosperity into this world. It points to a gloomy future where people are futhur devided by their race, nationality, religious belief, sexuality, economic status… and there doesn’t seem to be any immediate solution for it.

Read More

A Game of Ping Pong with Akka

October 4, 2016

Being an Erlang developer for few years, Akka gives me very homey feelings. It takes direct inspiration from the Erlang/OTP and Riak Core, and grows into a great library for building concurrent, distrbuted and fault tolerant applications. On top of its core, modules such as Akka streams is developed to serve as a better abstraction for a class of problems over raw actors; Akka HTTP is written to help build Rest APIs, Akka Persistence is added to facilitate writing CQRS systems, among other things.

Read More

Scala Intro Talk

April 1, 2016

Yesterday I gave a talk at the Scala Meetup in Gothenburg. It was a lot of fun to discuss functional programming and object oriented programming with all the Scala geats and how Scala manage to support both programming paradigms but still manage to keep everything in a consistent way.

Read More


Method Injection in Scala

May 17, 2015

I remember the horror when I first came across implicit in scala, it sounded like a recipe for incomprehensible code. After a while I started to realize that there are a number of use cases where it could be very useful. An important example is method injection as it is discussed in the learning scalaz tutorial.

Read More

Chinese Version of Klarna?

November 11, 2014

About 3.5 years ago when I just started at Klarna, I was wondering if its business model could be replicated in China. The following is a little note that I had at the time about my naive perception of Chinese E-commerce in general and online payment in particular, and the reason why it might be hard.

Read More

Why Teespring Matters

November 10, 2014

E-commerce is taking over the world. There is no better evidence than the astonishing number put out by the e-commerce juggernaut Tmall today: In just about 38 minutes after it kicked start the double 11 shopping carnival, the Chinese equivalent of Black Friday, it has already handled its first 10 billion RMB (1.63 billion USD) worth of transactions, setting a new world record with huge margin.

Read More

Prepending Story id in Git Commit Messages

October 8, 2014

It is a good idea to prefix the git commit message with story id for better traceability. For the same reason, it is also nice to prefix the branch name with story id as well, even though git branch is more short lived than commit messages.

Read More

Virtualized Development Environment

September 26, 2014

Yesterday, a burglar sneaked into our office and stole one of my colleague’s Macbook while all of us were having a meeting in a conference room.

Read More

Typed Actors are Discouraged in Akka?

Footprint on the Moon