griffo-io / tron.net

GNU Lesser General Public License v3.0
40 stars 11 forks source link

Tron.Net.Crypto.ECKey exception #1

Open otakuinny opened 6 years ago

otakuinny commented 6 years ago

Hello. I installed the Tron.Net.Client library from the following URL https://www.nuget.org/packages/Tron.Net.Client

The following line is throwing an error. Tron.Net.Client.WalletAddress newAddress = Tron.Net.Client.WalletAddress.MainNetWalletAddress();

Error: The type initializer for ‘Tron.Net.Crypto.ECKey’ threw an exception. at Tron.Net.Crypto.ECKey..ctor() at Tron.Net.Client.WalletAddress.MainNetWalletAddress(ECKey key) at TelegramBot.TRON.TRON.TestTRON() in ………

Also, the lib BouncyCastle.Crypto wasn't included in the above nuget pakage.

Thanks for your help.

dariogriffo commented 6 years ago

Which framework are you targeting?

dariogriffo commented 6 years ago

I have tried creating a new WalletAddress with a .net core and .net 4.7.1 framework This is the code

Tron.Net.Client.WalletAddress newAddress = Tron.Net.Client.WalletAddress.MainNetWalletAddress();
Console.WriteLine(newAddress.IsMainNet);

All the dependencies where correctly installed in both projects, from command line:

install-package Tron.Net.Client
otakuinny commented 6 years ago

Hello. My project is targeting .Net 4.5 Framework. I first installed the Tron.Net.Protocol from the following NuGet command Install-Package Tron.Net.Protocol -Version 1.2.2

And then Tron.Net.Client from the following NuGet command Install-Package Tron.Net.Client -Version 0.6.3

I could use all the other methods just fine. Only the following code is giving me trouble Tron.Net.Client.WalletAddress newAddress = Tron.Net.Client.WalletAddress.MainNetWalletAddress(); Console.WriteLine(Tron.Net.Common.Utils.ToHexString(newAddress.Value));

otakuinny commented 6 years ago

Hello. I changed my project target to 4.7.1 and I'm still receiving the following error. Tron.Net.Client.WalletAddress newAddress = Tron.Net.Client.WalletAddress.MainNetWalletAddress(); Console.WriteLine(Tron.Net.Common.Utils.ToHexString(newAddress.Value));

Error: The type initializer for ‘Tron.Net.Crypto.ECKey’ threw an exception. at Tron.Net.Crypto.ECKey..ctor() at Tron.Net.Client.WalletAddress.MainNetWalletAddress(ECKey key) at TelegramBot.TRON.TRON.TestTRON() in ………

otakuinny commented 6 years ago

I've tried with several .net frameworks starting at .net4.5 all the way to .net 4.7.2. It is the same error Tron.Net.Client.WalletAddress newAddress = Tron.Net.Client.WalletAddress.MainNetWalletAddress(); Console.WriteLine(Tron.Net.Common.Utils.ToHexString(newAddress.Value));

Error: The type initializer for ‘Tron.Net.Crypto.ECKey’ threw an exception. at Tron.Net.Crypto.ECKey..ctor() at Tron.Net.Client.WalletAddress.MainNetWalletAddress(ECKey key) at TelegramBot.TRON.TRON.TestTRON() in ………

otakuinny commented 6 years ago

Here are the references. The target framework is 4.7.1 untitled

mojtaban12 commented 4 years ago

hi i'm using .net core3.1 WalletAddress address = Tron.Net.Client.WalletAddress.MainNetWalletAddress(); string privateKey = Tron.Net.Common.Utils.ToHexString(address.Value); and then ! FileNotFoundException: Could not load file or assembly 'Tron.Net.Crypto, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.