Bitcoin & Blockchain Programming #005 – RPCs via PHP

by Albert Szmigielski It’s time to talk to bitcoind programmatically via RPC. Actually in our last tutorial, the bitcoin-cli calls were made over RPC as well (bitcoin-cli handles all the details). In today’s tutorial we will make RPCs using php. We are assuming you have php installed on your machine, if not you can do that by issuing the following command in a terminal:

If you are not sure if php is installed on your system you can check by doing:

The RPCs to bitcoind are accomplished via json format, so we will need a library for that: jsonRPCClient.php We have downloaded it from We need to create an object to connect to bitcoind, we will call

Read more

Bitcoin & Blockchain Programming #004 – Basic Commands

By Albert Szmigielski Last time we saw how to issue a command to bitcoind via the terminal using  bitcoin-cli. Today we will start examining the different commands that bitcoind can accept. Perhaps the most important one to start with will be the help command.

this will print out a list of all the commands that the bitcoind wallet accepts. If you want to save them in a file simply redirect the output to a file.

If you ever need help with a specific command you can get the man page by

for example

So there is our first command getblockcount it returns the number of blocks in our blockchain. Lets execute it.

Currently (jan 30

Read more

Bitcoin & Blockchain Programming #003 – Building bitcoind on Linux

By Albert Szmigielski In this tutorial we will show you how to download and build the bitcoin core reference client on your Linux machine. Let’s get to it. Required Libraries Open a terminal and issue the following commands.

This will download and install build requirements. We will also need boost library development packages

Let’s add the bitcoin repository

Next, we need Berkley DB development libraries

Later on we may want to build the Qt wallet – the GUI version. We will need QT packages for that.

  GIT and Sourcecode

Make a directory for Bitcoin and your code

When you first start bitcoind it is going to create a .bitcoin directory in your

Read more

Bitcoin & Blockchain Programming #001 – Introduction

By Albert Szmigielski It has come to our attention that there is a shortage of Bitcoin and Blockchain programmers. As a result we have decided to post a series of tutorials starting at the very beginning. We will download and set-up a full Bitcoin wallet and then we will proceed to go through all the commands and how to use them. We will show you how to connect to your wallet programmatically via RPC calls (Remote Procedure Calls) , and finally we will put together a couple of projects using the material we have covered. We will work in Linux, for Windows users we will show you how to install a Virtual Machine (VM) so you can run Linux on

Read more

Bitcoin Basics #003 – Bitcoin Wallets

By Albert Szmigielski Today we will explain Bitcoin Wallets A Bitcoin Wallet is a piece of software that allows you to do the following: Keep track of the bitcoins you own Send and receive bitcoins Connect to and query the Bitcoin network for a variety of information Technically the term wallet is a little bit misleading, the Bitcoin wallet does not hold your bitcoins. All the bitcoins ever created are stored on the blockchain. The wallet stores your private keys, which in turn allow you access to the bitcoins you own on the blockchain. There are a few types of wallets: Full wallet Light wallet (sometimes called a light  or thin client) Mobile wallets Web wallets Paper wallets Hardware wallets

Read more

Milestone: The Bitcoin Network Reaches One Exahash

By Albert Szmigielski Sometime around January 24th 2016 the Bitcoin Network reached one Exahash per second for the first time ever. That is 1 quintillion, a 1 followed by 18 zeros or 1018 hashes per second. That is just an insane amount of computing power. Image: Bitcoin Network reaches ONE exahash. Image courtesy of Over the last two years the Bitcoin Network hashrate increased roughly 50-fold. Image: Bitcoin Hashrate over the past two years. Image courtesy of Why is this a big deal? Bitcoin currently has the most secure network in the world. To duplicate the network it would take a lot of resources. At a low price of $150 per Terahash, it would cost approximately $150 million

Read more

Lending Models and Microfinance Institutions

by Paul Jones Introduction This paper will compare and contrast the group lending and individual lending models used by Microfinance Institutions, which first emerged in the later decades of the 20th century, and discuss the situations where one model may be preferable to the other. The academic literature on this topic is growing, and there are many subtleties to consider when comparing the pros and cons of group versus individual lending. An in-depth analysis of this complex topic is well beyond the scope of this essay. Rather, a high level synopsis will be presented that attempts to compress the salient points. The concept of crowdfunding is also discussed, and how it relates to the group and individual lending models frequently

Read more

Bitcoin blocksize increase discussion – summary and analysis of proposals.

by Albert Szmigielski Introduction Currently Bitcoin blocks are limited to 1 MB. This limit implies a certain number of transactions per time frame. Bitcoin blocks are found on average every 10 minutes, therefore on average we can expect 7 transactions per second. In order to compete with established companies, Bitcoin must scale up and therefore increase the blocksize to allow more transactions per time frame. Increasing the blocksize would require a hard fork. Anytime major changes are required to the Bitcoin protocol different interest groups raise their concerns and lobby for their interest. Proposals There were four proposals for increasing the blocksize put forward. They can be found in BIPs 100 through 103, and BIPs 105, 106, the unofficial 248,

Read more

Bitcoin as Time-based source of randomness

by Albert Szmigielski Bitcoin mining involves finding a suitable nonce so that the resulting hash meets a certain criteria. The hash is not predictable and can only be found by exhaustive search. Therefore the hash cannot be trivially guessed in advance. This allows the creation of a random seed that is time depended. Clearly the hash of some block in the future cannot be guessed without expending considerable effort and computing resources, and as a result the hash together with the Merkle tree root of a future block can be used as a random seed. According to researchers Bitcoin produces 68 bits of min-entropy every 10 minutes, of which 32 near-uniform bits can be extracted [1]. The biggest benefit of

Read more

Ripple vs. Bitcoin (security and privacy)

by Albert Szmigielski Fairness Bitcoin’s public ledger, the blockchain, allows any entity to check the transactions in the system. Furthermore, as long as 66.7% of the miners are honest no entity can change the history of transactions. Both of those properties ensure fairness. However in light of recent research into attacks on the Bitcoin network, several double-spending attacks have been identified. Such attacks negate the fairness property. Ripple has not been studied as extensively as Bitcoin. Ripple relies on ledgers that can be inspected. However, Ripple’s validating nodes are currently run and therefore controlled by Ripple labs, it seems that there are not sufficient incentives to run a Ripple validating node. Double spending attacks have not been identified in Ripple

Read more

Coin tainting in Bitcoin

by Albert Szmigielski Coin tainting in Bitcoin is a way to mark certain coins for the purpose of devaluing them. Since all transaction are stored on the blockchain, a history of a coin can be traced all the way to its coinbase transaction. This fact enables tracking of coins belonging to any address. Certain addresses can be marked by some powerful entity as bad. As a result peers may choose not to accept funds from those addresses. If these entities gain support of the core developers then a blacklist of addresses can be hard-coded into the Bitcoin core software. Coin tainting can be used to incorporate measures of accountability in Bitcoin, but can also lead to abuses of the system.

Read more

Secure storage of Bitcoin private keys

by Albert Szmigielski Bitcoins on the Bitcoin network are controlled by private keys. Only the entity in control of a given private key behind some bitcoins can sign the ownership of those bitcoins to another entity. That is why it is of utmost importance to store the private keys securely to avoid theft of them and as a result theft of the funds on the blockchain. Hardware wallets One way to store keys in a secure manner is by the use of dedicated hardware wallets. Such wallets offer good security against cyber-attacks as they are disconnected from the internet most (or all) of the time. The wallets are tamper resistant, and they do not rely on any third party to

Read more