Skip to content

angrypie/bitbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitbox is a golang library that utilize bitcoind regtest mode to create environment for testing your apps.

GoDoc

Quick start

Use example below to bootstrap your tests.

import "github.com/angrypie/bitbox"

func TestSomething(t *testing.T) {
	client := bitbox.New()
	//Start 2 bitcoind nodes connected together
	err := client.Start(2) // you should have bitcoind installed
	if err != nil {
		t.Error(err)
	}
	blocks, _ := client.BlockHeight()        // get current network block height
	client.Generate(0, 105)                  // generate first blocks, reward will go to 0 account
	address, _ := client.Address(1)          // get new address of second node
	tx, _ := client.Send(0, address, 0.0001) // send funds from first node to second
	client.Generate(0, 1)                    // generate another block to get confirmation

	log.Println(block, address, tx)
	// In real world don't forget to check errors
}

About

Test bitcoin with ease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages