Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM with Web3 libraries
#2
Nethereum can be used easily in C# Uiscripter. It's a new program similar to QM2, also known as QM3. In QM2 maybe possible but too hard.

1. Install C# Uiscripter and .NET 6 SDK.
2. In NuGet find a Nethereum package (I guess Nethereum.Web3) and copy its PM> text.
3. In Uiscripter open menu Tools -> NuGet, paste, optionally select or create new folder in the combobox (see comment below), click Install, click Add, close.
4. Use Nethereum in the script.

I tested code from https://nethereum.readthedocs.io/en/late...g-started/
It fails at run time, HTTP error 403 (Forbidden). I guess it is normal.

C# code:
// script "Nethereum.cs" /*/ nuget nethereum\Nethereum.Web3; /*/
using Nethereum.Web3;

namespace NethereumSample
{
    class Program
    {
        static void Main(string[] args)
        {
            GetAccountBalance().Wait();
        }

        static async Task GetAccountBalance()
        {
var web3 = new Web3("https://mainnet.infura.io/v3/7238211010344719ad14a89db874158c");
            var balance = await web3.Eth.GetBalance.SendRequestAsync("0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae");
            Console.WriteLine($"Balance in Wei: {balance.Value}");

            var etherAmount = Web3.Convert.FromWei(balance.Value);
            Console.WriteLine($"Balance in Ether: {etherAmount}");
        }
    }
}

The package consists of 20-30 files. To prevent adding so much garbage to an existing folder, I installed it into a separate folder named nethereum: in the NuGet dialog click the combobox, select New folder, enter name.


Messages In This Thread
QM with Web3 libraries - by AlexZ - 04-07-2022, 01:24 AM
RE: QM with Web3 libraries - by Gintaras - 04-07-2022, 07:53 PM
RE: QM with Web3 libraries - by AlexZ - 04-08-2022, 06:58 AM
RE: QM with Web3 libraries - by outnull - 08-03-2022, 03:44 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)