: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.
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 :
In Azure, create one App resource group then you need to create:
D1 v2
)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>
Azure.AccountName
and Azure.Key
are in the Azure Portal, in the settings of your Azure Storage Resource,Network
can be mainnet
, testnet
, regtest
.Chain
can be BTC
or LTC
or any chainNode
represented the P2P connection to your bitcoin node. Do not forget to whitelist the indexer in your node's settings (typically adding whitelist=127.0.0.1
in bitcoin.conf
)ServiceBus
connection string to your Service Bus Namespace (in Shared access policies
inside Azure)RPCConnectionString
optional, but needed for more reliably broadcast transactions. Example of RPCConnectionString
:
default
: Assume your are running bitcoind
locally with default settings.cookiefile=C:\path\to\.cookie
: If you run bitcoind
in a different data directory with default authentication, you need to set the path to it.server=http://127.0.0.1:29292
: If you run bitcoind
RPC on a different port than default.myuser:password
: If you run bitcoind
with rpcuser
and rpcpassword
.server=http://127.0.0.1:29292;myuser:password
: If you run bitcoind
RPC with rpcuser
and rpcpassword
, on a different port than default.server=http://127.0.0.1:29292;cookiefile=C:\path\to\.cookie
: If you run bitcoind
RPC with rpcuser
and rpcpassword
, in a different data directory with default authentication.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.
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
.
Get publish profile
Visual Studio 2017
Web.config
exactly how you set up the App.config
in the previous stepQBitNinja
project and click on Publish
.New profile...
Import Profiles
and select your downloaded publish profilePublish
Open the solution and build.
Then use msbuild.exe
:
msbuild.exe /restore
msbuild.exe /p:Configuration=Release
In order for the API to work in Unity with .NET 4.6 for Android devices you should:
QBitNinjaClient.SetCompression(false);
Because it's missing the DLL MonoPosixHelper from the buildQBitNinjaClient client = new QBitNinjaClient("http://api.qbit.ninja/", NBitcoin.Network.Main);
because HTTPS with HttpClient
seems to not work correctly.This project is released under the terms of the MIT license. See LICENSE.