There has been much discussion (and some excitement) in our house recently about the BlockChain.
Interest is also growing in large financial institutions, and companies are beginning to invest in research & development to ensure that they don't get left behind.
So will the BlockChain change our lives, or is it a techno dead-end?
I'm not sure, but its time I took a closer look.
BlockChain, is that like Bitcoin?
The BlockChain is a decentralised, distributed, virtual ledger. This means that it is not held on a single server, or controlled by an organisation (like a bank or government) and it maintains all transactions in a sequential database.
In principle the BlockChain could be widely used for securely storing information for a range of applications, but its main application at the present time is for storing transactions for cryptocurrencies such as Bitcoin.
Find an API and get hacking
Back in 2013 I wrote a Bitcoin post where I tried to use an API to extract Bitcoin information and data. The api was badly documented, so it took a lot of experimentation to work out roughly how it was supposed to work.
But things have moved on in two & a half years and there are now many well documented APIs such as the one I chose to explore: https://blockchain.info/api
So I used my Raspberry Pi web server to conduct a few tests. This server already has PHP and Lighttpd installed, so it should have just been a case of cloning the api code from Git and trying a few of the examples in this project.
I started by installing composer from a terminal:-
curl -s https://getcomposer.org/installer | php
...and added this text to my /home/pi/.bashrc file:-
Composer is a Dependency Manager for PHP, and is required for this example.
I created a folder on my server:-
...and downloaded and extracted the zip here from this Git project.
I then navigated in the file manager to:-
...and hit F4 (this opens a terminal at this location). Then I used the command:-
On a remote computer it should now be possible to access one of the example files using the appropriate url, e.g.
I seemed to have a problem initially with Curl. However, after a bit of fiddling around and a couple of re-boots it all came good.
Just about the most simple PHP software I could come up with is this, which only has 4 lines of code and illustrates how straightforward it is using this api:-
|Hopefully this simple commented PHP code is self explanatory|
...which calculates the current conversion rate and produces this one line output in a web browser:-
However, this API will allow you do much more, including receiving and sending money using you Bitcoin wallet. It also has APIs for other languages including Java, Python, C# and Ruby.
You will find many other APIs on the net of varying complexity including this one, which I understand is quite popular:-
Fans of bitcoin will emphasise that the strength of BlockChain encryption makes a brute-force attack impossible. Just like the WW2 Enigma machine, trying to crack the encryption head-on is a waste of time.
|Attack is futile! ...but there are often other ways|
However there are other points in the whole business of dealing with crypto-currency that are worth consideration.
Your Bitcoins need to be held in a wallet either by you, or on your behalf. If you store them, then lose them due to a drive failure or you lose the hardware, they are gone for ever. Any kind of storage media may suffer a random failure, possibly due to manufacturing issues. All digital media will probably fail eventually.
If your wallet is held online, maybe by a trader, it may be vulnerable to hackers or a rouge trader (think Mt.Gox). Passwords were originally stored in plain text, and even if you have changed your password and encrypted the new one, your old wallet may still be hackable.
And if you are selling goods for Bitcoin, there are potential "double-spend" scams to beware of. The blockChain has an update time of 10 minutes. This is a target, but updates may occur quicker or take longer than the target. So there may be an opportunity to spend the same Bitcoin twice!
However, its a dangerous world, however you choose to spend or handle your money (cash, credit card or crypto-currency).
The View From Above
Even the "clever" people like Economists and Bankers are divided on whether techonology like Bitcoin should be taken seriously or just ignored.
|Our boys (Matt & Tyler) at the recent BlockChain Hackathon (Dublin)|
JPMorgan CEO Jamie Dimon is very dismissive of crypto-currencies, while big companies like Fidelity & Deloitte are happy to sponsor weekend Hackathons and explore the possibilities.
Hey Thanks for sharing this blog its very helpful to implement in our workReplyDelete
Cryptocurrency Fraud Recovery