Bitcoin (BTC) vs. Bitcoin Cash (BCH): The Bitcoin Scaling Debate

12 Kudos

Let’s talk about the facts of the Bitcoin vs. Bitcoin Cash scaling debate. Off-chain scaling (lightning network) vs big blocks.

Bitcoin Cash forked on August 1st, 2017. The main idea behind the fork was to increase the block size from 1MB to 8MB to allow more transactions in a single block and thus alleviate the congestion on the network. Makes sense right? To keep the fees low, just add more capacity to the block and that is that, problem solved. It’s a simple solution that makes sense at a quick glance, but let’s take a closer look at some possible issues here.

At the current time of writing the average number of transactions that Bitcoin can process per second is around 3.5. This can vary from block to block, which is why we will be using the average for this purpose. Okay so Bitcoin to Paypal conversion can handle about 3.5 transactions per second, that means it can handle about 300,000 transactions per day. So how many people can Bitcoin currently support? Well, if Bitcoin is meant to replace all transactions a normal person would do in a day, and the average person does, let’s say, five transactions a day, then Bitcoin could support 60,000 people with each block being 100% full. Great, so 1MB blocks can handle 60,000 people, not bad, but not great. Considering there are over 7 billion people on the planet, we need to scale so every single person can use Bitcoin. Let’s take it one step at a time. First, we need to scale to 600,000 people, well that is simple. Increase the block size to 10MB. Now we need to scale to 6,000,000 people. Okay, 100MB blocks. Now 60,000,000 people, 1 GB blocks. Then 600,000,000 people, 10 GB blocks. 6 billion people, 100 GB blocks. Now, what happens when we have these massive blocks? Let’s go back to 10 GB blocks. 10 GB blocks with one block every 10 minutes, that is over 1 terabyte per day. That is a lot. It’s not just storage, but it’s also computing power and bandwidth. If you want to run a node or mine, you need a lot of resources to keep up with that. When you can’t process a block in time, you will be left behind and cut out of the network. This leads to centralization very quickly. Only groups that are able to handle these blocks will be able to mine and control the nodes. Bitcoin needs more distributed nodes, not less.

Well, let’s say that technology improves over time and you know what, 10 GB blocks are fine, we all have 1 gig connections and massive multi-petabyte hard drives. Storage is cheap, right? Great, no more problem, everyone can run a node and mine if they want to, no more centralization. What really concerns me here is we’re still stuck at everyone who can only use 5 transactions per day. What if we want to do more, what if we want to start doing hundreds of transactions a day or thousands? Well, time to increase the block size again and we push further into centralization. The regular person can’t keep throwing more bandwidth, computing power and storage at the problem. It just doesn’t work. Big blocks don’t scale.

What we need is a proper scaling solution like the lightning network, which can theoretically handle billions of transactions per second. Imagine the possible applications here. All of these transactions are handled off-chain with minimal transactions clogging up the main blockchain. Only one transaction to move your Bitcoin off-chain, and when you’re want to move it back on-chain, settle up and another on-chain transaction happens. With D-Central’s all-inclusive asic hosting is helpful to its customers for a variety of reasons, click on this site for more information.

To get to that scale, yes the block size does need to increase, but we need to wait and increase it at the right time, even the Lightning Network whitepaper suggests a 130 MB block size. That is way more palatable than 10 GB blocks and handles scaling in a much more elegant fashion. Blocksize increases need to happen with a hard fork, and doing it without a proper solution going forward is a bad idea. We need the proper solution planned out from the start, not some quick fix that will lead to a larger problem in the future, it’s dangerous and could irreversibly damage the network.

Read more about the lightning network

Acquia Certified Developer Exam: Review and Tips

28 Kudos


I have just completed my Acquia Certificatied Developer Exam.  Initial words, it was harder than I expected.  I did well on the exam but I wasn’t 100% sure on some of the questions, which left open some gaps and uncertainty when I pressed that “Submit Exam” button.  It’s not easy to study for this exam, and they tell you this.  The best way to prepare is just to have experience.  I would agree with that statement.  One other missing piece, is there isn’t a lot of sample questions out there so it can be hard to know what to expect when you’re in the exam.


To prepare for the exam, I followed the blueprint Acquia offers on their site, and followed the links to the documentation in the areas where I felt my knowledge was lacking.  During the exam a few of the things I read did help me select the right answer.  Reading through the documentation could be that edge you need to walk away with a passing grade.

That was basically the only preparation I did, other than working with Drupal for the past 6 years.

Getting Setup

After you register for the exam and give up your $250 fee, you need to do a few things to get your computer set up.

  • Download and install the Sentinel app.

This was a problem for me, because I run straight linux so I had to use a co-workers computer for the exam.  I ended up using a mac desktop.  It has a built in webcam and microphone so there was no problem there.  It felt a little awkward using someone else’s computer.  At least 24 hours before the exam you have to register your biometrics, which includes taking a bunch of photos of your face from the webcam, and repeatedly typing your name over and over.  No problems there. One small problem occurred during the exam when suddenly the Sentinel app switched off and some safari popped up.  I thought I was going to be penalized, and because I’m not a OSX power user it took me a few seconds to bring Sentinel back into focus and continue.  However nothing was mentioned and I continued on as if nothing had happened.

The Exam

Once you launch the exam, you are in and the counter starts ticking down, 90 minutes.  You have 60 questions to answer in 90 minutes which leaves 1 minute and 30 seconds per question.   It sounds stressful on paper but it is an appropriate amount of time.  I worked my way through the 60 questions and had 40 minutes spare to review.  I ended up finishing completely with about 12 minutes remaining.

Each question is either multiple choice or in some instances selecting 2 or 3 answers.

Thoughts About the Questions

As I said before, the exam is tough, however there are a few free answers in there to help you get through it.  I consider myself a “back-end developer.”  I spend most of my time working on modules, and I feel I am quite proficient at this.  However, a lot of the stuff I do with modules is not covered in this exam, it is a lot more general.  I found this to be a problem because this general back-end stuff is usually be handled by modules that have already been created and vetted by the community, the modules I build are often one off particular to a specific situation.  The front-end stuff was probably the easiest section, and where I found most of the “free” answers.  Acquia says, your first answer is usually the correct one.   I can’t say if that is the case for sure as they don’t give you a breakdown of questions and answers after the exam.  I don’t know specifically which questions I got right, and which ones I got wrong.

Hints and Tips

Now here is the section that seems to be lacking around the Internet.

  • I had about six questions that revolved around hook_boot() and hook_init(), mostly on the subject of caching. So make sure you understand what these two do during Drupal Bootstrapping and their differences.
  • In conjunction with the above, learn all about Drupal caching.  From core caching, to block caching, view caching, and how custom modules interact with caching.  There were about 10-12 questions that had to do with caching on my exam.
  • Nail down all the template theme_hook suggestions – Especially for field specific templates
  • Continue that on with a good read through hook_theme()
  • I only had one question on git, but it would be a good idea to make sure you understand some basic git commands to get a free answer.
  • Know how, and when to use template_preprocess_page(&$variables)
  • Understand some basic OOP practices, for example creating classes, extending classes, and passing variables by reference
  • Know the difference between dynamic queries and static queries
  • Basic understanding of how Javascript, jQuery and Drupal Behaviours work
  • Basic understanding of the Drupal Form API (including AJAX)
  • Views – Of course there would be a few questions about views but there was nothing to difficult.  Just questions about relationships, contextual filters and of course caching.
  • Taxonomies – Using taxonomies, and taxonomies in conjunction with views, through relationships or contextual filters
  • Node View Modes – There were quite a few questions on view modes, and how to use them with other features in the site (Don’t forget about the view mode – Search Index)
  • Understand how multi-sites work, and how the folder structure is managed
  • One question about some basic CSS
  • When to use a preprocess function instead of changing the template

Hopefully these tips will help you narrow down your focus and give you a place to start studying for the Acquia Certified Developer Exam.  Best of luck!

Extra Resources

Best Cheap Drupal Hosting on a Private VPS Server

24 Kudos

There are too many hosting options out there count, and some offer extremely low prices. However, with those low prices, comes a low quality of service. It’s also quite common that with this low price tag you are locked into a yearly deal. If you site out grows your hosting you will be forced to move into the more expensive tier, when that happens, your cost savings go out the window.

Been there, done that. Now all my sites are hosted on Digital Ocean. Here you can get a fully accessible Drupal site up and running in under 55 seconds for the low cost of $5 a month.

Why I love Digital Hosting for Drupal Servers

  1. Cheap – Their lowest tier is $5 a month, and you are getting way more out of this server than you will from a shared hosting service for the same price.  If your site needs a little more power, upgrade to the $10 or $20 tier and you will be sailing.
  2. Easy – Installing a Drupal site is literally as easy as clicking a few buttons.  These clicks do hours of work for you, installing nginx, mysql, drush, and all the other prerequisites you need to get your server up and running.
  3. No contracts – If you’re done with your site, simply destroy the droplet.  You are not charged on a yearly, or even monthly basis.  You are only charged per hour that your server instance is running, so once you’re done, you’re done.
  4. SSD – With each instance, your site is loaded up on a machine with an SSD which makes your site quite fast.  It also means you can expand your virtual RAM space with a swap file that will operate at high speeds.
  5. Root access – It’s rare to find a VPS server, with root access at this price.  For example, the $5 tier on Digital Ocean has more data transfer, SSD and a full CPU, while the cheapest HostGator option has no SSD, 0.5 CPU and costs $12
  6. Single Click Installs – Looking to setup a Drupal site, Digital Ocean can do that with a single click.  The also offer a ton of other options for a single click
  7. Documentation/Support – Their documentation and support is phenomenal.

Free $10 credit

When you sign up using my referral link, you will receive a free $10 credit which will give you enough for two-months absolutely free.  Try it out yourself, zero risk.

Let me know in the comments if you have any questions, happy to help.

Drupal 7: Big cron tasks? Spread them out.

27 Kudos

If you’re building a module that relies on the Drupal cron to do heavy work for you, it might be better idea to split up the task into chunks to share the load.

Let’s say you have a single cron task that has some heavy database work, that could take the cronjob over a minute to execute. Here is a little algorithm you can put into place to help lighten the load on each run.

We need to assume a couple things, but these can be easily adjusted for your case. First we have to assume the table has an incremental index like a primary key, if it doesn’t there is another way to do this, but most tables should have a primary key. Let’s also assume the cron runs once an hour, and each row needs to be affected once per day. Which means we have 24 times to act on every row.

