It’s a hack, but it’ll work. You’ll need either:
- Windows, running the git-bash app (highly recommended). Download it here: Git – Downloads
It’s a hack, but it’ll work. You’ll need either:
alias please='sudo $(fc -ln -1)'
Use this all the time
alias ok='eval $($(fc -ln -1) 2>&1 | sed -n 2p)'
alias back='cd $OLDPWD'
I use this one most of all when copying files to destinations outside of the current directory, especially if the paths involved are pretty long. Sometimes after copying, I may follow the file to the destination just to check what I just did by changing directory to the destination directory. ‘back’ lets me return to where I was before pretty effortlessly. This alias takes advantage of the
OLDPWD environment variable.
alias freemem='echo "echo 1 > /proc/sys/vm/drop_caches" | sudo sh'
For this example, I started to copy a 4 GB file so that I knew my ram would start to be used up. Here, you can see my memory available on the left is decreasing as I hit enter for purposes of demonstration. (displaying my system memory is done using the
PROMPT_COMMAND environment variable). You can see when I use
freemem, I get my memory back.
alias dog='pygmentize -g'
This works like cat in that it dumps the contents of a file to the screen. It does not concatenate files. But it does read the shebang and print the code with syntax highlighting, if it can. Requires python-pygmentize
I use this one a LOT! Ignores case and prints line number.
alias lsg='ls -la| grep -ni'
I have many variants of this one, most notably to do this recursively through directories beneath you:
ls -laR | grep -in
If you don’t have pygmentize for my
dog alias, make installing it a breeze
alias gimme='sudo apt-get install'
Get bitcoin price data from the coinbase API and parse it into an easily manipulated form.
>>> from fast_dump_v22 import *
Will return all the data on page 1 of coinbase’s bitcoin price API (this is the latest data).
You can almost always turn on optional debug statements
>>> get_first_N(3, show=True)
... fetching first 3
You can get all the price data that coinbase has
... getting page 1
... getting page 2
... getting page 3
... getting page 4
... getting page 5
... getting page 6
... getting page 7
... getting page 8
... getting page 9
... etc ...
All the ‘get_*’ functions return a price_data string, which is interlaced timestamps and prices littered with newlines and commas. You can print them to see what is going on more clearly:
Turn on the optional show switch for printing large vectors
>>> prices(get_page(11), show=True)
... returning 11000 prices in specified range ...
You can use prices(data)[k] and timestamps()[j] to return the kth price in data, or the jth timestamp in data.
>>> data = get_page(1)
>>> prices(data, index=4)
are two equivalent ways of returning only the 4th price in the requested range (in this case, page 1). This also works for timestamps.
>>> timestamps(get_page(1)+get_page(2)) == timestamps(get_first_N(2), index=1166)
This shows the expressiveness of this module. In general:
>>> prices(get_page(2)) == parse(get_page(2))
prices() and timestamps() are just functions that return a parsed() object having a specific index, or indices.
>>> parse(get_page(1)+get_page(2)+get_page(3)) == prices(get_first_N(3))
>>> parse(get_page(2)+get_page(3)) == prices(get_range(2,3))
The parse() function is there to manually control the outputs instead of just getting prices, or timestamps
>>> x = parse(get_page(1))
As you can see, parse(price_data)[k] returns the kth price in the list. Indices [k] return the kth timestamp.
The parse() function takes care of some weird edge cases:
>>> get_first_N(3) == get_page(1)+get_page(2)+get_page(3)
>>> parse(get_first_N(3)) == parse(get_page(1)+get_page(2)+get_page(3))
>>> x = get_page(1)
>>> y = get_range(2,7)
>>> prices(get_first_N(7)) == prices(x+y)
OPERATOR( get_page(1) + get_page(2) + ... + get_page(k) ) == OPERATOR(get_first_N(k))
OPERATOR is parsed(), prices(), or timestamps(). We also know prices() can obviously display and return ranges of values. When returning large vectors, you can verify their length by setting show=True. The “show” parameter is optional for all get_* functions and provides some information about the operation being performed.
>>> print( prices(get_first_N(11), show=True) )
... returning 11000 prices in specified range...
since each page is a thousand pairs of values (timestamp, price).
>>> prices(get_page(2)) # returns a long list
fast_dump_v1* are older versions that are somewhat different. They are designed to store the fetched data in the .data directory. This in v2*, this was abandoned in favor of stdout redirection.
// 2015 altodinerd.com
For the impatient: Skip to step 1
Bitcoin is one of the most interesting technologies we have seen emerge in the past ten years. And it confuses everyone who sets out to use it. This post is my definitive guide to beginning your journey with bitcoin the right way.
To me, the right way includes, but is not limited to:
It is. This is my blog.
You shouldn’t necessarily trust me or anyone – bitcoin isn’t about trust. But if you google “altoidnerd”, you’ll find that I have been around the bitcoin eco-system for quite some time. That’s all I can tell you.
There are just so many wallets available – why bitcoin-core? Because I have been using it for years, I have a very good method of keeping my coins safe, and that is what I am sharing with you today. Use it- it is THE wallet.
I am a linux and an OSX user. So please understand the scope of my knowledge includes these operating systems. If you want to use OSX, most of this tutorial will make sense with minor changes perhaps.
If you want to use windows, that’s ok, I’m not going to judge you. Bitcoin-core is available for windows as well. Please understand however, I am not a windows user, so I will not be able to give you “the definitive bitcoin windows guide”. You can still read on, however, since you can apply much of this tutorial to usage of bitcoin-qt’s debug window instead of the command line.
Navigate to bitcoin.org’s official download page and select the bitcoin-core distribution for your operating system. And do choose linux (tgz). Do that because you should be running linux. But if you aren’t, even though you should be, choose the distribution for your operating system. Extract and install the client.
To really take control of things, and understand what is happening, you’re going to want to run bitcoin software from the command line. Though it isn’t really necessary to download the thing from the command line, I’m going to describe that here because this tutorial is the first installment of a start to finish command line approach. For a sneak peak of what I mean, see an earlier post where I described how to use bitcoin-core to generate QR codes without having to trust shady ass websites.
Go to your home directory and create a new directory just for bitcoin. This is not a necessary step, but once again, this is my “right way” tutorial and I will explain reasons for this later on. Enter the directory, and download the tarball with the “wget” command. The extract the tarball like so:
tar -xzvf bitcoin-0.11.0-linux64.tar.gz
Sweet. Now change directory to where the binaries are,
and launch “bitcoin-qt” (qt means its the GUI version).
It’s going to show you the dialogue box below and ask you if you’d like to use the default directory. Do it. Click “OK”.
You’ll see a friendly startup screen if you’ve done things right!
Bitcoin-core is called a “full-node” implementation, which means the first time you start it on your machine, it’s going to download every single bitcoin transaction that has ever taken place. Wait until the blockchain is synced to start making transactions.
In the mean time, you need to set a passphrase for your wallet. This is super important. In the upper left corner of bitcoin-qt, go to settings -> Encrypt Wallet, and set a very strong passphrase.
This will make it impossible for anyone to send bitcoins from your wallet without entering your password:
Just make sure you:
Once you encrypt your wallet, you can copy and store
wallet.dat everywhere (I explain
wallet.dat in great detail in “Step 3”). I literally have copies of my main
wallet.dat on 6 or 7 computers, because come hell or highwater, I will always be able to find a copy of my
wallet.dat file. I suggest you do the same. Here is why strong encryption and insane redundancy works:
wallet.dat, because even if someone finds the wallet file, they wont be able to do a damn thing with it. They won’t be able to spend your coins without your passphrase.
wallet.datand store them like literally everywhere, on all your machines, three times over. In the cloud. On your mom’s computer. Hell, theoretically speaking, you can post your encrypted
wallet.daton the internet and just about everyone will have a copy, and be unable to spend your coins, because they don’t know your password. Someone remind me to put some coins into an address, and post the encrypted wallet online to prove my point.
If you encrypt your wallet like a boss, you never forget your password, you never tell anyone your password, and you copy the file to everywhere you possibly can imagine, you will never lose your coins. And nobody will be able to steal them from you. Seriously, nobody. It is computationally impossible.
Let’s break it down this way. Here are some things that just happened when you launched bitcoin-qt for the first time:
~/.bitcoinwas created. It contains among other things the single most important thing ever: a file called
wallet.dat. This file is critical.
~/.bitcoin/wallet.datcontains all of your private keys.
wallet.datis life. When you see in headlines in the news like “Frustrated gentleman quite upset having lost a usb jump drive containing 100,000 BTC“, it means he doesn’t have a copy of
wallet.dat, so neither he, nor anyone on earth, nor God himself can spend his coins anymore.
Do not delete your
wallet.dat file. Just don’t. If you want to start a new wallet, instead of deleting
wallet.dat, just rename it to something else, like
wallet.dat.old, restart bitcoin-qt, and it will create a new wallet for you. Keep your wallets people. Keep them good.
Notice how I have a file called
wallet.dat.default? That’s because I never delete a wallet. When I installed bitcoin on this computer, I moved the
wallet.dat that stores my coins into
~/.bitcoin/, but first I renamed the existing file so I can keep it. Because, why not? I’m telling you – don’t delete a file called
wallet.dat, because mistakes happen, and its better to have hundreds of files named
wallet.dat.* than it is to lose your coins.
In my next post, I will describe some of the features of the bitcoin-qt debug window,
bitcoind and its helper
bitcoin-cli. You can do interesting things, like import new keys, or convert keys to qr-codes.
If you have ay questions, please feel free to comment or contact me.
If you liked this post, you can donate bitcoins to me here: 12gKRdrz7yy7erg5apUvSRGemypTUvBRuJ
Learn about the author here:
Note: Breadwallet will not import the private key upon scanning the qr code. It will offer to transfer the funds in that address to your breadwallet keyring.
Breadwallet, an awesome open source iOS bitcoin SPV client, allows you to import a private key for use within breadwallet. So, if you’re a user of bitcoin-core, and want to be able to spend some of your funds you have there with breadwallet, you’ll need to create a QR code of your private key to scan it with breadwallet.
This tutorial uses qrencode, an open source string to QR converter. The source can be found here: https://github.com/fukuchi/libqrencode/
Alternatively, you can install qrencode on ubuntu/debian through repositories
sudo apt-get install qrencode
Then, as of bitcoin-core version 0.11.0 you’ll need to run
bitcoind rather than the GUI
bitcoin-qt. If you’re using an old version of bitcoin-core that does not have the
bitcoin-cli tool, you can get the latest version of bitcoin-core and extract it without having to verify the blockchain again or mess with wallet.dat – your
~/.bitcoin directory will remain unchanged.
tar -xzvf bitcoin-0.11.0-linux64.tar.gz
You should see the executables for the bitcoin-core suite here.
Be sure you quit any versions of bitoin-qt or bitcoind that are already running, then start the bitcoin daemon
The & operator makes sure bitcoind detaches from your terminal so you can keep going.
Now you are ready to get a QR code for your desired address. Is your address is “addr”, you can generate a QR code of your private key without ever showing your private key on screen in plain text. Just do:
./bitcoin-cli dumpprivkey "addr" | qrencode -o ~/Desktop/Key.png
Or better yet, if you want to create a new address and QR-encode its private key,
./bitcoin-cli dumpprivkey $addr| qrencode -o
echo "private key dumped for: "$addr
The QR code should appear on your desktop. Below is a screen shot of me doing an example where I create a new address, and get a QR for its private key. Enjoy!
Note that if your wallet is password protected (which it really should be), you’ll need to first do
./bitcoin-cli walletpassphrase "your_password" 100
where the argument 100 means the wallet will allow all actions (like spending, or dumping keys) for 100 seconds. That should be plenty of time.
# facebook | grep brains
# cat ./telecom| egrep (options|competit.?.?.?.?.?)
~$ ls -laR | grep food
# cat ./reddit/r/bitcoin/* | grep criminals
Display all 169,236 possibilities? (y or n)
~$ ./github/ | grep working code
Installation in Ubuntu:
Open up a terminal and do
sudo apt-get install autoconf libtool libncurses-dev yasm curl libcurl4-openssl-dev libjansson-dev pkg-config libudev-dev libusb-dev utha sh-dev libsensors4-dev libmicrohttpd-dev libevent-dev libusb-1.0-0-dev
git clone https://github.com/luke-jr/bfgminer
sudo ./bfgminer -S antminer:all -o stratum.bitcoin.cz:3333 -u User_name.Worker_name -p x --set-device antminer:clock=x0781
See other guides for overclocking. Make sure your device does not overheat.
Installation for Windows 7:
The first thing I did is get this driver:
Without that driver bfgminer would not find the stick.
Then download bfgminer and unizip to it some destination. This was just updated so I’m pretty sure you need the newest release, which is available at
Then inside the unzipped folder which contains bfgminer.exe, create a new plain text file in notepad (this will point to slush’s pool…use whatever pool URL you want to mine with…)
bfgminer.exe -S antminer:all -o stratum.bitcoin.cz:3333 -u user_name.worker_name -p x --set-device antminer:clock=x0781
and save it as a batch file
then double click the batch file.