Cryptoo
Set up your own bitcoin payment system the easy way(with 4 APIs).
Usage
const Cryptoo = ; // Create a cryptoo instance// Start syncing blockchain dataconst cryptoo = secret: 'sample-secret-e34dc9dff1b8b04c2b678ff7bb1dd02181bfe31b045f77'; // Get recovery phrase to backup your HD walletcryptoo; // Generate address to receive coins(shoud be recorded for looking up later)cryptoo; // Fires when an unconfirmed transaction is received to your addresscryptoo; // Fires when a transaction to your address has one confirmationcryptoo;
Configuration
// default 'main', can also be 'testnet' network: 'main' // default '~/.bcoin', where to store blockchain and wallet data chainDataFolder: '~/.bcoin' // default: null, secret is used to protect your wallet api, so that if you open port 8332 accedently, other people wll not be able to access you wallet secret: 'v8ZgxMBicQKsPd1jmUQY2WBfrmK4tVMfAiSCh6xZXVMcNoDoyjLDRKe' // default: false, wether to show bcoin log in console, useful for debuging logBcoinLogInConsole: false;
Real-life examples
- Cryptoo landing page with bitcoin donation; [source code]
- TO BE ADDED
How does cryptoo work
All the major functionlites of Cryptoo is provided by bcoin, Cryptoo is a simple wrapper over bcoin, exposing necessary apis to provide an easier api interface for user to build a payment system. It's about 160 lines of code.
Bcoin is able to start and mantain bitcoin SPV node(light weight node) and also HD wallet(able to derive unlimited addresses from a seed key(recovery phrase))
When Cryptoo
instance is created, it will start an SPV node and prepare an HD wallet for you.
Depend on your network enviroment, it might take one to severial hours to sync the blockchain data, the blockchain data and wallet info will be stored in chainDataFolder
you configure.
About Security
- Close 8332 port: for now cryptoo is a wrapper on bcoin, and bcoin will start an http server listening on this port for accessing wallet data, it's recommand to disable 8332 port for external access.
- Define a complex api-key: if you are not able to close 8332 port, you should define a complex api-key
Access your bitcoins
As the wallet provided is an HD wallet, once you get the recovery phrase by invoking the getRecoveryPhrase()
API. You can access you wallet by importing it to any wallet support bip44
Recommend HD wallets
Roadmap
- cryptoo-eth
Useful tools
- faucet testnet bitcoin: http://bitcoinfaucet.uo1.net/send.php