Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
2 votes
1 answer
16 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
79 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
14 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
211 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
  • 35
1 vote
1 answer
61 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
26 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
119 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
84 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
182 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
0 answers
38 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
  • 35
0 votes
1 answer
580 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
  • 304
0 votes
1 answer
133 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
  • 304
0 votes
0 answers
87 views

Dynamically parsing the Ethereum logs returned from FilterLogs function

I am trying to parse the logs of a contract in a fully dynamic manner. Meaning that the only thing I have is the abi of the contract, and the filter query to filter out logs. I would like to parse the ...
Ahmet Yazıcı's user avatar
0 votes
0 answers
40 views

how to implement State Override for eth_call usinggithub.com/ethereum/go-ethereum/ethclient package

I'm so confused, because the lack of State Override variable on CallContract method on github.com/ethereum/go-ethereum/ethclient package, the only variable that available is ctx context.Context, msg ...
Billy Adelphia's user avatar
0 votes
0 answers
23 views

Which files of the go ethreum source code need to be changed to add a new type of transaction?

I need to update the source code of go ethereum so it can handle a new type of transaction. This new transaction will have a new field. Which directories and files of project would need to be updated ...
Tahrim Hossain's user avatar
1 vote
1 answer
142 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
  • 35
2 votes
2 answers
734 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
  • 35
2 votes
1 answer
84 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
195 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
0 answers
31 views

I want to develop a new chain based on go-ethereum and I need some help!

There are currently several modifications: Set the Gas consumed by all ETH transactions to 0,yes ,free Set the gas consumption of officially certified contracts to 0, yes, Official certification and ...
UpGod's user avatar
  • 1
0 votes
0 answers
113 views

even after installing abigen still getting the error like abigen: command not found

1.I tried the following commands to install abigen cd go/pkg/mod/github.com/ethereum/[email protected]/ make devtools I have tried many instructions but still getting same error like abigen: command ...
Madhan Kumar Sundraraj's user avatar
0 votes
1 answer
555 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
54 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
47 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
207 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
281 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
40 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
348 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
584 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
82 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
  • 31
0 votes
2 answers
327 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
416 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
57 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
119 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
450 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
219 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
85 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
239 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
67 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
1k 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
188 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
106 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
220 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
936 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,500
0 votes
1 answer
211 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
88 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
0 votes
1 answer
311 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
139 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":...
cormacncheese's user avatar

1
2 3 4 5