Skip to content

Quickstart

1234MAX edited this page Jun 6, 2016 · 4 revisions

Quickstart

These instructions are only suited for a development setup !

If you're planning to run it in a productive environment, please see Installation in the wiki.

phpbrew (install php 5.4)

install phpbrew itself:

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew

install latest php 5.4 with minimal extensions (pdo, mysql, multibyte and PGP only required for now):

phpbrew install 5.4 +pdo +mb +mysql +gnupg +gmp

composer

install extensions needed for composer:

phpbrew ext install json
phpbrew ext install filter
phpbrew ext install hash
phpbrew ext install ctype

install composer

phpbrew install-composer

Application

clone repo from github (requires git):

git clone https://github.com/1234max/MultiVendorBitcoinMart.git
cd MultiVendorBitcoinMart

install dependencies using composer

composer install

install MySQL (add a dedicated user for MultiVendorBitcoinMart)

Init database with the database script available at http://1234max.co.uk/:

cd app/install
mysql -uroot -p < dbinit.sql; done

bitcoind

Install Bitcoind and modify the bitcoin.conf to contain at least:

rpcuser=bitcoinrpc rpcpassword=MultiVendorBitcoinMart testnet=1 blocknotify=/path/to/.phpbrew/php/php-5.4.34/bin/php /path/to/MultiVendorBitcoinMart/app/cli.php block-notify %s server=1 daemon=1 txindex=1 checkblocks=5 rpcport=28332 rpcconnect=127.0.0.1

bitcoind will now notify MultiVendorBitcoinMart for every new block seen on testnet. MultiVendorBitcoinMart stores the received transactions of the block in the database for later handling (checking for payments etc.). This handling of transactions is done by another script that should be done periodically, i.e. with cron. Insert in your crontab:

crontab -e

*/10 * * * * /path/to/.phpbrew/php/php-5.4.34/bin/php /path/to/MultiVendorBitcoinMart/app/cli.php run

Or run the script manually to check the transactions.

Now run bitcoind:

bitcoind

Configuration

Set the connection details for MySQL and bitcoind in app/config/config.php:

define('BITCOIND_URL', 'http://bitcoinrpc:yourbitcoinpassword@127.0.0.1:28332');
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'MultiVendorBitcoinMart');
define('DB_USER', 'MultiVendorBitcoinMart');
define('DB_PASS', 'your_mysql_password');

At last, you have to define the admin bitcoin BIP32 extended public key M/k'/0 (used for multi signature transactions - you can use bip32.1234max.com) and a bitcoin address, whose private key you own (used for admin auth):

php /path/to/MultiVendorBitcoinMart/app/cli.php set-admin <BIP32_Extended_Public_Key_M/k'/0> <bitcoin-address>

For example:

php /path/to/MultiVendorBitcoinMart/app/cli.php set-admin xpub661MyMwAqRbcEbqhv4d3h7Ly1yLGH7PEYfdsnyT7aHMoJo5MFZxPmSku1qDSkYSz252ZDrkNYkwAeHcY5eEGvtw2JVJqYEr1m4Key77hUSu 1Mza1rMdL84coX4JBrzrGK9c612vsswcy9

Now, you can run the server:

php -S localhost:3000

Access it with your webbrowser pointing to http://localhost:3000 or http://localhost:3000/?c=admin (admin interface) Developer notes

To debug, install xdebug and configure it for your favorite IDE:

phpbrew ext install xdebug stable

Donations are welcome at 1KF8mSUQM4MoauiaoEa9AeWfQvZYujmGHr

Please do consult, if you want to set up or have this framwork setup by us.

Please goto http://1234max.co.uk/som to contact me and an up to date version of this software !