private function decodeWIF($WIF_encoded_key)
    {
        /* Using the Base58 decoding function and remove the padding. */
        $decoded_key = $this->stripHexPrefix($this->decodeBase58(trim($WIF_encoded_key)));

        list($private_key, $checksum_provided) = array(
                                                       substr($decoded_key, 0, -8), 
                                                       substr($decoded_key, strlen($decoded_key) - 8)
                                                       );

        $private_key_type = substr($private_key, 0, 2);

        if ($private_key_type != '80' && $private_key_type != 'ef') {
            throw new \Exception('Invalid WIF encoded private key! Network type was not present in value provided. Checked ' . $private_key . ' and found ' . $private_key_type);
        }

        $private_key           = substr($private_key, 2);
        $compressed_public_key = (substr($private_key, strlen($private_key) - 2) == '01') ? '01' : '';
        $private_key           = ($compressed_public_key == '01') ? substr($private_key, 0, -2) : $private_key;

        /* Now let's check our private key against the checksum provided. */
        $new_checksum = substr(hash('sha256', hash('sha256', $this->binConv($private_key_type . $private_key . $compressed_public_key), true)), 0, 8);

        if ($new_checksum != $checksum_provided) {
            throw new \Exception('Invalid WIF encoded private key! Checksum is incorrect! Value encoded with key was: ' . $checksum_provided . ' but this does not match the recalculated value of: ' . $new_checksum . ' from the decoded provided value of: ' . $decoded_key);
        }

        return $private_key;
    }