Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

QBitNinja adapt for NBitcoin.Altcoins #67

Open
darkfriend77 opened this issue Aug 3, 2018 · 6 comments
Open

QBitNinja adapt for NBitcoin.Altcoins #67

darkfriend77 opened this issue Aug 3, 2018 · 6 comments

Comments

@darkfriend77
Copy link

I would like to adapt QBitNinja to NBitcoinAltcoins.

Can you help with a round up where I shall start and what the important steps are?

@NicolasDorier
Copy link
Contributor

Well I don't think you need to much but important NBitcoin.Altcoins to QBitNinja and make sure you get the right Network instance in the code.

@bilalafzal345g
Copy link

I am trying to do the same but no luck.

I have tried to connect the Qbitninja with local node For Litecoin But nothing is working.

@bilalafzal345g
Copy link

public void MssGetBalance(string ssAddress, bool ssIsUnspentOnly, out decimal ssBalance, out decimal ssConfirmedBalance)
{
Network network = NBitcoin.Altcoins.Litecoin.Instance.Testnet;

        QBitNinjaClient client = new QBitNinjaClient("http://127.0.0.1:19332/", network);
        var balance = client.GetBalance(new BitcoinPubKeyAddress(ssAddress,network)).Result;
        ssBalance = 0.0M;
        ssConfirmedBalance = 0.0M;
        if (balance.Operations.Count > 0)
        {
            var unspentCoins = new List<Coin>();
            var unspentCoinsConfirmed = new List<Coin>();
            foreach (var operation in balance.Operations)
            {
                unspentCoins.AddRange(operation.ReceivedCoins.Select(coin => coin as Coin));
                if (operation.Confirmations > 0)
                    unspentCoinsConfirmed.AddRange(operation.ReceivedCoins.Select(coin => coin as Coin));
            }
            ssBalance = unspentCoins.Sum(x => x.Amount.ToDecimal(MoneyUnit.BTC));
            ssConfirmedBalance = unspentCoinsConfirmed.Sum(x => x.Amount.ToDecimal(MoneyUnit.BTC));
        }
    }

@NicolasDorier
Copy link
Contributor

Sorry I can't help you hosting your own QBitNinja server. Look the README I improved it this week.

@bilalafzal345g
Copy link

bilalafzal345g commented Aug 8, 2018 via email

@NicolasDorier
Copy link
Contributor

If your goal is to make a wallet, just use a full node with https://github.com/dgarage/NBXplorer . This is way more lightweight that qbit and support litecoin.

Read https://programmingblockchain.gitbooks.io/programmingblockchain/content/wallet/web-api.html for example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants