This package contains the CLI (command line interface) and reference client library for Blockstack Server. It talks to the Blockstack server and provides an interface for creating and managing names in decentralized namespaces and database tables on the blockchain.
Installing the command line interface and client library:
$ sudo apt-get update && sudo apt-get install -y python-pip python-dev libssl-dev libffi-dev
$ sudo pip install blockstack --upgrade
$ brew install libffi openssl
$ sudo pip install blockstack --upgradeWe recommend installing the CLI inside of a virtual environment, in which case you can drop the "sudo" at the beginning like so:
$ pip install blockstack --upgradeIf the installation command above fails, see the troubleshooting section.
The client is under heavy development and you may want to install the development version, which will contain certain bug fixes for issues you may be experiencing. Additionally, if you're helping with testing you should use the development version.
On Debian/Ubuntu, first install the required packages:
$ sudo apt-get update && sudo apt-get install -y python-pip python-dev libssl-dev gitNow, install the development version:
$ sudo pip install git+https://github.com/blockstack/blockstack-client.git@develop --upgrade
$ sudo pip install git+https://github.com/blockstack/registrar.git@develop --upgrade
If the installation commands fail, see the troubleshooting section.
$ blockstack
usage: blockstack [-h]
...
Blockstack cli version 0.0.12.4
positional arguments:
balance display the wallet balance
config configure --server=x --port=y --advanced=on/off
price <name> | get the cost of a name
deposit display the address with which to receive bitcoins
import display the address with which to receive names
info check server status and get details about the server
lookup <name> | get the data record for a particular name
names display the names owned by local addresses
register <name> | register a new name
transfer <name> <address> | transfer a name you own
update <name> <data> | update a name record with new data
whois <name> | get the registration record of a name
optional arguments:
-h, --help show this help message and exit$ blockstack info$ blockstack info
{
"advanced_mode": "off",
"cli_version": "0.0.12.4",
"consensus_hash": "4520fbed8459cc9fe6ef1161d683bf0b",
"last_block_processed": 399610,
"last_block_seen": 399616,
"server_alive": true,
"server_host": "server.blockstack.org",
"server_port": "6264",
"server_version": "0.0.10.3"
}$ blockstack config <options>$ blockstack config --host=server.blockstack.org --port=6264 --advanced=off
{
"message": "Updated settings for host port advanced"
}$ blockstack price <name>$ blockstack price $(whoami).id
{
"name_price": 0.001,
"total_estimated_cost": 0.00116,
"transaction_fee": 0.00016
}$ blockstack whois <name>$ blockstack whois fredwilson.id
{
"block_preordered_at": 374084,
"block_renewed_at": 374084,
"owner_address": "1F2nHEDLRJ39XxAvSxwQhJsaVzvS5RHDRM",
"owner_public_key": "0411d88aa37a0eea476a5b63ca4b1cd392ded830865824c27dacef6bde9f9bc53fa13a0926533ef4d20397207e212c2086cbe13db5470fd29616abd35326d33090",
"owner_script": "76a91499e7f97f5d2c77b4f32b4ed9ae0f0385c45aa5c788ac",
"preorder_transaction_id": "2986ec31ec957692d7f5bc58a3b02d2ac2d1a60039e9163365fc954ff51aeb5a",
"registered": true
}$ blockstack whois $(whoami)_$(date +"%m_%d").id
{
"registered": false
}$ blockstack lookup <name>$ blockstack lookup fredwilson.id
{
"data_record": {
"avatar": {
"url": "https://s3.amazonaws.com/kd4/fredwilson1"
},
"bio": "I am a VC",
...
}
$ blockstack lookup $(whoami)_$(date +"%m_%d").id
{
"error": "muneeb_02_22.id is not registered"
}$ blockstack register <name>$ blockstack register $(whoami)_$(date +"%m_%d").id
Registering muneeb_02_22.id will cost 0.0002225 BTC. Continue? (y/n): y
{
"message": "Added to registration queue. Takes several hours. You can check status at anytime.",
"success": true
}$ blockstack register fredwilson.id
{
"error": "fredwilson.id is already registered"
}$ blockstack update <name> <data>$ blockstack update $(whoami)_$(date +"%m_%d").id '{"cname": [{ "name": "@", "alias": "https://zk9.s3.amazonaws.com" }]}'
{
"message": "Added to update queue. Takes ~1 hour. You can check status at anytime.",
"success": true
}$ blockstack update fredwilson.id '{}'
{
"error": "fredwilson.id not owned by 1UGQbEV6JXEk1onBzDoNGikrCjeXenA75"
}$ blockstack transfer <name> <address>$ blockstack transfer $(whoami)_$(date +"%m_%d").id 1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt
{
"message": "Added to transfer queue. Takes ~1 hour. You can check status at anytime.",
"success": true
}$ blockstack transfer fredwilson.id 1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt
{
"error": "fredwilson.id not owned by 1UGQbEV6JXEk1onBzDoNGikrCjeXenA75"
}$ blockstack balance$ blockstack balance
{
"addresses": [
{
"address": "16yE3e928JakaXbympwSywyrJPM9cuL4wZ",
"balance": 0.008405000000000001
}
],
"total_balance": 0.008405000000000001
}$ blockstack names$ blockstack names
{
"names_owned": [],
"addresses": [
{ "address": "1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt", "names_owned": [] }
]
}$ blockstack deposit$ blockstack deposit
{
"message": "Send bitcoins to the address specified.",
"address": "1EHgqHVpA1tjn6RhaVj8bx6y5NGvBwoMNS",
}$ blockstack import$ blockstack import
{
"message": "Send the name you want to receive to the address specified.",
"address": "1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt"
}a) Error installing pycrypto
If you see the following error, while pycrpyto installs on OS X:
error: command 'cc' failed with exit status 1Try installing it with the following:
$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycryptob) Twisted error when running blockstack
If you see the following error, when you run '$ blockstack':
ImportError: Twisted requires zope.interface 3.6.0 or later.Try upgrading zope.interface:
$ pip install zope.interface --upgradeIf this doesn't solve the issue and you're trying to install Blockstack inside a virtual environment, then Twisted is likely already installed outside of the virtual environment, so exit the virtual environment and uninstall Twisted:
$ deactivate
$ sudo pip uninstall twistedNow, install blockstack in a new virtual environment.
If the issue you are experiencing is not listed here, please report it as a new issue.
The CLI by default talks to a remote server, but you can easily start your own server.
Open a new terminal window and run the following command:
$ blockstack-server start --foregroundYou can now switch the cli to use the local server:
$ blockstack config --host=localhost[More information on the Blockstack Server(http://github.com/blockstack/blockstack-server)
You can also import the blockstack client and write your own programs.
Here is some example code to get you started:
from blockstack_client import client
from blockstack_client.utils import print_result as pprint
client.session(server_host='127.0.0.1', server_port=6264)
resp = client.ping()
pprint(resp)