Skip to main content

Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 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
1 vote
1 answer
33 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
  • 71
1 vote
0 answers
58 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
0 answers
58 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
  • 31
0 votes
0 answers
22 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
3 votes
1 answer
83 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
  • 105
1 vote
0 answers
84 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
2 votes
1 answer
43 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
2 votes
2 answers
161 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
0 answers
15 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
0 votes
3 answers
363 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
  • 71
1 vote
1 answer
128 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
0 votes
1 answer
29 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 vote
0 answers
146 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
1 vote
2 answers
106 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
1 answer
333 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
56 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
  • 71
0 votes
1 answer
901 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
  • 316
0 votes
1 answer
187 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
  • 316
1 vote
1 answer
174 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
  • 71
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
  • 71
2 votes
1 answer
96 views

Why is the same set of bytes encoded base58 differently?

I want to generate a bip32 private root key based on bip39 seed. I found an article with python code, copied it to myself and executed it, getting a valid private root key (checked here). Then I wrote ...
Mod diller's user avatar
0 votes
1 answer
250 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
0 votes
1 answer
833 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
0 votes
1 answer
82 views

SSZ serialization in Ethereum

I am looking at the SSZ serialization for Ethereum and am unable to understand how the "index" alone can be used for encoding/decoding variable length fields. The following is quoted from ...
Sunny's user avatar
  • 103
1 vote
1 answer
57 views

how many transactions we can go in a personal blockchain made with geth ( go-ethereum ) per second or per block?

If I made a personal blockchain using https://geth.ethereum.org/, how many transactions can one block handle?
aakash4dev's user avatar
0 votes
1 answer
277 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
2 votes
0 answers
407 views

Simulate transaction replacement on go-ethereum SimulatedBackend

i'm writing in go-lang and using go-ethereum package to interact with nodes. For testing purposes go-ethereum provides blockhchain simulation via SimulatedBackend (https://github.com/ethereum/go-...
Andrey Obruchkov'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
14 views

identify past malicious transitions on blockchain?

Do you know any way to identify past malicious transitions on blockchain? Like if you see a large number of transactions going to a single address, or if you see transactions that seem to be moving ...
Nad3r Verse's user avatar
0 votes
1 answer
41 views

Trying to find difference between ERC20 and ERC721, any help please?

Getting this error when I try to run the following code which is supposed to check kthe receipt topics and if they are 4 then it should be ERC721 contract creation transaction and if 3 than it is ...
Nad3r Verse's user avatar
1 vote
0 answers
384 views

Flashbots - Bundle simulation always reverts

I have a series of transactions I'm trying to bundle in golang. several of the transactions are signed transactions from a range of different wallets that are not yet submitted to the mempool. When I ...
user3428734's user avatar
3 votes
1 answer
789 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
  • 31
0 votes
1 answer
89 views

how connect in rpc file go ethereum

i try much more time to connect rpc my geth, i got it cant run ,,syncmode light,, okay but can i used --syncmode fast? or how i connect in my rpc file , to be read from the geth side, also see the ...
tomas's user avatar
  • 41
0 votes
2 answers
414 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
2 votes
1 answer
550 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
0 votes
1 answer
81 views

Decode Ethereum Gas Price Golang

I needed to get gas data from a transaction, I did it with the code below. The received data has been converted to a string. Now I need to decode the received value. How can I do this? import ( &...
Nikita Shvetsov's user avatar
0 votes
2 answers
128 views

Is deploying that expensive?

I'm trying to deploy a smart contract and get this error each time Warning! Error encountered during contract execution [contract creation code storage out of gas] pragma solidity ^0.8.4; // it has ...
ThomasP1988's user avatar
0 votes
3 answers
548 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
1 answer
262 views

Rust vs Golang, overall for smart contract development

Assuming I do not know anything about these two languages (rust & go), I know rust is being used to write contracts for solana and I do not have much idea of golang, I am thinking of learning one ...
Priyanshu Jha's user avatar
1 vote
0 answers
97 views

Why is the TransactionByHash function in the go-ethereum client unable to return the sender?

I learned how to get the sender's address from this question. JSON-RPC returns a result with a from field, which we can unmarshal in our struct. But I'm curious why go-ethereum didn't return ...
user109485's user avatar
0 votes
1 answer
250 views

How to read ERC1155's SafeTransferFrom() transactions in golang?

Trying to read ERC1155 SafeTransferFrom events, in golang. Here is what I tried: var ( // erc 1155 logSafeTransferFromSig = []byte("SafeTransferFrom(address,address,uint256,uint256,...
Eric's user avatar
  • 171
1 vote
0 answers
68 views

Point a Go-Ethereum contract instance at a different address

I am running a golang backend that will interact with tens of thousands of deployed contracts that are all the same, just with different addresses (uniswap pools). I am thinking that it would be more ...
skrrrraaaa's user avatar
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
2 votes
0 answers
195 views

Subscribe to smart contract using go-ethereum

I am trying to subscribe to certain smart contract using go-ethereum. Here is the example of my function client, err := ethclient.Dial(config.AppConfig.SmartcontractHost) if err != nil { log.Fatal(...
Yur Gasparyan's user avatar
1 vote
1 answer
112 views

How to filter return value from go-ethereum evm runtime.call

I am writing simple solidity code that's will be running inside evm using golang (go-ethereum). I have successfully run the code, but I can't find the right return value of the function. Test.sol // ...
ade ramdani's user avatar
0 votes
1 answer
245 views

Simple Go-Ethereum Program not compiling

I am following this tutorial: 01-Interact with Ethereum blockchain using Golang When I compile the code, i get the following errors: # github.com/deckarep/golang-set ../github.com/deckarep/golang-set/...
gnome's user avatar
  • 1
3 votes
1 answer
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,575
0 votes
1 answer
245 views

How to extend functionality of geth (module, addon)?

Is there a way to extend functionality of geth using some sort of plugins, modules or addons? However, I haven't found any information about the topic. How to do it?
pablo camilo's user avatar
0 votes
1 answer
95 views

How to obtain full token address from uniswap/PCS router transactions (*types.Transaction)

When trying to obtain the token address from router transactions (add liquidity and remove liquidity taxes), the token addresses appear truncated, with 8 leading 0s and the 8 final characters missing. ...
jrn's user avatar
  • 1

1
2 3 4 5