Buy Bitcoin From The Command Line

Posted by Michael Goldstein

Buy Bitcoin From The Command Line with 21 buybitcoin

Overview

In this tutorial we'll show you how to buy bitcoin directly from the command line of any machine. This is a great way to quickly acquire bitcoin if you're frequently using 21 but aren't yet earning enough bitcoin by selling services.

Prerequisites

To get started you will first need to do the following:

If you've done all that, you are ready to go. Let's get started!

Step 1: Linking Your 21 and Coinbase Accounts

21 buybitcoin - Step 1

  1. Go to 21.co and log in by clicking the Login button in the top-right corner of every page. (If you're already logged in, this button does not appear; you can proceed to the next step.)

  2. Visit your profile page by clicking the icon that appears in the top-right corner of every page when you're logged in.

  3. Click on Link Coinbase button (see screenshot above). This will open an account configuration dialog.

  4. In the dialog, click the "Link My Account" button. This will load a pop-up window hosted by Coinbase.

  5. In the Coinbase popup, log into your Coinbase account.

  6. After reviewing permissions, click "Authorize" to authorize 21 to access your Coinbase account on your behalf.

If you have a payment method already set up, it will appear automatically and you can skip to step 2 to buy from the command line.

Otherwise, click Add a payment method. A popup will guide you through the steps to connect your bank account to Coinbase, after which the popup will close automatically and you will see your payment method information in the configuration.

Step 2: Buying Bitcoin from the Command Line

Now that you have your accounts linked, open up a terminal. If you use a 21 Bitcoin Computer, ssh into it:

ssh twenty@IP_ADDRESS

Check your current account status:

21 status

If you don't have a wallet, you will be prompted to create one. If you are not logged in, you will be prompted for your username in password.

Buying bitcoin from the command line is easy. Let's start by buying 500,000 satoshis:

21 buybitcoin 500000 satoshis

Purchased satoshis will be sent to your local on-chain wallet. If you have Instant Buy enabled on Coinbase, you will receive the satoshis in about 10-20 minutes (when the transaction is mined on the Bitcoin network). You can use a block explorer such as Blockchain.info to view the status of the transaction on the network.

If you do not have Instant Buy enabled, it will take up to 5 days for your satoshis to arrive in your local wallet. Check Coinbase.com for the status of your purchase.

The default denomination is satoshis, but you also specify USD or bitcoins. We recommend that you always specify the denomination so it's clear what you're buying.

## Buy five U.S. dollars worth of bitcoin
21 buybitcoin 5 USD
## Buy 0.01 bitcoins
21 buybitcoin 0.01 bitcoins

To see the current price conversion of satoshis and USD:

21 buybitcoin --price 500000 satoshis
21 buybitcoin --price 5 USD
21 buybitcoin --price 0.01 bitcoins

Note that the price shown is not guaranteed for any length of time.

To see a history of your purchases:

21 buybitcoin --history

To see the status of your 21 and Coinbase account integration:

21 buybitcoin --info

Step 3: Buying APIs

Now that you have more bitcoins, head over to the 21 Marketplace to buy APIs without requiring signup or a credit card. Then go to the 21 tutorials to learn how to build your own bitcoin-payable APIs to earn even more bitcoin.