function MODULE_cron() {
  // Setting how many cron runs there are in a day
  $cron_runs = 24;

  // Get the the total number of rows that need to be acted upon
  $rows = db_query("SELECT COUNT(*) FROM {tbl_name}")->fetchField();

  // Rows per cron
  $rpc = $rows / $cron_runs;

  // Get the last row we acted on, else set to 0
  $last_row = variable_get('MODULE_last_row', 0);

  // Set new last row
  $new_last_row = $last_row + $rpc;

  // Get all the rows we want to act on
  $result = db_query("SELECT * FROM {tbl_name} WHERE primary_key > :last_row AND primary_key <= :new_last_row",array(":last_row" => $last_row, ":new_last_row" => $new_last_row);

  foreach($result as $row) {
    // DO WORK

  // Get the new last row, if over the limit, reset to 0
  $new_last_row = ($new_last_row > $rows ? 0 : $new_last_row);

  // Set the new last row that we acted on
  variable_set('MODULE_last_row', $new_last_row);

The beauty here is that, even if the list grows over time, it will then increase the amount of rows to act on. It scales well and can help take the load off each cron run. Very usefulif you have a table with a lot of data.

Add HTTPS (SSL) to Your Drupal 7 Site on Linux/Apache

27 Kudos

1. Getting your SSL

Purchase a new SSL from a registrar, I use NameCheap, you can get a simple PositiveSSL from Comodo for $9.00/year.
After your purchase is complete, you will need to generate a key and csr from your server.

# sudo mkdir /etc/apache2/ssl
# sudo openssl req -nodes -newkey rsa:2048 -keyout websiteurl_com.key -out websiteurl_com.csr

The key file is used later, and the csr file is used to generate your SSL certificate. Finish the process and wait for your certificate to arrive in a zip file to your email address. Place all those files in your /etc/apache2/ssl directory.

2. Enabling SSL on Apache for Drupal

First we need to make sure SSL is enabled on Apache.

# sudo a2enmod ssl

Now we need to edit your vhost file for your Drupal site. Here is a very simple vhost file for a Drupal 7 site, yours may be different:

<VirtualHost *:80>

  ServerAdmin [email protected]

  DocumentRoot /var/www/domain

<VirtualHost *:443>
  ServerAdmin [email protected]

  DocumentRoot /var/www/domain

  SSLEngine on

  SSLCertificateFile /etc/apache2/ssl/domain_com.crt
  SSLCertificateKeyFile /etc/apache2/ssl/domain_com.key
  SSLCACertificateFile /etc/apache2/ssl/domain_bundle.crt


Here you are basically adding turning on SSL for all http requests going to port 443, the default SSL/TLS port. One thing that may not have been provided to you in your SSL zip file is a bundle file, it’s basically three crt files all concatenated together. Each SSL is different so you are going to have to figure this one out on your own.

# sudo service apache2 restart

Your site should now be working over https

3. EXTRAS: Redirecting not SSL traffic to SSL or http traffic to https

1. SecurePages is a great way to help manage your SSL redirects within Drupal. To enable secure pages, download the latest stable version of the module and place it in your modules folder. Add $conf[‘HTTPS’] = TRUE; to your settings.php file. Enable the module, go to the configuration screen and select which pages you want it to redirect to HTTPS.

2. Apache redirects is another option, very similar to securepages, but it’s don’t on the Apache level. You can redirect all traffic to https by adding this to your vhost file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


If your SSL isn’t working here are a couple common issues.

1. If you are using CloudFlare Free, you’ll have to disable CloudFlare as they only allow non-https traffic on the free plan

2. Your apache server needs to listen on port 443. This should be set up by default in the ports.conf, however if not add in Listen 443 to the configuration.

3. Your server is blocking port 443. If you have any sort of firewall or IP Tables setup, make sure port 443 is open.

4. Your chain or bundle files where generated incorrectly.

Drupal 7: Lock/Password protect our site from anonymous users and add login/register block

19 Kudos

There are a few ways to do this, probably the most common way is to put your site in maintenance mode and edit maintenance-page.tpl.php. This method works well and can produce the desired results, however, it’s not the proper way of doing things. What if you still want to have the use of maintenance mode for it’s intended purposes. Well this could still work, but you’re going to have to fiddle with the permissions each time. Also the maintenance mode message will appear on your site, so that will have to be removed and if you want it back, you’re going to have to edit code.

Here is another way, without having to fiddle around with any backend code.

  • Make sure PHP filter is enabled in the modules
  • Create a new block
  • Enter your template information in there, here is an example based on a bootstrap design

<div class="container">
  <div class="row">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">Access Denied - Please Login or Register</h3>
      <div class="panel-body">
        <div class="row">
          <div class="col-sm-6">
            <h3> Login </h3>
              $loginForm = drupal_get_form('user_login');
              print drupal_render($loginForm); 
          <div class="col-sm-6">
            <h3> Register </h3>
              $registerForm = drupal_get_form('user_register_form');
              print drupal_render($registerForm); 
  • Set the text format to “PHP”
  • Go to Visibility Settings > Pages > Pages on which this PHP code returns TRUE
  • Enter this code:

  global $user;
  $url = $_SERVER['REQUEST_URI'];
  if ($user->uid || strpos($url,'user')) {
    return false;
  else {
    return true;
  • Save block
  • Place the block into the content region and save the changes.
  • Go to permissions and change the Node permission – View published content for anonymous users. Uncheck the box.


Drupal and Drush: Import/Export SQL Database with Drush

44 Kudos

Moving sites from one server to another can be a tedious task, however with command line and drush we can simplify this task into a few easy steps.

Export the database

# drush cc all && drush cc all
# drush sql-dump > /tmp/website-dump.sql

Clearing the cache first removes unwanted cached tables which make the SQL file quite large and can also cause problems on import with the “MySQL Server Gone Away” errors

Copy the database over to your other server

You can use whatever method you like (FTP, etc) but to keep things on the command line, let’s use secure copy.

# scp /tmp/website-dump.sql [email protected]_host:/tmp/website-dump.sql

If the site you wish to import to is on the same server, you can skip the step above

Use drush to import the database

Navigate to your drupal install and run “drush status” to make sure the database connection is there.

# drush sql-drop
# drush sql-cli < /tmp/website-dump.sql


Responsive Twitter Widget

14 Kudos

Grab your twitter widget.

Add this to your CSS file.

.twitter-widget-0 {
  width: 100%;


Drupal 7: Basic Drush Commands

31 Kudos

If you have SSH (command line access) to your Drupal website, then drush is a must.  Here are a few of my favourite and most useful Drush commands.

1. Clearing the cache with drush

When developing clearing the cache can save a lot of headaches, however doing it through the user interface takes it’s time and using drush helps to speed up this process.

drush cc all

It is also possible to pick the specific cache you wish to clear but most of the time I am using this command in development and clearing all the caches works perfectly.

2. Downloading and enabling modules with drush

This is one of the best features of drush and probably the most used

drush dl <project_name> -y

drush en <project_name> -y

It is also possible to specify the version you wish to download, for example if you are looking for the development version

drush dl <project_name>-7.x-1.x-dev -y

3. Disabling and uninstalling modules with drush

Another feature which allows quick disabling of modules including their dependencies all in one line

drush dis <project_name> -y

drush pm-uninstall <project_name> -y

Don’t forget you can chain commands together in the normal bash way

drush dis <project_name> && drush pm-uninstall <project_name> && drush updb && drush cc all && rm -rf path/to/project/folder

4. Resetting user passwords with drush

Sometimes you need to reset passwords for specific users or even the admin password, in Drupal 7, passwords are salted and must be created with the password script, where in Drupal 6, the passwords were just a MD5 hash. Thankfully drush has a command to automate the whole process

drush upwd <username> --password

Another useful feature is generating a password reset link

drush uli <username>

5. Setting maintenance mode with drush

The vset command allows you to modify variables in the variable table from the command line, it follows this general rule

drush vset <variable_name> <value>

Which means to change the maintenance_mode variable on, we use this command

drush vset maintenance_mode 1

To change the maintenance_mode variable off, we use this command

drush vset maintenance_mode 0

6. Changing the default theme with drush

Have you ever blown up your site with a bad change but need to get into the interface so you can change something back? Well whatever reason you have where you need to change the default theme, this command can save lives.

drush vset theme_default <theme_name>

The theme must be enabled, but you can do with with the drush en command listed above.

7. List all enabled modules, exclude core with drush

drush pml --status=enabled --type=module
drush pml --status=enabled --type=module --no-core

8. MySQL dump with drush

Perform a mysqldump (or equivalent) of the connected drupal database into a .sql file

drush sql-dump --result-file=/home/user/dump.sql

9. Backup and restore sites with drush

You backup your site into a single archive file, and then restore it with these simple commands

drush archive-dump --destination=/home/user/backup.tar.gz

drush archive-restore /home/user/backup.tar.gz

10. Update drush with drush

A very simple command to get the latest version of drush

drush self-update

For a full list of commands, check out

Building Search Queries for Twitter’s REST API 1.1

22 Kudos

I recently need to get a JSON object from Twitter’s API that had a couple of requirements. I needed the most recent tweets that contained a specific hashtag OR were from a specific user AND didn’t contain any retweets.

Starting with the base API URL for search

Then appending each piece of the search as required OR #example OR #example + exclude:retweets

Then a proper URL encode results in

TIP: To find out what the URL should be after the ?q= do a search how you would like on or and copy of the tail end of the URL and stick it onto yours.