Category Archives: Golang

Monetas brings colored coins to btcd

This article is syndicated from the Monetas blog with the approval of the author, Justus Ranvier.

As a company with current and planned blockchain-synergistic products, Monetas is strongly invested in Bitcoin wallet development. After choosing btcwallet from Conformal Systems as our technical foundation for blockchain integration, Monetas is currently devoting four full-time software engineers to adding features and improvements to btcwallet.

One of those features is colored coin support. This article will explain colored coins, and how we are implementing them in btcwallet, and what capabilities these changes entail for both Monetas and Conformal.

colored-1

Continue reading

Introducing btcrpcclient — Bitcoin RPC Made Easy

Bitcoin JSON-RPC

Bitcoin JSON-RPC

Have you been looking for a robust and easy to use way to interface with Bitcoin through the JSON-RPC API? We’ve got you covered!

We’re excited to announce btcrpcclient, a new Websocket-enabled Bitcoin JSON-RPC client package written in Go. This package allows you to quickly create robust Bitcoin RPC clients in just a few minutes.

Major Features of the btcrpcclient Package

  • Supports Websockets (btcd and btcwallet) and HTTP POST mode (Bitcoin Core)
  • Provides callback and registration functions for btcd and btcwallet notifications
  • Supports btcd and btcwallet extensions
  • Translates to and from high-level statically-typed Go types
  • Offers a synchronous (blocking) and asynchronous (non-blocking) API
  • When running in Websockets mode (the default):
    • Provides automatic reconnect handling (can be disabled if desired)
    • Outstanding commands are automatically reissued on reconnect
    • Registered notifications are automatically re-registered on reconnect
    • Back-off support on reconnect attempts

Continue reading

Btcd + getwork + cgminer = profit

Bitcoins

Bitcoins

We are pleased to announce that btcd, our full-node bitcoind (bitcoin core) alternative written in Go, now has support for the getwork RPC which allows it to function with cgminer!

We have extensively tested the code on testnet. The following is a sampling of the latest blocks we’ve generated on testnet using btcd + cgminer: 226713 226830 227228 227390 227393.

If you are simply interested in learning how to configure btcd to work with cgminer, you can view the setup instructions on the btcd wiki, however if you’re interested to learn about some of the nuts and bolts that make it all work, read on.

Isn’t getwork deprecated?

Before I dig into some of the details, I would like to touch on a topic that I’m sure some astute readers will undoubtedly be asking, which is “Why implement getwork when it has been deprecated in favor of getblocktemplate (BIP0022 and BIP0023)?”

There are a few reasons why we chose to implement it first:

  • Supporting getwork was a lot less time consuming than getblocktemplate proposals and software such as cgminer still functions properly with getwork. This means we were able to release support for mining more quickly by supporting getwork first.
  • The bulk of the work involved was the code to create and manipulate block templates which is used by both getwork and getblocktemplate. Thus it helps pave the way to supporting getblocktemplate proposals while allowing getwork to function in the mean time.
  • The current reference implementation (bitcoin core) still supports getwork. Even though it will likely be removed in the next version, one of the goals of btcd is to be a drop-in alternative that can be used with existing infrastructures.

Continue reading

2014 Summer Internships: hacking on Bitcoin with Go

We are pleased to announce our 2014 summer internship program at Conformal Systems. A short summary of the program is as follows:
hacking Bitcoin with Go

  • 2 full-time intern positions are available for the summer of 2014.
  • Interns will be expected to work on remote.
  • Interns can be from any country or timezone, but timezone may be a factor in intern selection due to synchronization issues.
  • Interns will be expected to speak and write in English at a conversant but not fluent level.
  • Interns will work on open source Bitcoin-related projects the entire summer.
  • Interns will be expected to develop exclusively in the Go programming language.
  • Interns are expected to have the “Minimum Recommended Skillset” from the code contribution guidelines for the btcd suite.
  • Interns can either (A) work on projects assigned by Conformal Systems staff or (B) “bring your own project” (BYOP) which we approve as part of the internship.
  • The internships are open to anyone currently attending undergraduate or graduate school, or anyone of similar age. Broadly speaking, we consider anyone age 15 and up to be eligible.
  • Pay will be roughly a “graduate student” level, approximately USD 2,000 (pre-tax) per month.

