metacosa / qbitninja Goto Github PK
View Code? Open in Web Editor NEWAn Open Source and powerful blockchain API
License: MIT License
An Open Source and powerful blockchain API
License: MIT License
the transactions dont successfully. Pls confirm your Indexer
Hello,
Is there any way to check if data in Azure in OK?
Actually in our deployment of QBit.Ninja we have started to get some inconsistencies in the results (Our QBit.Ninja code is up to date now). For example the url "balances/38DdqhVuqb36jjmxTbvBkiFPXKA8EmW9Ly/summary?colored=true&at=446308" returns transactionCount 7385 on our deployment but 1384 on api.qbit.ninja (the 1384 seems to be the correct one) also wrong value for one of the assets (AJPMQpygd8V9UCAxwFYYHYXLHJ7dUkQJ5w). [Block 446307 is fine, 446308 is the first one with difference].
Without "colored=true" things seems to be identical, also number of differences increases as the number of block increases.
A document on data structure may also be helpful.
Thank you
It seems there is problem in handling coinbase as a colored transaction:
Works (not coinbase): http://tapi.qbit.ninja/transactions/270fb9c799a3892af05fa1722caa31e85282dd3573eae4eaf26d82019bf37ba1?colored=true
Doesn't work (coinbase): http://tapi.qbit.ninja/transactions/c844644e7be550fee5d45a2fa9fae0c884fcda07222017a3cb1d83212f5e82f2?colored=true (works without colored parameter)
It seems the Indexer method GetTransactionAsync is causing the problem.
I have automate btc sending from c# webapplication using following code. This following code works sometime but sometime not works.
If i use the transaction.tohex() and paste to https://testnet.smartbit.com.au/txs then it will transfer the btc.
Please let me know what is wrong?
I am using nbitcoin version 39. i want permanent solution. please help me. Because i want to make my code live tomorrow.
transaction.Inputs.Add(new TxIn(coin.Outpoint, masterKey.ExtKey.Derive((uint)txBalance.UserAutoId).ScriptPubKey));
// calculate what amount of bitcoin needed to be send
Money currrentBalance = new Money(currentBalanceDecimal, MoneyUnit.BTC);
Money minerFee = new Money(fee, MoneyUnit.BTC);
Money receiverAmount = new Money(amount, MoneyUnit.BTC);
Money changeBackAmount = currrentBalance - receiverAmount - minerFee;
Script receiverScriptPubKey = new BitcoinPubKeyAddress(receiverAdress).ScriptPubKey;
transaction.Outputs.Add(new TxOut
{
Value = receiverAmount,
ScriptPubKey = receiverScriptPubKey
});
if (changeBackAmount > 0)
{
transaction.Outputs.Add(new TxOut
{
Value = changeBackAmount,
ScriptPubKey = masterPubKey.Derive((uint)lastUserAutoIdTransactionChange).ScriptPubKey
});
}
// sign transaction
var keys = new List<ExtKey>();
foreach (var userAutoId in txBalanceListToUse.Select(x => x.UserAutoId).Distinct())
keys.Add(masterKey.ExtKey.Derive((uint)userAutoId));
transaction.Sign(keys.ToArray(), coinList.ToArray());
var builder = new TransactionBuilder();
NBitcoin.Policy.TransactionPolicyError[] error = null;
builder.AddCoins(coinList.ToArray());
bool verifyTransactionHash = builder.Verify(transaction, out error);
if (verifyTransactionHash == true && error.Length == 0)
{
// Broadcast your transaction to all miners
BroadcastResponse broadcastResponse = client.Broadcast(transaction).Result;
if (!broadcastResponse.Success)
throw new Exception(broadcastResponse.Error.Reason);
}
Hi, just found out about your project, very useful!
Question about the transactions function, would it be possible to include the nSequence numbers for the transaction's inputs? To determine if it's using Bitcoin's new opt-in Replace-By-Fee feature.
For example:
http://api.qbit.ninja/transactions/741cca02fbd02488277f95f004d070e852d8a716a8b13ea53398816bbc3cc39a?format=json
It would be great if the utxos that are spent by this tx (the "spentCoins" array) would each contain a "sequence" value for that particular input.
And actually... in that case, a "confirmations" number (for the originating tx) would be a very useful addition as well (with 0 meaning unconfirmed). Or perhaps a block height or hash (with 0 or null meaning unconfirmed). Because once a tx is confirmed, the RBF property doesn't really matter anymore.
But just including the "sequence" values would already be great!
Hope this helps improving your API even further :)
Hello,
While an unconfirmed transaction http://api.qbit.ninja/transactions/43eaab5060bd2ba614b1839f1e47662be267d0135a81ed3bd6535e0a605484f3 has spent an output (40feb5d2615af9261070989c4ef5bdadfe40598042b53da8f24953a3d1ac87e6 index 1) this is listed as unspent (http://api.qbit.ninja/balances/38CPJmQaWVsVka6bzEgafgZqSuJQazEjML?unspentonly=true)
Would be useful if Core's EstimateFee API call would be forwarded to QBitNinja.
Add support for webhooks to notify about address balance change
How can I create a new server for getting Users transaction, create users address? Need full information, because on google I could not get proper steps.
Hi Nic,
I am checking from last 10 days but every other day dll reflect 'One or more errors occurred.' from 4:00:42 AM to 5:30 am.
Please can you check and provide updates?
Please check there is some error on during gettransaction and all method call.
Getting one or more error. Please can you check?
When I bring in Qbit, it brings in System.Net 4.3 and fails on build. The fix is to downgrade to 4.1.1.
Add support for websockets for receiving notifications on address balance change
I couldn't make any request with QBitNinjaClient.
Does QBitNinja limit request?
Thank you.
Hello,
Seems "until" parameter is not working properly for /balances request.
If we understand correctly request:
"/balances/address/until=block num" should return only transactions for mentioned address included in blocks from tip(latest block) until block num.
Seems it is not working.
Here is example (our private blockchain). If needed we can try to find example on mainnet, but I believe example is OK.
http://52.233.192.225/balances/2MuWdziH3irz1ssYvgMbLTZAds1Rtyij3Eh?colored=true
We see here 5 transaction. Their blocks are: 37000, 37002, 37003, 37003, 37015
http://52.233.192.225/balances/2MuWdziH3irz1ssYvgMbLTZAds1Rtyij3Eh?colored=true&until=37500
Trying to get balance change transaction later then 37500 block and for some reason instead of zero we see same 5 here. Height value has top block for some reason.
Please, correct me if we understand smth wrong.
Thanks a lot in advance!
Link in blockchain.info https://blockchain.info/tx/6794b796a93f68daaba22a711425838bb9d7a36b605b1f376f8fe2f568dad431 => ok
Link in api.qbit.ninja
https://api.qbit.ninja/transactions/6794b796a93f68daaba22a711425838bb9d7a36b605b1f376f8fe2f568dad431?format=json => error
would you please help me. thank you.
No changes to our code using your lib for months and yesterday no more transactions creation succeed, the error:
"The transaction might not have been successfully broadcasted. Please check the Transaction ID in a block explorer."
Sample:
034957970ecedaa1026b7364244edf817287b349a88917ced79ee71d41011945 (fees: 16926 Satochis)
Help required asap please, critical service.
Hi, do QbitNinja support version 2? if yes then which is the stable version of Package we can use?
This shows version 2 while our all transaction shows version 1.
https://www.smartbit.com.au/tx/33cea950b1e23f4465fc005400ac0c8e53e4816a644eb30cea5aeefea12799a3
I wrote because in version 2, it shows fee double instead of version 1. Like in above example it shows 57.11 on blockchain. Then also it got confirmed.
https://blockchain.info/tx/33cea950b1e23f4465fc005400ac0c8e53e4816a644eb30cea5aeefea12799a3
Please provide more details and example for git, so it's good for us to use less satoshi as fee.
Hi Nic,
I have check the nbitcoin and may be some issue with indexing.
https://live.blockcypher.com/btc-testnet/tx/10fa6d8fa236e424c073fda72873779507b7d67b14218b6ee1c9032525b0a34d/
This transaction is shows 6+ confirmation but currently when i use following code then it was not retrieve the transaction.
IDestination userUniqueKey = masterPubKey.Derive((uint)9); (this is my wallet index)
BalanceSelector balanceSelector = new BalanceSelector(userUniqueKey.ScriptPubKey);
BalanceModel transactionHistory;
transactionHistory = client.GetBalance(balanceSelector, true).Result;
Also let me know this issue arise with live environment?
Support receiving a callback notification (http "web hook") whenever
Thanks!
Hi Nic,
some of withdrawn transaction already taken 36 hours but still not get single confirmation. IS there anything we have to do?
just an example: This is with fee of 0004
https://blockchain.info/tx/f4c94439d87eb021c49896e6def5ba8094bdd47899d85076ded6d4f32378dbe1
Also some with fee of .000975 also not get any confirmation.
I'm trying to start indexing the litecoin core node in my server with your project "QBitNinja.Listener.Console" but in the beginning get error "The node is not in a connected state". Litecoin core server is synchronized and running (litecoind.exe) and I successfully execute RPC requests (via litecoin-cli.exe). Could you tell me what I missed? Thank you!
Hello,
As I understand of what discussed in #8 , unconfirmed transactions is forgotten after some hours (6 I think). For the transaction f5b05118d0a51bcedfeae1b37dfea165f835290ce9668c276b681ed0bb6b4976 although it has been past more than a day from its submission (https://www.blocktrail.com/BTC/tx/f5b05118d0a51bcedfeae1b37dfea165f835290ce9668c276b681ed0bb6b4976) it is still available (http://web.archive.org/web/20170311122658/http://api.qbit.ninja/transactions/f5b05118d0a51bcedfeae1b37dfea165f835290ce9668c276b681ed0bb6b4976?colored=true).
Is it a problem? (This transaction seems to be related to the recent malleability attack on Bitcoin network)
Thanks
Broadcast on testnet not working.
I done broadcast, received success, but tx not broadcasted :(
Hello,
We have some reports that GetBalance function with unspentonly flag set to true, for address 38DdqhVuqb36jjmxTbvBkiFPXKA8EmW9Ly (which has large number of outputs and unspents) , sometimes generates outputs which has been spent.
As I have studied logs, the false positives are reported for transactions(tx1) which output to the address and all of these outputs are consumed in transactions (tx2, tx3) such that all tx1, tx2 and tx3 are mined in the same block (This may be also a wrong pointer).
I will update, if was able to generate the case deterministicly..
Any help appreciated.
Can it be related to unclosed #19 ?
Thanks
1- By GetBalance I mean: https://github.com/MetacoSA/QBitNinja/blob/master/QBitNinja.Client/QBitNinjaClient.cs#L263
QBitNinja should be able to return many address balances in one request.
The number could be limited for eg. 2000 items per request
We want to create docker containers hosting QBit.Ninja. But it seems we have shared resources here, like a- service bus and 2- Table storage
Is it safe to share these resources specifically the service bus?
Will we have performance increase by having multiple instances of QBit.Ninja running using the same table storage?
Thanks
Hi, I have installed Qbitninja client package in my c# project.
Now i am trying to send transaction on Testnet, but could not see those transaction using following code.
My question:
public void SendCoin(string receiverAdress, decimal amount, string message = null)
{
BitcoinSecret secretPrivateKey = masterKey.ExtKey.Derive(1).PrivateKey.GetWif(network);
var cl = new List();
Money minerFee = new Money(0.0004m, MoneyUnit.BTC);
var transaction = new Transaction();
Money currrentBalance = new Money(0, MoneyUnit.BTC);
var historyTransaction = client.GetBalance(secretPrivateKey.ScriptPubKey, true).Result;
foreach (var tx in historyTransaction.Operations)
{
currrentBalance += tx.Amount;
foreach (var coin in tx.ReceivedCoins)
{
cl.Add(coin);
transaction.Inputs.Add(new TxIn(coin.Outpoint, secretPrivateKey.ScriptPubKey));
}
}
// calculate what amount of bitcoin needed to be send
Money receiverAmount = new Money(amount, MoneyUnit.BTC);
Money changeBackAmount = currrentBalance - receiverAmount - minerFee;
// make sure you have enough money
var totalSpendAmount = amount + minerFee.ToDecimal(MoneyUnit.BTC);
if (totalSpendAmount > currrentBalance.ToDecimal(MoneyUnit.BTC))
throw new Exception("The total spend amount is greater than you have now");
// add outputs to tx
Script receiverScriptPubKey;
receiverScriptPubKey = new BitcoinPubKeyAddress(receiverAdress).ScriptPubKey;
TxOut txOut = new TxOut()
{
Value = receiverAmount,
ScriptPubKey = receiverScriptPubKey
};
TxOut changeBackTxOut = new TxOut()
{
Value = changeBackAmount,
ScriptPubKey = secretPrivateKey.ScriptPubKey
};
transaction.Outputs.Add(txOut);
transaction.Outputs.Add(changeBackTxOut);
// add message
if (!String.IsNullOrWhiteSpace(message))
{
var bytes = Encoding.UTF8.GetBytes(message);
transaction.Outputs.Add(new TxOut()
{
Value = Money.Zero,
ScriptPubKey = TxNullDataTemplate.Instance.GenerateScriptPubKey(bytes)
});
}
// Sign the transaction
transaction.Sign(secretPrivateKey, false);
// Broadcast your transaction to all miners
BroadcastResponse broadcastResponse = client.Broadcast(transaction).Result;
if (!broadcastResponse.Success)
throw new Exception(broadcastResponse.Error.Reason);
}
Hello,
I am working with Windows Server 2012 so I am not using azure services. Can I setup QbitNinja on IIS?
Also, I am trying to setup on azure but I can't find Storage resource and Azure Bus resource.
Please, could you record a video with it or write a article?
Another Issue, I downloaded the source and try build it my pc, But I got many errors.
Thanks.
Is there any way to auto calculate the fee during withdrawn transaction?
Because if i get some thing static then withdrawn take long time. so please assist.
or is there any way to get total number of byte of current transaction?
new QBitNinjaClient(NBitcoin.Litecoin.Networks,Mainnet) triggers the following error:
System.NotSupportedException: "Network not supported"
Stack trace says:
at QBitNinja.Client.QBitNinjaClient..ctor(Network network) in C:\Sources\rapidbase\QBitNinja.Client\QBitNinjaClient.cs:line 196
Hello,
Is there any limitation in Indexer or QBit.Ninja regarding blocks more than 1 MB?
I am considering the use of Bitcoin Unlimited instead Bitcoin Core in some deployments, and worrying if possible blocks more than 1 MB will cause any problems.
Thanks
I've done this three times, run init (on multiple machine with the same app.config and executable) - and then when it completes initial indexing, and I try to run "listen" on a single instance, it always throws this error. Any insight? I'm glad to provide whatever additional information I can.
Hello,
http://tapi.qbit.ninja/balances/2Mx3TZycg4XL5sQFfERBgNmg9Ma7uxowK9y/summary returns http 500 but http://tapi.qbit.ninja/balances/2Mx3TZycg4XL5sQFfERBgNmg9Ma7uxowK9y normally returns.
I transfered a amount in QbitNinja e the amount not apear in my wallet, but apear in blockchain
Transaction ID
9278239761d2c61bd165f52f7812743fa1b44e5bb01a4ebfe5a8bb1a45bff039
https://blockchain.info/tx/9278239761d2c61bd165f52f7812743fa1b44e5bb01a4ebfe5a8bb1a45bff039
I am generally hesitant to use LGPL3.0 due to the potential legal issues of static and dynamic linking, I am curious as to why QBitNinja is released using LGPL3.0, is it a matter of preference or necessity?
I done successful broadcast, but looks like, it's not working. Can you check it?
Tx hash:fdf5117b6820a39f9c022fe01609ed111ce99bf72ed92be103ed21a2f4ba266b
It would be great if the qbit /transactions/ returned colored asset information in the same manner that /wallets//balance and /balances/ do. Return color info if &colored=true
This would virtually eliminate the need for clients to use NBitcoin's expensive/exhaustive GetColoredTransaction() function at all, and save the clients from having to make dozens or hundreds of network calls to qbit /transaction to crawl the transaction chain in search of issuance txs.
Consider this code:
var qBitClient = new QBitNinjaClient(secret.Network);
var broadcastResponse = qBitClient.Broadcast(tx).Result;
broadcastResponse.Error.ErrorCode is invalid
broadcastResponse.Error.Reason is unknown
broadcastResponse.Success is true
You can test it here: https://github.com/nopara73/BlockchainProofProofOfConcept/
I'm seeing an issue in the amount field returned by tapi.qbit.ninja/balances/mnDQg9yvKQv3u88favjCfGtDhfD5tpq9wa .
In the operation with transactionId ed7bc6de74ce3c8d2e2f6d9b2ac487eacc39a03ea11f9431c4865c7ce27244e7, the amount field is negative: -1257227
This tx is consolidating a few hundred inputs into one 6000 TBTC output. The amount should be 6000 * satoshis-per-coin. Similar for the txs before and after this one. 3 consolidations: 5000, 6000, and 11528 TBTC, but none of them show the correct amount in the "amount" field of the operation.
The balance summary shows the correct total balance.
Excerpt: (spent coins edited out for brevity)
{
amount: 245755493,
confirmations: 719,
height: 407327,
blockId: "000000000003475f3410f488c7a178e103e02cecc9108be48aab6b22153bafe6",
transactionId: "8bacc5fb0eed986a95c4127a773cbad7ed48ce1172707465ca327eb15750d5bb",
receivedCoins: [
{
transactionId: "8bacc5fb0eed986a95c4127a773cbad7ed48ce1172707465ca327eb15750d5bb",
index: 0,
value: 1152800000000,
scriptPubKey: "76a91449776a3be69fa71e2d12d14d0d7d696c28fd395e88ac",
redeemScript: null
}
],
spentCoins: []
},
{
amount: -1257227,
confirmations: 719,
height: 407327,
blockId: "000000000003475f3410f488c7a178e103e02cecc9108be48aab6b22153bafe6",
transactionId: "ed7bc6de74ce3c8d2e2f6d9b2ac487eacc39a03ea11f9431c4865c7ce27244e7",
receivedCoins: [
{
transactionId: "ed7bc6de74ce3c8d2e2f6d9b2ac487eacc39a03ea11f9431c4865c7ce27244e7",
index: 0,
value: 600000000000,
scriptPubKey: "76a91449776a3be69fa71e2d12d14d0d7d696c28fd395e88ac",
redeemScript: null
}
],
spentCoins: []
},
{
amount: 4998696861,
confirmations: 719,
height: 407327,
blockId: "000000000003475f3410f488c7a178e103e02cecc9108be48aab6b22153bafe6",
transactionId: "ed7f627900ecce30dcbb681a7aaf4decaaeb2ee43cbd778640d3c10baa9a1c4a",
receivedCoins: [
{
transactionId: "ed7f627900ecce30dcbb681a7aaf4decaaeb2ee43cbd778640d3c10baa9a1c4a",
index: 0,
value: 500000000000,
scriptPubKey: "76a91449776a3be69fa71e2d12d14d0d7d696c28fd395e88ac",
redeemScript: null
}
],
What it does:
The problem is that the "Content-Length" header is copied too, which will have the original Content-Length of the data, but it MUST have the Content-Length of the encoded data.
You cannot calculate the Content-Length, because you are sending it as a stream, so the Content-Length is not known in advance.
However if the Content-Length is not known in advance you MUST use Transfer-Encoding:chunked.
In which case Content-Length is not sent, rather the length of every chunk are sent separately.
https://tools.ietf.org/html/rfc7230#section-3.3.3
If the the recipient times out before the indicated number of octets are
received, the recipient MUST consider the message to be
incomplete and close the connection.
Hello,
It seems sometimes when a transaction is sent the balances are not updated. For example consider the following transaction: http://web.archive.org/web/20160616192047/http://api.qbit.ninja/transactions/acf3e98c37513699549f4d5df8911130736e3124ade4a1b71822ff7c663ce27c?colored=true the output 5 of transaction 184ef9cb8d34d62a9878bffbd25cb4473e70033913e793a9d567801b53b621c6 is spent in the captured transaction but this output it is still reported as unspent: http://web.archive.org/web/20160616191930/http://api.qbit.ninja/balances/38DdqhVuqb36jjmxTbvBkiFPXKA8EmW9Ly?unspentonly=true&colored=true
The problem seems to gradually be corrected, when time passes, since I had issues which seems similar to this from some days ago, but now they do not exist as I am investigating now.
I use QBitNinja.Listner.Console for updating.
IS THERE ANY WAYS OF REPLACE-BY-FEE IN 39 VERSION.
so i can resend ,y unconfirmed transaction to make it faster confirmation?
Please check this error, my transactions not being propagated in the blockchain, don't returned error, asked me to verify.
Hello,
Is there any plan to support ASP.NET Core? I am asking this for hosting QBit.Ninja inside a docker container which could be run on Linux: #16 .
Thank you for your help
var getCurrentBlock = client.GetBlock(new BlockFeature(SpecialFeature.Last)).Result
This throws error one more error occur. Please can you check?
https://github.com/MetacoSA/NBitcoin.Litecoin
I tried it but transaction is always executed within Bitcoin Network not Litecoin
Hi Nic,
Please can you provide me the steps to generate own qbite ninja server. Because on github i could not get full details.
Also please can you tell me what is the downtime on Qbit public server - Main (not testnet) Indexing
I am not able to find API like http://docs.coinprism.apiary.io/#reference/blockchain-query-apis/get-all-the-addresses-holding-an-asset/get although the current API, return the colored information when required.
Are the API returning info about a specific color going to be added?
Thanks
Hi Nic,
When we used following address to transfer money it give me invalid key:
38DdjQuLgpPebLFKFysxvWAjWHi5vpH56r
3JPNA8vXjfkC1i8ZUXbRggjXi19jirxmLD
i have tried with follwing way:
BitcoinAddress bitcoinAddress = new BitcoinPubKeyAddress(address, network);
also tried with:
Script receiverScriptPubKey = new BitcoinPubKeyAddress(address).ScriptPubKey;
Please let me know what is the issue? i am using version 39.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.