Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM with Web3 libraries
#1
Hi Gintaras and QMers!!

I would like to use QM with Web3 libraries like Nethereum or any other in order to interact with smart contracts.

Gintaras, please are you so kind to give me some help?

Thanks in advance. Regards.
#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.
#3
Thank you for your help and congrats for the Uiscripter. What a nice piece of code!
#4
I'm astounded by the level of support provided here in the forums. Seriously impressive.


Forum Jump:


Users browsing this thread: 1 Guest(s)