>> (p.1)
    Author Topic: Subvertx Ubuntu packages (Oneiric Ocelot only)  (Read 2138 times)
    genjix (OP)
    Legendary
    *
    Offline Offline

    Activity: 1232
    Merit: 1082


    View Profile
    November 06, 2011, 12:52:22 AM
    Last edit: November 06, 2011, 02:46:03 PM by genjix
     #1

    Main thread: https://bt.irlbtc.com/view/50721.0
    Leave your comments there.

    These are a simple set of utilities for working with the bitcoin network/protocol. Together you can use them as a 'flyweight' client. I like small sets of inter-working programs because it is the UNIX philosophy about building small bricks which you can piece together to create a set of highly configurable inter-locking mechanism of programs and daemons.

    This is a proof of concept built off of the work-in-progress libbitcoin.

    Subvertx is a suite of 4 tools:
    - poller, downloads the blockchain from a bitcoind into a PostgreSQL database.
    - balance, queries the PostgreSQL database downloaded with poller to find the balance of a bitcoin address.
    - priv, create a new private key, sign data, verify data or show the bitcoin address of that key.
    - mktx, connects to a bitcoind and sends some money from an output to a new address. You can use this in conjunction with a site like blockexplorer.com as a tool to make transactions very simply.

    Show help:
    Code:
    genjix@random:~/subvertx$ priv
    Usage: priv [COMMAND] [ARGS]...

    The priv commands are:
      new Generate a new private key and output to STDOUT
      sign Sign the next argument using the private key in STDIN
      verify Verify the next argument using the private key in STDIN
      address show the associated bitcoin address

    genjix@random:~/subvertx$ mktx
    Usage: mktx [HOST[:PORT]] [OUTPUT] [ADDRESS] [AMOUNT]

    OUTPUT consists of a transaction hash and output index
      125d49f6b826c564ea99345c56286de4b5126e3da38691caa4ccc68c8c8118d5:1
    AMOUNT uses internal bitcoin values
      0.1 BTC = 0.1 * 10^8 = 1000000

    genjix:~$ poller
    poller [DBNAME] [DBUSER] [DBPASSWORD] [HOST:PORT] ...

    genjix:~$ balance
    Usage: balance [BACKEND] [ADDRESS]

    BACKEND consists of a colon separated list of parameters.
      postgresql:database:username:password

    Make a new private key, sign and verify a transaction hash:
    Code:
    genjix@random:~/subvertx$ priv new >tmp/private_key
    genjix@random:~/subvertx$ priv sign f5cffc95a4a83c23cb9f666c7cf552f27d9845778bb09a98d5169c461483ba41 <tmp/private_key > signed_data
    genjix@random:~/subvertx$ priv verify f5cffc95a4a83c23cb9f666c7cf552f27d9845778bb09a98d5169c461483ba41 "`cat signed_data`" <tmp/private_key
    1

    Show your bitcoin address:
    Code:
    genjix@random:~/subvertx$ priv address <tmp/private_key
    14DDgj2r8WQEwfTDEjJFBn3wRnHmXzgB3z

    To send some bitcoins, you need to send some bitcoins to the address you generated above (in our case 14DDgj2r8WQEwfTDEjJFBn3wRnHmXzgB3z). Then you need to search the transaction on blockexplorer and find which output it got sent to.

    In our case, the bitcoins we sent went to transaction 125d49f6b826c564ea99345c56286de4b5126e3da38691caa4ccc68c8c8118d5 (the hash) and output 1.

    Our destination address will be: 14UZVX5q1EcE4aT5k1c3eqw3oNUiCN3T23

    The amount of bitcoins to send is specified in the bitcoin internal format (which is amount * 10^8):
    0.01 BTC = 100 0000

    It will then connect to the bitcoind on localhost:8333 and send it the transaction, which will be propagated throughout the network.

    Code:
    genjix@random:~/subvertx$ mktx localhost 125d49f6b826c564ea99345c56286de4b5126e3da38691caa4ccc68c8c8118d5:1 14UZVX5q1EcE4aT5k1c3eqw3oNUiCN3T23 1000000 <tmp/private_key
    1 peers connected.
    s: version (85 bytes)
    r: version (85 bytes)
    s: verack (0 bytes)
    r: verack (0 bytes)
    Connected
    s: tx (225 bytes)
    20 5b f8 0b 8e 5a 54 5d 1f 10 5d 8b 72 e5 ff fd e8 c6 fb e7 b9 b3 ac 4d 8f 8d f5 9b 26 58 82 12

    Those numbers are the transaction hash which can be looked up on blockexplorer.

    poller

    To use the poller you first need to import the schema which can be downloaded from here (a pre-downloaded blockchain is here).

    Code:
    # do all the postgres stuff to make a new database
    $ sudo su postgres
    # createuser genjix
    ...
    # psql
    > CREATE DATABASE bitcoin;
    > quit
    # exit

    $ wget http://libbitcoin.org/bitcoin.sql
    $ psql bitcoin < bitcoin.sql

    # it is a good idea to run this in screen
    $ screen -S poller
    $ poller bitcoin genjix psqlpassword localhost
    ... starts downloading the blockchain into postgresql
    # now close the terminal. You can re-open the terminal with screen -x poller

    Poller is doing full blockchain validation. It will take a long time since it's an SQL database and it's validating all the blocks.

    Balance needs the full blockchain otherwise you might not get an up-to-date balance reported back. It's fairly simple to use:
    Code:
    $ balance postgresql:database:username:password 1jkjsjkdskjb2kkjbkjdsk

    Ubuntu packages

    The PPA can be viewed on launchpad.

    Add these 2 lines to the end of youretc/apt/sources.list
    Code:
    deb http://ppa.launchpad.net/genjix/libbitcoin/ubuntu oneiric main
    deb-src http://ppa.launchpad.net/genjix/libbitcoin/ubuntu oneiric main

    Code:
    $ wget -q "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4F8AE60DB3FC740E" -O- | sudo apt-key add -
    $ sudo apt-get update
    $ sudo apt-get install subvertx

    This PPA also has a package for libbitcoin-dev although the API is undocumented at the moment. Grin

    Kamil Domański is working on an gentoo ebuild which should be ready tomorrow.

    Source code for the non-Ubuntu paupers:
    https://gitorious.org/libbitcoin/libbitcoin
    https://gitorious.org/libbitcoin/subvertx

    I can't stress enough for people to use this at their own peril as it's alpha software.

    Thanks goes to,

    Kamil Domański (kdomanski)
    Jan Engelhardt (se7) <jengelh@medozas.de>
    Patrick Strateman (phantomcircuit)
    Denis Roio (jaromil)
    Amir Taaki (genjix) <genjix@riseup.net>
Page 1
Viewing Page: 1