using System;
using NBitcoin;
namespace RSA
{
public class RSA
{
public static Wallet KeyGenerate()
{
Key privateKey = new Key();
var v = privateKey.GetBitcoinSecret(Network.Main).GetAddress();
var address = BitcoinAddress.Create(v.ToString(), Network.Main);
return new Wallet { PublicKey = v.ToString(), PrivateKey = privateKey.GetBitcoinSecret(Network.Main).ToString() };
}
}
}
I got this kind of warning, anyone please help how to fix it?
As
Progman
says,you can useGetAddress(ScriptPublicKeyType.Legacy)
to insteadBitcoinSecret.getAddress()
.Here is the usage of GetAddress(ScriptPublicKeyType.Legacy):
In addition,if you don't want to change the method.You can use
[Obsolete]
.Here is a demo worked: Program.cs:
Result: