JavaScript access to the blockchain


This guide introduces the FloweeJS and discusses some of its fundamental concepts.

What is FloweeJS

FloweeJS is a binding module enabling JavaScript developers to use the Flowee applications and libraries with the NodeJS JavaScript engine, which itself is based on the V8 JavaScript engine.

Flowee is a family of products and our goal is to move the world towards a Bitcoin Cash economy. FloweeJS works together with various other Flowee products for the fastest and simplest way to build Bitcoin Cash products.

The Flowee applications are designed to be cloud-native, which benefits a FloweeJS developer because it is easy to just use the free services Flowee provides. But you don’t have to fear lock-in and you can use Flowee services from a 3rd party or even have your own server.

Flowee has received donations that allow us to run a public and free service for Blockchain data on for all of 2021. The default setup of FloweeJS will connect to those services.

Getting FloweeJS

After getting a functional and recent NodeJS installation with NPM (our page, you should ensure you have the dependencies of the FloweeJS bindings. These are the cmake (version 3.13 or later) build tool and the boost libraries (version 1.56 or later).

After this you can simply run the following in your JS project: npm install floweejs

Hello World

const FloweeServices = require('floweejs');
var Flowee = new FloweeServices();

// some fun logging callbacks. = function(version) {
    console.log("The Hub reported version: " + version)
} = function(services) {
    console.log("Indexer supports services: " + services)

// Do the connect
Flowee.connect().then(function() { process.exit(); })

Flowee logLevel

The FloweeJS component has internal logging that by default is set to be silent, where only fatal errors are logged to the console. To change this you can set the log level like this;

const FloweeServices = require('floweejs');
var Flowee = new FloweeServices(); = Flowee.WarningLevel

All known log levels are:

  • Flowee.InfoLevel
  • Flowee.WarningLevel
  • Flowee.QuietLevel
  • Flowee.SilentLevel

Further reading

In most cases you want to start by connecting to the Flowee services. Details on this can be found in the connect page.

A lot of power is hidden behind the simple search() feature.

var res =[
    { // get transaction details by transaction-ID
        type: Flowee.Job.FetchTx,
        value: txid,
        txFilter: [ Flowee.IncludeInputs, Flowee.IncludeOutputs ]

You will find descriptions of the properties of the request object and its callbacks, as well as the properties of the BlockHeader return type and the Transaction object in the documentation of the search() function.

In case you have a system that creates transactions, you will like the Flowee.sendTransaction() function which takes a hex encoded string and and sends the transaction to your connected hub. A JavaScript-promise is returned.

To monitor an address, for instance for an incoming transaction, you can use the AddressMonitor family of functions. You will get an async callback from the server when new transactions are seen or mined touching that address. You even get double spend proofs.

If you are new to Bitcoin Cash in general, you may appreciate the data structures page.