Generating Bitcoin addresses from a xpubkey

0 votes

I want to generate bitcoin address from a known xpubkey. The key I am using is here: https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

I am using the following code but when I execute it, get a 'Invalid point encoding 103' when I try to instantiate the ExtPubKey.

The code:

var pubkey = new ExtPubKey(Encoding.ASCII.GetBytes("6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz"));

        Console.Writeline(pubkey.Derive(0).Derive(0).Derive(0).PubKey.GetAddress(Network.Main));
Aug 21, 2018 in Blockchain by digger
• 27,620 points
59 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Via https://bitcointalk.org/index.php?topic=1242247.0

var pubkey = ExtPubKey.Parse("xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz");
var newAddress = pubkey.Derive(0).Derive(0).PubKey.GetAddress(Network.Main);
Console.WriteLine(newAddress);

It works and gives expected results.

answered Aug 21, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

Is there a way to send funds from a specific bitcoin address in a wallet?

I'll answer my own question, It was unbelievably ...READ MORE

answered Sep 3, 2018 in Blockchain by Perry
• 16,450 points
40 views
0 votes
1 answer
+1 vote
1 answer
+1 vote
2 answers

What if a bitcoin clients could create identical private keys?

If this happens, then Person B will ...READ MORE

answered Aug 28, 2018 in Blockchain by Evan
17 views
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points
41 views
+1 vote
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.