Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
1 vote
0 answers
17 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-...
0 votes
0 answers
11 views

Event data from Smart Contract parsing issue with go-ethereum

I am unable to get the full data emitted from SC event by using types.Log channel. Is there any way so that I can have all the data from an event emitted? The event I'm trying to parse: PairCreated(...
  • 103
0 votes
0 answers
11 views

Download verified smart contracts from Etherscan API using GO

is there any way to download all the solidity files from etherscan for a given contract address using golang? I can download the file if the contract has only one sol file but if it has multiple ones ...
0 votes
0 answers
16 views

Go script using which I can simulate any transaction using geth and see the outputs of the transaction before actually sending it on the blockchain

Hello everyone. I need a go script using which I can simulate any transaction using geth and see the outputs of the transaction before actually sending it on the blockchain. I want to give a list of ...
2 votes
0 answers
154 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 ...
  • 21
0 votes
1 answer
7 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 ...
0 votes
1 answer
24 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 ...
1 vote
0 answers
68 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 ...
3 votes
1 answer
68 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----- ...
  • 31
0 votes
1 answer
31 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 ...
  • 25
0 votes
2 answers
76 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 ...
0 votes
0 answers
25 views

I use golang to write a function to deploy a contract, how do I estimate gaslimt?

This calculation method is wrong, the calculated gas is lower than the actual required gas, how should I deal with it? thanks How do you calculate gas limit for transaction with data in Ethereum?
0 votes
0 answers
27 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....
0 votes
0 answers
7 views

how to capture transaction components individually from struct in go-ethereum

I want to modify a liitle in "congress.go" file to caputre 'to' address in form of array, I tried code below but getting compile error for the below code log.Info("test output => &...
0 votes
1 answer
25 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 ( &...
0 votes
2 answers
71 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 ...
0 votes
2 answers
58 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 ...
0 votes
1 answer
78 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 ...
1 vote
0 answers
34 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 ...
0 votes
1 answer
140 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,...
  • 161
1 vote
0 answers
47 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 ...
0 votes
0 answers
20 views

Detect changes to hundreds of ethereum/erc20 wallet addresses in real time with Golang

I will like ability to watch hundreds of ethereum/erc20 wallet addresses and check for changes like increases or decreases or any changes for that matter on the wallet. Any guide and direction to ...
  • 111
2 votes
1 answer
212 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 ...
  • 21
0 votes
0 answers
78 views

websocket: bad handshake (HTTP status 503 Service Temporarily Unavailable) - Go-Ethereum

I have encountered a problem. I have followed this tutorial (https://goethereumbook.org/en/event-subscribe/) in goethereum, but when I replace node endpoint matic(wss://rpc-mumbai.matic.today), I ...
1 vote
0 answers
97 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(...
1 vote
1 answer
71 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 // ...
0 votes
0 answers
146 views

Get pending transaction in Golang?

I know how to get pending transaction, from Mempool that is, in JS/NodeJs. I want to do the same thing in Golang, though. How to do it? I haven't found any example.
  • 45
0 votes
0 answers
116 views

"newPendingTransactions" subscribption stops after a couple of entries?

Still fairly new to golang however, im trying to subscribe to pending transactions. I have private fullnode that I host on a vps, on the binance smart chain. I have built bots in the past in ...
0 votes
1 answer
106 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/...
  • 1
1 vote
1 answer
405 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 ...
0 votes
1 answer
71 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?
0 votes
1 answer
44 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. ...
  • 1
0 votes
0 answers
12 views

Should I use truffle for compiling and deploying my contracts or writing my own compiling script and deploying script?

I'm working on my cli project and in this cli project i need to compile 15 different smart contract and deploying to multiple blockchains for user inputs. I'm using golang for creating this project ...
0 votes
1 answer
178 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 ...
  • 1
0 votes
0 answers
97 views

keystore DecryptKey (cannot use generic type mapset.Set[T comparable] without instantiation)

I try to decode the private key string from the wallet file. Reading a json string key file, or am (AccountManager) are both okay, just the "github.com/deckarep/golang-set/set.go" is trying ...
  • 1
0 votes
1 answer
65 views

How to set total supply of native token in genesis file?

I understand you prefund wallet address with a native token in the alloc param, but where do you define the total supply at in the genesis.json file? "genesis": { "nonce":...
0 votes
0 answers
9 views

Hyperledger Fabric

I am new to golang and I want to learn and the main reason I am learning golang is for web3 I realized most tools are created using golang. I need to know where to start learning and which tools is ...
  • 101
0 votes
1 answer
341 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 ...
  • 1
1 vote
1 answer
434 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 ...
0 votes
0 answers
168 views

How to properly sign an Ethereum transaction?

I'm learning Ethereum on GOlang. I work through Ganache GUI. I'm trying to make a transfer from 1 wallet to another, but I get an error at the stage of sending a transaction through the client. I ...
  • 1
1 vote
1 answer
581 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", "...
  • 11
1 vote
0 answers
721 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 ...
1 vote
2 answers
646 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 ...
  • 23
0 votes
0 answers
285 views

I cannot generate the ECDSA public key from her private key sequentially

I cannot generate the public keys in sequence. output :./keysgo.go:33:33: cannot use PrivateKey (type []byte) as type string in argument to Public Thank you so much for your help important to keep ...
0 votes
1 answer
87 views

Using Ethereum as a Unique ID Generator

I have a requirement where I would like to call a smart contract and store some values against a unique ID. I have seen the Counters library from OpenZeppelin. Is a smart contract a good use case for ...
  • 103
0 votes
0 answers
19 views

Go Ethereum "invalid signature recovery id" when recovery byte is >= 4 [duplicate]

I have a signed message that was generated by Metamask. It looks like this: ...
2 votes
0 answers
363 views

Reading TxPool using GO

Hello I am trying to learn Go and have not been able to figure out how to get pending transactions. I was reading the following link but I am not sure what I should be importing: https://geth.ethereum....
0 votes
0 answers
273 views

Decode pending transaction input into map

I'm attempting to decode a transaction input into a map, the input contains uint256 which are translated to bigint but the output value I get is incorrect. I use this function to decode the input data ...
0 votes
1 answer
311 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: ...
0 votes
1 answer
594 views

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

I have the following raw transaction string. ...

1
2 3 4 5