Go concurrency is not parallelism: Real world lessons with Monte Carlo simulations

I was recently playing around with a problem presented to me -- using Monte Carlo simulations to calculate the value of π (pi). For anyone not familiar with the Monte Carlo method, it is essentially a probabilistic way to come up with the answer to a mathematical question by running a large number of simulations when you cannot get or want to double-check a closed-formed solution. Think about flipping an invisible coin 100 times in a blackbox and just getting the experimental results out. When you get approximately 50:50 heads/tails, you realize through these simulated flips that there »

Beautifully Simple Benchmarking with Go

I recently read David Huie's great post about Go being possibly the next great teaching language, and I wasn't so sure at first. I absolutely love Go and use it as my first choice imperative language for both hacking something together quickly and for building robust web applications, but I wondered if an absolute beginner would still be better off with a dynamically typed language like Python. And then every so often, I run into a problem to solve with Go and it just feels so easy and intuitive while being robust, that I can't help but think that David »

Bitcoin multisig the hard way: Understanding raw P2SH multisig transactions

Recently, inspired by Ken Shirriff's and Bryce Neal's low level looks at the Bitcoin protocol, I set about constructing Bitcoin's much talked about multisignature transactions from scratch to understand their capabilities and limitations. Specifically, I used Bitcoin's Pay-to-ScriptHash (P2SH) transaction type to create a M-of-N multisignature transaction. The code to do it all in Go is available as go-bitcoin-multsig on GitHub and I'd like to go through how all of this works at the Bitcoin protocol level. We'll also step through creating and spending a multisig transaction to make it all clearer. In many ways, this is a follow up »

Solving 'virtualenv' install error when building OpenBazaar on OS X

OpenBazaar is an open-source effort to create a distributed, decentralized marketplace that will let people buy and sell things online without any single point of failure or centralized control. It's a fantastic idea and is currently in beta. I wanted to write briefly about an build error I ran into on OS X Mavericks while building OpenBazaar and provide a solution, in case other people are running into the same issue. The build instructions to build and run OpenBazaar are available at their GitHub repo wiki. After I ran ./configure.sh, I received an error about mid-way through: Installing collected »

Helpful Bash Scripts For Working with Byte Arrays and Hex Representations (in Bitcoin)

I've been working heavily with raw level Bitcoin transactions lately, mainly so I can understand what's going at the protocol level where a lot of the fun innovation is happening. In particular, I'm building a Pay To Script Hash (P2SH) M-of-N Multisig transaction implementation in Go, as a stepping stone to building a micropayments channel implementation in Go, and it's been a lot of fun. When working on Bitcoin at the raw transactional level, you spend a lot of time working with byte arrays either in the binary, decimal or hex representations. Take a quick glance at Bitcoin's scripting language, »