Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
2 votes
3 answers
481 views

How to implement the below solidity code in golang? especially the `abi.encode` function?

How to implement the below solidity code in golang? especially the abi.encode function? abi.encode( keccak256("delegate(address sender,string amount, string to)"), sender, amount,...
Daniel Moore's user avatar
1 vote
1 answer
287 views

How to do simulation of all/most pending transactions?

everybody. I have a task to search in mempool for transactions like "swap tokens for eth" or any other type where a wallet sells tokens and its transaction can affect token reserves. There ...
solo11's user avatar
  • 11
1 vote
1 answer
208 views

Using abigen with combined-json option generates nothing

I was trying to generate go binding using following commands: abigen --combined-json UniswapV2PriceOracle.json --pkg abi --type UniswapV2 --out UniswapV2.go It doesn't give any error, but the go file ...
John Smith's user avatar
0 votes
1 answer
34 views

How to encode transaction hash argument in go ethclient CallContext

I am trying to call debug_traceTransaction in go by doing: cl, err := ethclient.Dial("http://localhost:8545") if err != nil { panic("Failed starting") } txnHash := common....
Riccardo Perego's user avatar
0 votes
1 answer
41 views

Call to view function, which returns a bytes value, got error: VM Exception while processing transaction: invalid opcode

I have this test smart contract // SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.8.26; contract TestSomething { bytes state; bytes32 state32; constructor() {} ...
Trong-Hieu Nguyen's user avatar
3 votes
1 answer
84 views

for loop containing types.Sender sometimes does not leave and consumes 100% CPU

I have this simplified code here: signer := types.LatestSignerForChainID(s.ethApiBackend.ChainConfig().ChainID) log.Info("Before msg generation", "txsLen", len(txs)) msgs := make([]...
flo's user avatar
  • 115
0 votes
1 answer
1k views

go ethereum bigint and unit256

Golang can only handles up to 64 int however ethereum contract call can return uint256 for example https://eips.ethereum.org/EIPS/eip-20 balanceOf method. Does https://github.com/ethereum/go-ethereum ...
Min Hsiu Hsieh's user avatar
1 vote
0 answers
73 views

Confusion regarding the technical implementation of PoS Consensus Mechanism in custom blockchain? Master Node?

I have been making my own custom blockchain just as a practice for the past few weeks. The code is available here link to github repo I have hitherto implemented the Execution Layer, so to speak. I ...
Geek's user avatar
  • 41
1 vote
0 answers
96 views

abi: attempting to unmarshal an empty string while arguments are expected

After updating go-etherum from github.com/ethereum/go-ethereum v1.10.22 to v1.13.15 My contracts started printing out error abi: attempting to unmarshal an empty string while arguments are expected ...
Mikheil Janiashvili's user avatar
1 vote
1 answer
81 views

Abigen from flattened contract files

I have a file that is composed of 5 imports, too much code to drop here so I will illustrate my question with a very simplified example. My Test.sol file: // SPDX-License-Identifier: MIT pragma ...
pigfox's user avatar
  • 167
0 votes
1 answer
353 views

what consensus client is used while making personal blockchain with geth ( go-ethereum)?

Modular EVM based blockchain have multiple layers. mainly consensus layer and execution layer. Execution layer options: Besu Erigon Go Ethereum Nethermind consensus clients options: Lighthouse ...
aakash4dev's user avatar
1 vote
2 answers
529 views

How to represent uint256 in EVM using Golang?

I am asked to build a small EVM with few instructions using Golang. What I am confused about is how to represent the uint256 data type? Because Golang supports at most uint64 for integer type. What I ...
Ahmet Yazıcı's user avatar
3 votes
2 answers
1k views

Verified go signature in solidity (EIP712 TypedData)

I am trying to recover the signer of a TypedData message (eip712). I am able to sign and verify with ethersJS and validate in the contract as well. With Go, I can sign and verify as well but the ...
MadeInDreams's user avatar
  • 1,615
0 votes
0 answers
41 views

public key recovery failed intermittently with go-ethereum

I am trying to recover public key from signature and digest. below is my code. It's failing sometimes with error recovery failed package main import ( "crypto/ecdsa" "crypto/...
Pankaj Kumar's user avatar
1 vote
1 answer
1k views

Calling multicall contract using Go

I'm trying to make a multicall using go. The function "aggregate" takes a tuple of "calls" with address and bytes. "name": "aggregate", "...
Lio's user avatar
  • 11
1 vote
1 answer
732 views

Verify Nonce Signature in the backend Golang

I am trying to implement a metamask user authentication flow on BSC. I managed to get it working on ethereum. The flow is like this. I've found the code for ethereum on some gist however I am unable ...
Lucian Tarna's user avatar
0 votes
3 answers
563 views

Despite calculation I get contract creation code storage out of gas

My smart contract is deployed on https://sepolia.etherscan.io/tx/0x1b1742a3ff2ac160d5f245ab91828fcc56a803cb3826b6cbdb9f3cb2f293ba66 Once deployed I get contract creation code storage out of gas error ...
pigfox's user avatar
  • 167
0 votes
1 answer
972 views

How to interact with mainnet smart contracts by GOlang?

Please tell me an example of code in GOlang that connects to the contract and checks the balance of the ERC20 token / transfer tokens / gets the name of the token. I looked for examples and did not ...
hey's user avatar
  • 1
2 votes
2 answers
1k views

type *types.Transaction has no field or method AsMessage)

I am following https://github.com/miguelmota/ethereum-development-with-go-book/tree/master/en/transaction-query Complete code package main import ( "context" "fmt" &...
pigfox's user avatar
  • 167
0 votes
1 answer
91 views

Rate limiter not working

The following code has an expected duration of 1000ms. package main import ( "context" "fmt" "github.com/ethereum/go-ethereum/ethclient" "golang.org/...
pigfox's user avatar
  • 167
0 votes
1 answer
360 views

Can I deploy contract with go-ethereum and sign it via MetaMask?

I want to deploy contracts by using my go backend code with go-ethereum package. Since this part of the system will run as a central element (since it does a lot of other stuffs), I won't (and don't ...
prodx's user avatar
  • 1
0 votes
1 answer
1k views

Decode Raw Transaction In GoLang to Go-Ethereum types.Transaction

I have the following raw transaction string. ...
Ricky Barnett's user avatar
2 votes
1 answer
132 views

How to correctly pack Log data in Go

Using go-ethereum, I want to convert a struct containing my log fields into a types.Log{} object containing the data bytes and topics. Essentially, I want to do the opposite of the Parse<EventName&...
Ryan Collingham's user avatar
0 votes
1 answer
1k views

Decoding tx data from view call in Golang

I have a view call in my Solidity code that looks like this: function call1 (address[] calldata targets) external view returns(Return[] memory returnData) And the struct from the array which is ...
rihekopo's user avatar
  • 326
1 vote
1 answer
922 views

Go Ethereum encode types.Transaction as hex

I have a types.Transaction object. How can I encode this to receive the raw transaction hex? Something like this: ...
Ricky Barnett's user avatar
1 vote
2 answers
148 views

How to analyze a tx data?

Given a transaction of type types.Transaction (golang go-ethereum), how can I analyze the data field and check if it has a swap or a sync event? I know that ...
AnastasiaShishkova's user avatar
2 votes
2 answers
2k views

Await transaction using `go-ethereum/ethclient`

In ethers.js, one can wait for a transaction to be mined with wait(). Is there a way to do this when using ethclient from go-ethereum as a package? I would like to wait for the result before moving on ...
boston's user avatar
  • 33
2 votes
1 answer
725 views

How to use contractAbi.Unpack to parse raw log data into a log type struct

I am following the guide here but I am not able to replicate what is being done in the guide. var transferEvent LogTransfer err := contractAbi.Unpack(&transferEvent, "Transfer", vLog....
SelfLearnedNoob's user avatar
1 vote
1 answer
894 views

what should golang abi.pack argument looks like compared to solidity function

The following code is a popular solidity ethereum function function: swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline) what should amountOutMin type look like ...
anonymous's user avatar
0 votes
3 answers
666 views

How can I query the onchain data on the ethereum blockchain without using any APIs?

I want to get all the onchain data available on the Ethereum blockchain about an NFT from its contract address and tokenID. Like its metadata, the current owners, its last price, etc. How can I do ...
amam's user avatar
  • 11
0 votes
0 answers
43 views

go -ethereum abi: cannot marshal in to go type: length insufficient 640 require 8225"

Im trying to decode a struct which basically is a tuple where i have this byte of data and passing the byte of data it will be able to be decoded into a struct in Go. My goal here is trying to create ...
0xbyterider's user avatar
2 votes
1 answer
459 views

Generate r, s, v permit signature variables off chain using Golang

I'm trying to generate a signature in line with https://eips.ethereum.org/EIPS/eip-712 so that I can permit spending of tokens without having to call Approve() first. this is my code so far: func ...
PopFendi's user avatar
0 votes
1 answer
2k views

Monitoring pending transactions with Go

I'm trying to write a program in Go to watch pending transactions, using a geth full node that I'm connected to over websockets. I'm pretty sure I have to use the github.com/ethereum/go-ethereum/eth/...
boston's user avatar
  • 33
1 vote
0 answers
219 views

($10 ETH Bounty) Base Chain - My submitted transaction is always 2 blocks behind the current block

For some reason whenever I submit my transaction it is always included 2 or more blocks behind the current block. There's an address that always has their transaction included in the same block as the ...
shlx's user avatar
  • 31
4 votes
1 answer
966 views

Convert pem public key into ethereum address by Go

I have ECC_SECG_P256K1 Public key PEM File generated by AWS KMS. I want to convert pem public key into ethereum address by Go. How can I get it? Sample Pem Data -----BEGIN PUBLIC KEY----- ...
takumi's user avatar
  • 41
1 vote
0 answers
17 views

How does MetaMask confirm the trasaction? The workflow of metamask

I'm trying to make interaction between my customized chain and Metamask. Network is added, and token sending is successful on chain side. But in MM, tx state is still pending. how can I fix that? What'...
Daniel Moore's user avatar
2 votes
0 answers
1k views

Getting ALL pending tx from txPool

I'm working on top of geth in golang. My first goal would be to stream all pending transactions from the txPool. The problem is that when I run my script, I can't manage to catch 100% of pending ...
kms kms's user avatar
  • 21
0 votes
1 answer
3k views

How to solve the "cannot find package" error in GoLand?

I just imported the go-ethereum project in GoLand. But the configuration shows the error below, how to solve it?
jiebang's user avatar
  • 1,003
2 votes
1 answer
613 views

Problem with deploying the precompiled contract bytecode in genesis.json file

I am trying to add this simple test contract dumb.sol to my genesis.json file. pragma solidity <0.8.6; contract Dumb { string public name; string public symbol; constructor() { ...
Sakon Thephamongkhol's user avatar
1 vote
1 answer
220 views

Why Golang was chosen to implement ethereum protocol?

I know there are many implementations of the Ethereum protocol, i.e. the first implementation in Python, or other implementations using C++, C#, and Java. As go-ethereum has gained lots of attention ...
Ehsan Khodarahmi's user avatar
1 vote
1 answer
213 views

Compiling two smart contracts it the same folder cause duplicates

When I compile two contracts in the same folder I get duplicates. The following contracts, Store.sol pragma solidity ^0.8.0; contract Store { event ItemSet(bytes32 key, bytes32 value); ...
pigfox's user avatar
  • 167
2 votes
1 answer
2k views

Transaction Effective Gas Price

I am developing in Go and I have a question that I have been looking for the solution for a long time and I am not able to find it. How can I find the effective gas price used in the transaction? Not ...
alopez's user avatar
  • 21
0 votes
1 answer
2k views

Issues with autogenerated go file while using abigen

I have a simple sol file message.sol pragma solidity >=0.5.10; contract Message { string public message; constructor(string memory initMessage) public { message = initMessage; ...
Oscar's user avatar
  • 1
1 vote
1 answer
1k views

How do I listen for Events starting at a previous block number in Golang?

I'm writing an Event listener for my smart contract using the go-ethereum library. I'm trying to figure out how to listen for all SubmitProof events and have successfully been able to use the builtin ...
hexcowboy's user avatar
8 votes
6 answers
5k views

Given a RAW Transaction - how to get senders address

Is it possible to get the senders address using golang when all you have is the raw transaction string. I can decode it and get the nonce, hash, to etc as these are all exported functions from the ...
Kravitz's user avatar
  • 447
13 votes
5 answers
23k views

why did it returned null after call miner.start()

> miner.start() > null before it , I had created a account like this . user1 = eth.accounts[0] "0xb62f0bae52d153365661c4e23ab1d594484e9bef"
Mike's user avatar
  • 131
0 votes
1 answer
284 views

How to properly handler error from contract call with go etheruem

I am writing an application with https://github.com/ethereum/go-ethereum Basically I am trying to check a given smart contract address is erc20 or not. I am calling getBalance, getSymbol... methods. ...
Min Hsiu Hsieh's user avatar
11 votes
6 answers
16k views

How to decode input data with ABI using golang?

There is a tool on npm ethereum-input-data-decoder. And yes, i can read input data as hex. And i hope that i can decode transaction's inputdata using golang. For example ...
hundred lee's user avatar
0 votes
1 answer
266 views

How to create Solidity bytes[] input argument in Go for Ethereum contract call

I have a simple multicall contract in Solidity which has the following function: function multiCall (address[] calldata targets,bytes[] calldata data) external view returns(Return[] memory returnData) ...
rihekopo's user avatar
  • 326
0 votes
1 answer
35 views

How to implement solidity bitwise in Golang

Code in UniswapV3 Solidity contract TickBitmap uint256 mask = ~((1 << bitPos) - 1); I had founded some example code in Golang: a := new(big.Int).Exp(big.NewInt(2), big.NewInt(66), nil) ...
Sylar's user avatar
  • 1

1
2 3 4 5