September 1, 2020

When we think about commitments, we think about couples making commitment to their relationship, group of talented and enthusiastic people committed 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, activity or entity; a process of focusing on something with neccessary resources at the expense of oppurtunity cost. It is what 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 GCP Kubernetes Cluster

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 common place, when people always have to choose between privacy and 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 be a counteracting force to make the world a more balanced place.

Read More

Anatomy of Bitcoin's Raw Transactions

December 19, 2019

Recently I added a feature in 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, a Bitcoin Education Site

November 23, 2018

Recently I launched, 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?

Little Fun with Emacs Start Buffer

Provision Docker using Ansible

September 10, 2014

I love Ansible and Docker, they are great two pieces of software that work pretty nicely together. While there is ansible module to manage docker containers, docker images themselves can be built using ansbile as well. We just need a base images that’s ansible enabled to start with:

Read More

Footprint on the Moon