Skip to content

You cannot add an unspendable coin #139

Open

Description

@jole95

Hi,
I have problem with second transaction. When I use first txtID everything is OK, but when I use second txtID appears "You cannot add an unspendable coin".
MY second txtID is:
8b94a5589cf0416c4e0c0b4a289d31f6db7987756e5e7653d42c3dbd60eb7b14
Nbitcoin + Qbitninja.client is awsome for me. If I found resolve, I'd be very happy :)

Thanks a lot :)

Activity

  1. veektorh commented on Jun 28, 2020

    @veektorh

    from the source code https://github.com/MetacoSA/NBitcoin/blob/master/NBitcoin/TransactionBuilder.cs
    line 857 - 866

    when you call AddCoins() method , it checks if the coin is spendable , if its not it throws an error.

    public TransactionBuilder AddCoins(IEnumerable<ICoin> coins)
    		{
    			foreach (var coin in coins)
    			{
    				if (coin.TxOut.ScriptPubKey.IsUnspendable)
    					throw new InvalidOperationException("You cannot add an unspendable coin");
    				CurrentGroup.Coins.AddOrReplace(coin.Outpoint, coin);
    			}
    			return this;
    		}
  2. NicolasDorier commented on Jul 1, 2020

    @NicolasDorier
    Collaborator

    Yeah, if you add an unspendable coin, we indeed cna't spend it and it should crash.

    What part of the book does it relate to?

  3. veektorh commented on Jul 1, 2020

    @veektorh

    @NicolasDorier this is a different question, I don't want to open an issue on it.

    is it possible for nbxplorer to generate hardened addresses for me from the derivation scheme it's tracking ?

    from what I know, you can't generate hardened address from xpub.

    I can generate the address I want myself using private keys, But since I'll be tracking using nbxplorer, I'll like to use the addresses generated from nbxplorer

    nbxplorer is currently generating address for me but it's keypath(0/0), what i want us keypath(m/84'/2'/0'/0/0).

    Thanks for your time

  4. NicolasDorier commented on Jul 18, 2020

    @NicolasDorier
    Collaborator

    No it can't. You need to derive the xpub at m/84'/2'/0' and pass that to nbxplorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions