<p>I'm trying to build a transaction using Nbitcoin. When I run this line there is an error parsing the address. It runs fine with segwit addresses starting with a 1, but not native segwit.</p>
<pre><code>Using System;
Using System.Text;
Using NBitcoin;

static void Main(string[] args) {

    var wallet = new BitcoinPubKeyAddress(&quot;bc1q....&quot;, Network.Main); //throws error
}
</code></pre>
<p><strong>Error:</strong> System.FormatException: 'Invalid base58 data'</p>
<p>Is there a way to use native segwit with Nbitcoin? Thanks</p>

<address><segregated-witness><c#><nbitcoin>
Nbitcoin's BitcoinPubKeyAddress not recognizing native segwit addresses
Chiru
# Nbitcoin's BitcoinPubKeyAddress not recognizing native segwit addresses

(Asked by: username_0 on 2021-04-15)

I'm trying to build a transaction using Nbitcoin. When I run this line there is an error parsing the address. It runs fine with segwit addresses starting with a 1, but not native segwit.
Using System;
Using System.Text;
Using NBitcoin;

static void Main(string[] args) {

    var wallet = new BitcoinPubKeyAddress("bc1q....", Network.Main); //throws error
}

Error: System.FormatException: 'Invalid base58 data'
Is there a way to use native segwit with Nbitcoin? Thanks

**Tags:** address, segregated-witness, c#, nbitcoin


---

## 0 answers

