Skip to main content

Questions tagged [c#]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
63 views

Decode "pending transactions" from socket without calling RPC for every transaction?

Initial goal: catch transactions from address (when address calls "swap" events or "addliquidity" events, or does transfer on PancakeSwap router). I want to catch that kind of ...
Danik Logan's user avatar
0 votes
0 answers
61 views

PancakeSwapV2 router "getAmountsOut" function returns wrong value

I'm struggling with "getAmountsOut" function, which works kinda fine for BNB/CAKE or CAKE/BNB. But it in some cases it just returns straight wrong values. Code: public async Task<decimal&...
Danik Logan's user avatar
1 vote
2 answers
193 views

Nethereum: any pancakeswap contract function call results in "execution_reverted", all transactions fail with same error

I'm completely new to web3, and I do realise that there is small portion of information on the web3 for developers, especially when it comes to debugging and issue solving. My main goal is just to ...
Danik Logan's user avatar
1 vote
1 answer
31 views

Async call to GetBlockWithTransactionsByNumber frequently returns 'NULL' block (Nethereum)

Calling GetBlockWithTransactionsByNumber asynchronoulsy from within a ProcessorForContract frequently returns NULLs. If I execute the following: HexBigInteger blockNumber = new HexBigInteger(sl.Log....
Kodo's user avatar
  • 111
0 votes
1 answer
82 views

Nethereum External Signer (C#) extending EthExternalSignerBase issue with SignExternallyAsync

I am currently having issues extending EthExternalSignerBase. I have an API that signs messages, similar to an Amazon KMS. One of the issues I am running into is deriving the ECDSASignature response, ...
k9b's user avatar
  • 103
1 vote
0 answers
27 views

Nethereum listen to an event after send transaction

Solidity code for creating a new contract calling createRainfallPolicy: event PolicyCreated(address _policy, string _insuredId); function createRainfallPolicy(/*Params*/) public { RainfallPolicy ...
Farceg's user avatar
  • 11
2 votes
1 answer
98 views

Metamask Unity Plugin shows different Ethereum amount for user confirmation on Metamask mobile wallet than that requested by Unity

I am integrating the MetaMask Unity Plugin given here: https://assetstore.unity.com/packages/decentralization/infrastructure/metamask-246786 and followed the docs provided here: https://c0f4f41c-2f55-...
Naruto Ujumaki's user avatar
1 vote
1 answer
278 views

What's the best way to verify an address is correct in C#?

Is there an easy way to validate an Ethereum address in C#? Basically, I am looking for the method that correspond to these ones in Javascript but in C#.
Falcon Stakepool's user avatar
0 votes
1 answer
609 views

How to validate signed message from backend C# application

I'm new to blockchain development and looking for some directions. I have an existing single page application that uses Metamask to login (i.e. sign a custom message). The APP needs to call an API (...
Roberto Lambertini's user avatar
1 vote
2 answers
905 views

I need to know gas price C# Nethereum

How can I get current gas price? I want to calculate the gas fee per transaction. I need to multiply Gas Price by _estimatedGas. I looked at the Gas price on https://bscscan.com/ it's 5 Gwei. Can I ...
Oleg's user avatar
  • 11
2 votes
0 answers
87 views

Convert FunctionMessage into ABI string using Nethereum

I want to convert FunctionMessage objects into ABI. Is there any function in Nethereum library to do this work or should I do it using reflection ? code example: [Function("balanceOf", "...
user19291301's user avatar
0 votes
1 answer
482 views

TimeOut excpetion on websocket using Nethereum

I'm working on a frontrunning bot using Nethereum. the problem I'm facing is the following, once I get all the pending transaction hashes through the websocket, I pass the hash trhough ...
ramy ben haj yahia's user avatar
0 votes
0 answers
180 views

Problem returning tokenURI(string) from contract

I'm trying to return information from a contract, most specifically the tokenURI. My problem is that I cannot visualize the result... it seems to be empty when it was supposed to be a string. I must ...
SergioAAV's user avatar
1 vote
0 answers
49 views

How to send contract using web3gl

I tried to send contract from web3gl to BUSD. But I am not sure how to pass arguments and value. Please give me some help. // smart contract method to call string method = "transfer"; ...
Daniella's user avatar
0 votes
1 answer
1k views

Signature always 132 characters instead of 65 characters

I am stumped. I am trying to create a signature using ECSDA / keccak256. In Solidity the recover method requires 65 characters. My signatures from my integrating code (.net C#). I don't know what is ...
0xElGato's user avatar
  • 111
2 votes
1 answer
650 views

How to listen to smart contract emitted events using C#

I have to add/update some data in a database when specific events are emitted by a solidity smart contract. When using web3.js there is a simple method called watch(), but I didn't find anything like ...
Angelo Schuler Piletti's user avatar
1 vote
0 answers
501 views

How generate private keys from 12 words programmatically in C#

So metamask allows the recovery of all your accounts (addresses) using a 12 word phrase. How can convert a 12 word phrase into the public/private key pairs without using metamask?
CathalMF's user avatar
  • 273
1 vote
0 answers
127 views

Result of getting information from ethereum is null

I am writing a simple smart contract using Nethereum using this solidity code: pragma solidity >=0.4.0 <0.7.0; contract SimpleStorage { uint storedData; function set(uint x) public { ...
Karyna Dorosh's user avatar
1 vote
1 answer
2k views

Get ERC20 balance of token holder as of block number with C# Nethereum and Infura

When this code runs, it throws an error "RpcResponseException: header not found", and I don't understand why or how to fix it. Any advice? Notes: I am using Nethereum in C#.net and using ...
Gero's user avatar
  • 83
2 votes
2 answers
916 views

EcRecover signed message does not match PublicAddress

I am trying to create a C# webservice back end API that handles the code logic found in Step #5 here: https://www.toptal.com/ethereum/one-click-login-flows-a-metamask-tutorial Their code looks like ...
Gero's user avatar
  • 83
1 vote
1 answer
504 views

Nethereum C# FilterInput.GetAllChanges always empty

I use Nethereum in my project to get all pending transactions on a specific smartcontract address. To do that based on the existing docs and Nethereum playground I try the following: private async ...
ExaltedOil's user avatar
0 votes
1 answer
458 views

Unlock Ethereum account via infura

I am trying to connect my wallet (Metamask) via Infura, but I receiving an error. My code: [HttpPost] public async Task<IActionResult> LoginAsync([ModelBinder(typeof(AccountBinder))] ...
חיים חדד's user avatar
1 vote
1 answer
1k views

using account create in metamask with Nethereum

Can I use an account created in metamask using nethereum? I tried this: var abi = @""; var addressContract = ""; var myAddress = "xxxxx"; var password = "password&...
Jose Ramos's user avatar
0 votes
1 answer
1k views

i'm creating new account and when i get the balance for that account it returns 0 and cant do any transaction saying dont have enough funds

How to load funds/ether into newly created account. I'm using Ganache and Web3js var web3 = new Web3("HTTP://localhost:7545"); var privateAccount = await web3.Personal....
Muhammad Hussain Rana's user avatar
3 votes
1 answer
5k views

How to call a contract function using Nethereum?

I would like to call a contract function using Nethereum C#. Here is the contract in Etherscan (https://etherscan.io/token/0x8c9b261faef3b3c2e64ab5e58e04615f8c788099#readContract) I want to call ...
Tiago Ávila's user avatar
2 votes
1 answer
658 views

Programmatically send ERC20 tokens to user wallet. How does transfer work?

I have been researching how to securely send and transfer ERC20 tokens from the contract address to a new user wallet. Tokens will be earned through participation on my platform. Based on results I ...
CR41G14's user avatar
  • 139
1 vote
1 answer
2k views

Create account on Ethereum using Nethereum C#

I have studied the documents for creating a new account using Nethereum.. var ecKey = Nethereum.Signer.EthECKey.GenerateKey(); var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex(); var account = new ...
CR41G14's user avatar
  • 139
1 vote
0 answers
151 views

How to Connect IPFS client in xamarin forms.?

i need to start ipfs client in My xamarin forms app.Now with the emulator it is working but when it comes to device i don't know how to connect.?I want to connection for both platform(ios and android)....
Mosin Pathan's user avatar
0 votes
1 answer
29 views

unable to connect to TestChain by Code

I am new at Ethereum and intended to connect to a test chain by c#. my code runs greatly on my old laptop win7, but on newer one Win10 it just waits forever. this is my code. has anyone any idea? ...
Azzurro94's user avatar
  • 123
0 votes
2 answers
708 views

What is the max ethereum allowed in a private network for the whole network?

When I build a private chain setup, what is the maximum Geth ethereum I can have for the life of the network. Another way of asking the question would be: What is the maximum ethereum one account can ...
Mr. B's user avatar
  • 103
4 votes
1 answer
1k views

passing byte[] to smart contract using nethereum

I made a solidity function that allow a user to send multiple transactions with the same nonce as a singleton Tx signer: function multipleTransferPreSigned ( bytes[] _signature, address[] ...
Hadar Keidar's user avatar
0 votes
1 answer
300 views

Command "geth --rpcapi eth,web3,personal --rpc" throws Fatal Error

After deploying an private Ethereum blockchain with Azure Template "Proof of Work" we are not able to run the following command successfully. "geth --rpcapi eth,web3,personal --rpc" following image ...
Benito J's user avatar
1 vote
1 answer
2k views

(C#) Sending custom ERC20 tokens

I have the following code var transactionMessage = new TransferFunction { FromAddress = accountFrom, To = accountTo, AmountToSend = tokens, Gas ...
Peter Chikov's user avatar
1 vote
0 answers
219 views

How would I connect subscribe to the websocket to get transactions of a certain address with Nethereum(C#)?

I can only find tutorials on how to do it with Web3.JS. With Infura btw (wss://mainnet.infura.io:443/ws)
p0isoN's user avatar
  • 11
1 vote
0 answers
2k views

Nethereum C# automated ether transfer

I wish to automate the transfer of ether to a list of people. Assume the list is in a csv. I wrote some code to automate the process. class Program { int nonce = 0; static void Main(string[] ...
Skyuppercut's user avatar
1 vote
1 answer
2k views

Nethereum // Infura/RPCclients

I am having a heck of a time getting transactions to post on mainnet. The issue is not my wallet balance or gas related. A balance lookup on the same contract works correctly.. However, i cannot get ...
Cody Popham's user avatar
0 votes
1 answer
386 views

Is it good approach to interact with smart contract using c# library instead of Web3-js?

I'm learning Ethereum, and having web application development experience mostly with Microsoft Technologies such as ASP.NET MVC and WebAPI. I've learned Solidity recently!. After reading about ...
Hina's user avatar
  • 265
1 vote
1 answer
2k views

Nethereum contract function call throwing exception on return: hex string has length 64, want 40 for common.Address

Both a call returning and address and a call returning an int256 fail with the same error: Nethereum.JsonRpc.Client.RpcResponseException HResult=0x80131500 Message=invalid argument 0: hex string ...
Les's user avatar
  • 21
1 vote
1 answer
717 views

Visual Studio using C# cannot find web3.Miner.Start.SendRequestAsync

The active using statements of the code are: using System; using System.Threading; using System.Threading.Tasks; using System.IO; using Nethereum.Web3; using Nethereum.Web3.Accounts; using Nethereum....
Les's user avatar
  • 21
0 votes
1 answer
362 views

What is the Nethereum analog of "web3.version.network"?

I am just getting started with Nethereum and I want to ensure I am connected to the correct network.
djp's user avatar
  • 111
0 votes
1 answer
1k views

Create hash in c# and validate in solidity

I'm trying to build an app that will call a contract from javascript. I want the contract to validate that the parameters weren't tampered with. In order to do that, my plan was to figure out the ...
Luke Schoen's user avatar
1 vote
1 answer
1k views

C# - Convert Ethereum ABI Address To String (Solidity)

I'm new to Ethereum so please excuse my ignorance. Ethereum seems to have an ABI serialization protocol called Solidity. The spec is here: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI ...
Christian Findlay's user avatar
6 votes
1 answer
3k views

how to call smart contract function in C#.net core

protected async void Page_Load(object sender, EventArgs e) { var senderAddress = "0x605a1f8d368cbdd4d0a5cbad74f75c428660f17b"; var password = "zxcasdqwe123"; ...
Sandeep Gupta's user avatar
1 vote
1 answer
946 views

How to check if a transaction has completed correctly or has been rejected by some assert check [duplicate]

We have developed a simple Smart Contract which offers this following public transaction method: function bid(uint256 _userCode, uint256 _amount) public { assert(_userCode> 0); ...
systempuntoout's user avatar
0 votes
1 answer
139 views

Ethereum keystrore file is not created

Keystore file is not created when I am creating a new Ethereum wallet account using nethereum and UWP. Also the newly created account is not in the private net. The new account is created using the ...
Anju Rajan's user avatar
1 vote
4 answers
3k views

How do you start learning about blockchain programming? [closed]

I am new to this technology. I have worked with C#,Javascript and JQuery to build web applications. I have been reading about how to start building DApps and there is so much data about Ethereum, ...
Jitesh Mehta's user avatar
2 votes
2 answers
454 views

Nethereum "WebException: The underlying connection was closed: The connection was closed unexpectedly."

I'm trying to call a contract function from asp.net backend, using a public node. var abi = @"[{""constant"":false,""inputs"": [{""name"":""addr"",""type"":""address""}, {""...
Egor Shoba's user avatar
1 vote
2 answers
1k views

ethereum offline signer c#

is there any C# version of the offline signer for transaction. like ethereumjs-tx var Tx = require('ethereumjs-tx') var privateKey = new Buffer('...
Amzad Raza Khan's user avatar
2 votes
1 answer
995 views

Miner.Start not working, unable to mine contract using Nethereum testChain (Geth v1.6.6)

Been testing Nethereum and attempting to get a basic test class running as per the Nethereum documentation, but having trouble when running the mining command. I am using Geth v1.6.6 Running the ...
stradled's user avatar
  • 203
2 votes
1 answer
1k views

Gemini API Read Response / Content?

So I'm trying to test an authenticated response from Gemini. I get a "response", but not what I expect... it comes back as an html string, not "an array of balances" like the API suggests I should get....
HodlDwon's user avatar
  • 927