I'm using the NBitcoin library, I would like to add a bitcoin address to a Key object:
This is the Key class definition:
I started out asigning the decoder to a byte array:
Then converted it to hex:
And finally printed that out: Console.WriteLine(hex); It seems to be printing out the hash correctly.
Then I create a HashSet:
Call the constructor of the class like this:
And add key to the HashSet:
But
I really have no idea how to fix this.
Any suggestions , please?
This is the Key class definition:
C#:
namespace NBitcoin
{
public class Key : IDestination, IDisposable, IBitcoinSerializable
{
public Key(byte[] data, int count = -1, bool fCompressedIn = true);
C#:
byte[] byteArray = Encoders.Base58.DecodeData("15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe");
C#:
string hex = Encoders.Hex.EncodeData(byteArray);
Then I create a HashSet:
C#:
var keys = new HashSet<Key>();
C#:
var key = new Key(byteArray, -1, true); (according to the constructor signature)
C#:
keys.Add(key);
var key = new Key(byteArray, -1, true);
is thowing an error: "the size of an ec key should be 32"I really have no idea how to fix this.
Any suggestions , please?
Last edited by a moderator: