removed OT dependency from bitcoin-api so that it can be used in OT too. fixed some bugs and added plenty of comments.