Skip to content

[Tutorial] Getting Started

Xenland edited this page Mar 16, 2013 · 15 revisions

Welcome to the BDK Getting Started page

Intro

To get started copy the library folder in a path where the target website PHP files can load the library from(for example /var/www/bdk/). Be sure to just include the file named BDKp_library.php and the library will include the config.php file on its own. Once you have successfully included the BDK library into your project you may now configure it to connect with the Bitcoin client.

Make sure that your Bitcoin client is set to server mode and accepting your local ip address

Make sure that your Bitcoin client runs with -checklevel=6 to ensure the block chain is always 6 confirmations verified locally.

BDK Configuration

To begin to configure BDK you must open up the file named config.php
You must set the following variables for all BDK functions to run properly, below the variables are notes and sometimes example values.

###$btcclient["https"]

http

https (Recommended)

###$btcclient["host"]
Notes: Just the domain name or ip address; Don't put Http:// or https:// that is already taken care of.

127.0.0.1

###$btcclient["user"]
*Notes: The user name to connect to Bitcoin client

###$btcclient["pass"]
*Notes: The password to connect to Bitcoin client

###$btcclient["port"]
*Notes: The port to connect to Bitcoin client

###$bdk_integrity_check *Notes: Generate a random string that is at least 4096 characters long and set that random string for this variable.

##Programming Guidelines ###Use integers for math & calculations, Use decimals for display and NEVER for math. The BDK functions will always require financial values to be passed by an integer type instead of decimals this is a standard measure to encourage the development of your program outside of BDK library to do math in integers(1 Satoshi or also known as 0.00000001 Bitcoins in integer value).

The reasoning is that computers don't calculate "decimals" very well and could lead some calculations causing developers losing track of Bitcoins(or in some cases even add Bitcoins that shouldn't exist there) and virtually impossible to figure out where the fault happened, however they compute integers just perfectly so we force those instead.