Continue reading

Deslugging in Go with pprof: btcd

As btcd nears completion we decided to have at least one round of deslugging because we were much slower then bitcoind during chain download. Let me clarify that term for the ones that don’t know what that means. Deslugging is the art of measuring (or profiling) run times of individual functions, determining which ones are slugs and which ones could be optimized. Armed with that data one attacks said functions to see if there are some less then optimal algorithms. Surprisingly enough, this is often the case. An industry truism is “measuring is knowing” and attacking functions based on gut feeling often does not yield satisfying results. As always with these exercises, some things work and some don’t. Throughout this blog I’d like to walk our readers through some optimizations that succeeded, and one, objectively, failed attempt.

Continue reading

btcwallet and btcgui: Wallet handling for btcd

Today Conformal is announcing alpha releases of btcwallet and btcgui, the wallet components of btcd, written in Go. We announced in a recent blog post that btcd, our full node Bitcoin implementation, was ready for public testing. We also announced that wallet functionality was being implemented separately and would be coming in the near future. Although our wallet daemon and GUI interface are not yet ready for production use, we feel they have progressed to the point where early adopters can begin testing their functionality on the Bitcoin Testnet network.

Our btcd blog post briefly discussed why wallet functionality is not a part of btcd. It highlighted various reasons why we believe separating wallet handling from blockchain handling improves on the integrated wallet design used by bitcoind and bitcoin-qt. This post will continue on that topic, further exploring the details of why a multiprocess wallet design was chosen, how such a design is beneficial to the Bitcoin community as a whole, and the implementation details this design.
Continue reading

btcd: Not your mom’s Bitcoin daemon

We are pleased to announce that btcd, our full-node bitcoind alternative written in Go, is finally ready for public testing!

The installation instructions and source code can be found on github at:

https://github.com/conformal/btcd

A Brief History

Back in May, we first announced our plans to release btcd. A week later we released our first core package from btcd, btcwire, and announced our plans to continue releasing the component packages of btcd in a staggered fashion.

Over the next month, we released btcjson, btcdb, and btcscript. Then in mid-July we released btcchain at which time we announced btcd was next. At that point, btcd had most of the core bits and we figured we’d be releasing it within a few weeks. Well, as you have no doubt noticed, it is now 10 weeks later…
Continue reading

gotk3: GTK3 the Go way!

Today marks the first release of gotk3, Conformal’s own GTK3 bindings for Go (available on Github here). These bindings were developed out of a frustration with other GTK bindings for Go either using ancient versions of GTK, not handling memory in a way a Go developer would expect, or simply not working at all on our developers’ OpenBSD and Bitrig machines. gotk3 is Conformal’s response to these issues and attempts to be the best solution for developing new GTK applications with Go.

One of the goals for developing gotk3 was to perform memory management in a very Go-like manner. Like many libraries which must handle memory management manually due to the language they are implemented with, GLib (and GTK which uses it) uses reference counting to determine when an object will never again be used and is ready to be freed, releasing the memory resources it required back to the operating system. However, GLib chooses not to use traditional reference counting, but instead uses a quirky variant called “floating references” to achieve this goal. The rest of this post will cover what floating references do, why they exist, and how gotk3 works around this design to handle memory the way a Go developer expects.

Continue reading

btcscript – the script package from btcd

Following up on our previous releases (btcwire, btcjson, btcutil, and btcdb) we are happy to announce btcscript, the script package from btcd:

https://github.com/conformal/btcscript

btcscript provides code and data structures to parse and execute bitcoin scripts. The scripting system bitcoin uses is a stack-based, FORTH-like language. It is not turing complete by design (as adding a full turing complete language opens up all sorts of potential complications and problems), but it still provides a fair amount of power.

Continue reading