bitcoin mining with python

25 Feb 2016 Blockbin is taking a break Blockbin will be closing for a period of time at UTC March 1, 2016.Additional columns and indexes were added over time to the original SQL design.The size of the database is now almost 100GB, resulting in very high server (memory) costs.Such costs, ongoing maintenance and limited interest in the project has caused a re-evaluation of the overall design and business model.Compute facilities will no longer be available past the above date.Access to saved snippets will be available for a limited period after this date.Please locally save any snippets you may have.Apologies for any inconvenience.We hope to welcome you back in future with a possible relaunch.Regards, Blockbin Support 08 Feb 2016 Blocks are full, right?Blockbin has recently added some additional columns and indexes to the SQL schema.Your Python code now has access to even more data from the Bitcoin blockchain.This may offer some additional insights into the operations and growth of the network.

Let us take a look at block size.So, are blocks full?They are, however, very busy.cur.execute('SELECT block_id, size ' 'FROM block ' 'WHERE block_id > 395000') /#!2hegsR9LdIxQBncW7DQQ96/4fhWH86Ywdzatqs0lPsivg 686KB average block size over 2200+ blocks.We can construct a more complex query here.Note - older coins are typically prioritized and can influence the overall required fee, even qualifying for a 'free' transaction occasionally.There are also a number of other conditions that affect transaction fees.Firstly, let us determine how many transactions have no fees at all.Instead of charting overall block sizes, we will sum all transaction sizes within each block that contain no fees.cur.execute('SELECT block_id, sum(size) ' 'FROM tx ' 'WHERE block_id > 395000 AND ' 'fee = 0 ' 'GROUP BY block_id') /#!317ClsLCCE24J7XpuVSvWm/5565utSDEtX6mFHIhnujCN An average of 7KB per block contain transactions with no fees (approximately 4 transactions per block).

These will either be old coins moving, transactions without fees, or the coinbase transaction.For simplicity and argument's sake, let us conclude that all transactions should pay a fee.We will now sum all transaction sizes within each block, filtering out transactions that do not include a minimum fee per kilobyte (10,000 satoshis per 1,000 bytes).
ripple labs bitcoincur.execute('SELECT block_id, sum(size) ' 'FROM tx ' 'WHERE block_id > 395000 AND ' 'fee / size >= 10 ' 'GROUP BY block_id') /#!2RBHTpFDg3sdvlj9ZrnhOa/4qfysM3ZWVx0W6GrdTG1S8 An average of 632KB per block.
uk litecoin mining hardwareNote a huge difference compared to the first chart.
ripple labs bitcoinThis is good, however, as it means participants are paying fees!
litecoin gpu 2014

Miners operate in the physical world and are subject to real-world costs.This drop has probably already been priced-in to some extent by the major miners and their projected earnings, but it could still wreak havoc with other operators.Could fees soon become more interesting to miners?Out of curiosity, what if the average fee increased?Four cents for a fast, worldwide transaction seems quite cheap after all!What if miners, for the most part, determined fees based on their physical world costs (e.g., market forces)?How many transactions currently pay a minimum 10c (26,000 satoshis) per transaction (or kilobyte) for example?cur.execute('SELECT block_id, sum(size) ' 'FROM tx ' 'WHERE block_id > 395000 AND ' 'fee / size >= 26 ' 'GROUP BY block_id') /#!5mQF9WZns3iNMEwMpEJ4qm/3cy0lMmO7oZsrUFxkdHLoa An average of 437KB per block is paying at least 10c per transaction (or kilobyte).How about 20c (52,000 satoshis) per transaction (or kilobyte)?cur.execute('SELECT block_id, sum(size) ' 'FROM tx ' 'WHERE block_id > 395000 AND ' 'fee / size >= 52 ' 'GROUP BY block_id') /#!5ZWzjIke9lJrpyquWO55Zp/1uVxNHoy8bCmyrdPWdUXXv An average of 100KB per block is paying at least 20c per transaction (or kilobyte).

We could go on.. but that would not be very meaningful or constructive.These are arbitrary numbers.Note - Approximately 5% of blocks are 'empty' (contain no transactions, other than the coinbase).These are ignored in the above figures.Out of curiosity, which miners are already dropping low-fee transactions?How about we first take a look at average weekly block size, by miners?miners = json.loads('{"BitFury":{"name":"Bitfury"},"AntPool":{"name":"AntPool"}.. Eligius":{"name":"Eligius"}}') cur.execute('SELECT coinbase, size ' 'FROM block ' 'WHERE block_id > ?', (x,)) .. if miner.encode('utf-8') in str(row[0].decode("hex")): .. /#!4Nr6ar8wVZIEVUGaXfPZb7/5wbFeDJKTl1MXP2imiTkWo Let us again filter out some low-fee transactions and chart the average weekly block size.This query will be a little more difficult.We will first create a temporary view for our transactions, joining the 'tx' and 'block' tables.cur.execute('CREATE TEMPORARY VIEW view_tx AS ' 'SELECT ' ' tx.size as size, ' ' tx.fee as fee, ' ' tx.block_id as block_id, ' ' block.coinbase as coinbase ' 'FROM tx ' ' INNER JOIN block ON (tx.block_id = block.block_id)') We will now filter out transactions that do not include a minimum fee per kilobyte (10,000 satoshis per 1,000 bytes).

miners = json.loads('{"BitFury":{"name":"Bitfury"},"AntPool":{"name":"AntPool"}.. Eligius":{"name":"Eligius"}}') cur.execute('SELECT coinbase, sum(size) ' 'FROM view_tx ' 'WHERE block_id >?AND ' 'fee / size >= 10 ' 'GROUP BY block_id', (x,)) .. if miner.encode('utf-8') in str(row[0].decode("hex")): .. /#!3ufm9sVJJJsLlheqNc2tgW/5rYXH4BXPzUrbWQ7VpiAmC There seems to be a difference with Bitfury between those two charts.Let us count up all low-fee transactions (there are not many) over a 10-week period and and see who is mining them.miners = json.loads('{"BitFury":{"name":"Bitfury"},"AntPool":{"name":"AntPool"}.. Eligius":{"name":"Eligius"}}') cur.execute('SELECT coinbase, count(tx_id) ' # get coinbases from blocks, tx count 'FROM view_tx ' 'WHERE block_id > ?AND ' 'fee / size < 10 ' 'GROUP BY block_id', (x,)) .. if miner.encode('utf-8') in str(row[0].decode("hex")): .. /#!1WIVEdmgtqsUoQC7qV6sww/3yrBSPk1JSqBPMESCJPhV6 Blockbin was built with exploration and curiosity in mind.