Skip to content

Instantly share code, notes, and snippets.

@metacoin
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metacoin/708a624c16a98b2a1e3f to your computer and use it in GitHub Desktop.
Save metacoin/708a624c16a98b2a1e3f to your computer and use it in GitHub Desktop.
Alexandria Private Alpha INSTALL.md

Install

The Alexandria backend is distributed via binary but can also be built from source.

Binary Downloads

Coming soon.

Building Alexandria

Alexandria can and should be built from source.

Requirements

There are a couple requirements that need to be installed first.

Golang

Alexandria requires go version 1.3 or higher. The current version of go is 1.4, you can download or compile it from source here.

Setting up the go environment is straightforward; remember to set your GOPATH and try building and running a hello world program to make sure it works.

flojson

Alexandria requires flojson, a fork of conformal system's btcjson library. This is how Alexandria connects to a running florincoind (or Florincoin-qt).

To install flojson, simply use go get.

go get github.com/metacoin/flojson

foundation

Alexandria requires foundation, a simple interface that allows easy access to the RPC commands offered by flojson. It also abstracts the RPC username/password away from sourcecode/config files. The best way to pass those values into foundation is by exporting them into an environment variable. We will come back to this later.

To install foundation, simply use go get.

go get github.com/metacoin/foundation

sqlite3

Alexandria stores all block chain and protocol data in an sqlite3 database. Specifically, mattn's go-sqlite3 package is required.

To instal go-sqlite3, simply use go get.

go get github.com/mattn/go-sqlite3

sqlite3 is known to have a number of issues and bug reporting is highly encouraged. In fact, I'll offer 5,000 Florincoin for each serious issue rasied on github and 15,000 for each issue solved.

alexandria-media

Alexandria's protocol is highly modular and the protocol definition is stored within the alexandria-media package.

To install alexandria-media, simply use go get. (Are you noticing a pattern?)

go get github.com/blocktech/alexandria-media

alexandria

Alexandria's core backend engine can be installed via go get as well.

go get github.com/blocktech/alexandria

Building

Navigate to the directory containing blocktech/alexandria (it should have alexandria.go, sync and db within). You'll build Alexandria as you would any other go project:

go build -a alexandria.go

This should create a binary alexandria in the alexandria project directory.

Running Alexandria

The first step is to set up your florincoin.conf file.

For *nix users, usually this is located in ~/.florincoin/florincoin.conf.

For OSX users, you can most likely find it in ~/Library/Application\ Support/Florincoin/florincoin.conf.

For Windows users, it's in %App Data%/Romaing/Florincoin/florincoin.conf

If the file florincoin.conf doesn't exist, create it!

Make sure you've allowed RPC access from localhost, and that you're running in server mode with txindex enabled:

rpcallowip=127.0.0.1
rpcallowip=192.168.*.*
rpcport=18322
server=1
daemon=1
txindex=1

You'll want to choose the best way to get your RPC username/password into environment variables. In many cases, export will be enough, but there are more secure ways to do this:

export F_USER=florpcuser
export F_TOKEN=florpcpassword

Start up your Florincoin client (florincoind or Florincoin-qt), sync the block chain and then start up Alexandria.

go run alexandria.go

or

./alexandria

You should see something like this:

$ ./alexandria 
           _                          _      _
     /\   | |                        | |    (_)
    /  \  | | _____  ____ _ _ __   __| |_ __ _  __ _
   / /\ \ | |/ _ \ \/ / _` | '_ \ / _` | '__| |/ _` |
  / ____ \| |  __/>  < (_| | | | | (_| | |  | | (_| |
 /_/    \_\_|\___/_/\_\__,_|_| |_|\__,_|_|  |_|\__,_|

 Blocktech                                       v0.1

config: {true [127.0.0.1 <my.ip.address.here>]}
opening database ./db/sync89.db?cache=shared&mode=wrc... done!
creating tables and triggers if they don't exist...  done!
2015/05/21 11:06:45 Listening on port 41289

LOADED PROTOCOL: alexandria-media

current block chain height (rpc): 1195839
current max(block) from database: 1190910

syncing 4929 blocks between 1190911 and 1195839
first, checking past 256 blocks for reorg... 
> no reorg found!


sync at 0.00%
sync at 1.81%
sync at 3.83%
sync at 5.86%
sync at 7.89%
sync at 9.92%

The database will populate with block chain information. When it encounters any protocol data, you'll see it pop up in stdout:

sync at 48.47%
sync at 50.50%
=== NEW MULTIPART SINGLE ===
> block: 1193498  txid: 7136e5de29d73727cdb0d9acf148be0cc9c738ce7fa98ec90da3d85675fc16f2
> reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   checking multipart complete on reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   multipart incomplete: only found 1/4 multipart messages

=== NEW MULTIPART SINGLE ===
> block: 1193498  txid: 765ec366b3177f7d02485f32d1ca1388ac3eae9f779164bb8d8d6ed62e9cfa2a
> reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   checking multipart complete on reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   multipart incomplete: only found 2/4 multipart messages

=== NEW MULTIPART SINGLE ===
> block: 1193498  txid: 803933d0363591d031ca0f6eab2a92ba9d6263afaf206f68911a30fc64e30080
> reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   checking multipart complete on reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   multipart incomplete: only found 3/4 multipart messages

=== NEW MULTIPART SINGLE ===
> block: 1193498  txid: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
> reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
>   checking multipart complete on reference: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0

=== MEDIA MULTIPART COMPLETE ===
=== MEDIA MULTIPART SUCCESS! ===
> block: 1193498  reference txid: eac35e2dcffa20b19172ebb8cd99512f02e0b6266bd4804acafe5b5f705e16f0
> title: Apocalypse CA Hidden Scene

sync at 52.53%
sync at 54.55%

You can always check the sqlite3 database yourself (or use a front-end for debugging the DB if you wish, there should be many available for sqlite3).

Party

Now that you've installed alexandria and synced with the block chain, throw an awesome party!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment