MetacoSA / QBitNinja

An Open Source and powerful blockchain API
MIT License
68 stars 42 forks source link

:warning: This project is not maintained anymore. While https://api.qbit.ninja/ and https://tapi.qbit.ninja/ you can't expect those to work reliably. If all you want is to broadcast a transaction, use https://blockstream.info/tx/push . If you want to build on Bitcoin, please use https://github.com/dgarage/NBXplorer/ instead. This is lightweight, works on linux and do not require indexing the whole blockchain.

QBit Ninja

An Open Source and powerful blockchain API

Showcase

You can see the API documentation on api.qbit.ninja and on apiary.

You can try the API in .NET with the nuget package.

Public servers :

How to setup your own?

Pre-Requisite

In Azure, create one App resource group then you need to create:

Setup the indexer

The indexer is the application which will listener your full node and index everything into your Azure Storage. You can run it through the QBitNinja.Listener.Console project.

Assuming your Bitcoin node is fully synched,

git clone https://github.com/MetacoSA/QBitNinja/

Then edit QBitNinja.Listener.Console/App.config.

Your QBitNinja.Listener.Console app.config file should looks like.

    <appSettings>
        <add key="Azure.AccountName" value="azurestorageaccountname" />
        <add key="Azure.Key" value="azurestoragekey" />
        <add key="RPCConnectionString" value="default"/>
        <add key="Network" value="mainnet" />
        <add key="Chain" value="BTC" />
        <add key="Node" value="127.0.0.1" />
        <add key="ServiceBus" value="Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=mysecretkey" />
    </appSettings>

Example of RPCConnectionString:

Be careful:You need to compile QBitNinja in (preferably in Release mode) for the configuration to be effective, because QBitNinja will ultimately use the QBitNinja.Listener.Console.exe.config file which is in the same folder as QBitNinja.Listener.Console.exe for its configuration.

Do not forget to disable Secure transfer Required in your storage configuration.

One you have setup everything, build QBitNinja.Listener.Console in Release mode and run QBitNinja.Listener.Console.exe --init.

You can repeat the same operation on multiple machine to index faster.

Once it finished, run QBitNinja.Listener.Console.exe.

We advise you to the Windows Task Scheduler to run QBitNinja.Listener.Console.exe --Listen and bitcoind.exe automatically even when the user is not logged on or when the virtual machine reboot.

Setup the front

The front is a web application which will query your Azure Storage for blocks/transactions/balances indexed by the indexer. You can run find it in the QBitNinja project.

The easiest is deploy via Visual Studio 2017.

How to build?

Via visual studio (recommended)

Open the solution and build.

By command line

Then use msbuild.exe:

msbuild.exe /restore
msbuild.exe /p:Configuration=Release

Unity

In order for the API to work in Unity with .NET 4.6 for Android devices you should:

License

This project is released under the terms of the MIT license. See LICENSE.