Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 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 ...
user avatar
  • 1
0 votes
0 answers
24 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 ...
user avatar
  • 1
0 votes
1 answer
24 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":...
user avatar
0 votes
0 answers
5 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
  • 1
0 votes
1 answer
52 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 ...
user avatar
0 votes
0 answers
44 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 ...
user avatar
  • 1
0 votes
1 answer
85 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", "...
user avatar
  • 1
0 votes
0 answers
52 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 ...
user avatar
1 vote
2 answers
43 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 ...
user avatar
  • 11
0 votes
0 answers
57 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 ...
user avatar
0 votes
1 answer
26 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 ...
user avatar
  • 103
0 votes
0 answers
15 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: ...
user avatar
0 votes
0 answers
99 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....
user avatar
0 votes
0 answers
85 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 ...
user avatar
0 votes
1 answer
53 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: ...
user avatar
0 votes
1 answer
152 views

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

I have the following raw transaction string. ...
user avatar
0 votes
0 answers
117 views

How to add a custom JSON RPC endpoint to geth?

I would like to add custom RPC method to geth. I found this question: How to add a custom JSON-RPC endpoint to geth?. But it does not work... What I did: 1. https://github.com/ethereum/go-ethereum 2. ...
user avatar
  • 171
0 votes
0 answers
117 views

Convert string to byte array and verify signature with go ethereum

I've been following this tutorial to generate a signature and a hash. This step all looks fine. The result are these 2 strings that I return: { "hash": "...
user avatar
  • 101
0 votes
0 answers
124 views

Geth: Simulated Backend?

I recently stumbled upon SimulatedBackend struct while browsing the code. I noticed that it has a constructor (i.e. NewSimulatedBackendWithDatabase) which accepts the path to the node's LevelDB, which ...
user avatar
1 vote
0 answers
78 views

Golang - Help gnosis transaction hash not calculated right

I have been trying to submit a transaction to gnosis rinkeby api but always the server response is that the hash is not correct and suggest's the lazy way which is not safe for what I want to do so I ...
user avatar
0 votes
0 answers
28 views

GoLang-strings.ToLower doesn't seem to pass lowercase transaction hash into the http.Get request url (starting from Line number 26 in the screenshot)

Here is the portion of the code, you can also refer to the line 26 in the attached screenshot for reference. tx := strings.ToLower(v.(string)) response, err := http.Get(fmt.Sprint("http://...
user avatar
0 votes
0 answers
12 views

How does EVMLogger work?

In Go-EVM source codes EVMLogger is an interface, here are its source codes: type EVMLogger interface { CaptureStart(env *EVM, from common.Address, to common.Address, create bool, input []byte, ...
user avatar
  • 1
0 votes
0 answers
57 views

Malformed private key when attempting to sign transaction

I am attempting to sign a transaction but I get a malformed private key. The code below is example code that I have cobbled together. main.go package main import ( "bytes" "...
user avatar
  • 163
1 vote
2 answers
110 views

how to manually craft tx data in golang WITHOUT ethclient

how do i manually craft tx data (the actual DATA field in a tx) in golang without ethclient? i am trying to craft tx data to be signed later. lets assume i am trying to call a solidity function like ...
user avatar
  • 125
0 votes
0 answers
31 views

"invalid sender" with new AccessListTx

I have the following code that I couldn't get to work with AccessListTx: tx, e := types.SignTx(types.NewTx(&types.AccessListTx{ ChainId: 0x38, Nonce: tx_nonce, To: &contract, ...
user avatar
0 votes
0 answers
19 views

Deploy 1000000000 ether of token using golang

Hy all, I've writed some code to mint 1B ether of token using go-lang, but if I using bind.DeployContracts from github.com/ethereum/go-ethereum/accounts/abi/bind there have some limitations cause ...
user avatar
0 votes
1 answer
197 views

Deploy smart contracts using golang

I tried to deploy smart contracts using go and go-ethereum. To deploy it, I use sendTransaction function from go-ethereum library, but when i check it on ropsten explorer, it just a basic transaction ...
user avatar
0 votes
1 answer
50 views

Start and HTTP JSON-RPC geth on android?

Is it possible to change the code in /mobile to allow for a json-rpc api to be spawned on an android? Or is there something I need to do in Java with the NodeConfig? I already managed to run a light-...
user avatar
0 votes
0 answers
182 views

How to generate a proper EIP712Domain signature transaction

I'm working a crowding contract in solidity. The contract has been deployed and I also generated a Go ABI. I've managed to generate the transaction hash and sign it using web3.js by hooking into bind....
user avatar
1 vote
1 answer
436 views

Why is my contract so expensive to deploy?

I've tried to deploy a contract based on openzeppelin library (see below). The fee I paid is about $146 and the contract didn't even deploy(i.e it run out of gas ). I find this unbelievable high. It ...
user avatar
0 votes
0 answers
71 views

Exit function in POS Bridge go-ethereum

I'm trying to follow the POS bridge steps for transfer an ER20 token from ethereum görli testnet to polygon (mumbai testnet). I've accomplished the approval, deposit and burn steps. Nevertheless, in ...
user avatar
  • 1
0 votes
0 answers
10 views

How to mark a message as read in golang

How to mark a message as read in golang How to write a go code to mark as read after the message has been read.
user avatar
0 votes
0 answers
80 views

Best Way to Estimate Gas, Flashbots [duplicate]

I am writing an arbitrage bot that leverages the Flashbots bundle. For those who don't know, if you submit transaction through flashbots if the transaction revert, then you don't pay any gas. My ...
user avatar
  • 1
0 votes
0 answers
8 views

Error: could not import signer account while build the project in golang

hi all I am getting the error while running faucet.go with the command ./build/bin/faucet now I am facing the error:- CRIT [09-15|13:11:25.287] Failed to import faucet signer account err="...
user avatar
0 votes
0 answers
118 views

Enhancing geth subscription processing to be able to work with transaction data

I'm thinking to have a geth "extension" that would be working with a Geth subscriptions. I would like to filter over pending transactions. When I'm searching in the code I can see that I can ...
user avatar
  • 101
0 votes
0 answers
25 views

Is there a light weight way to read smart-contract data using Golang?

I would like to have access to a way to read smart contract data (for example the number of decimals of an ERC20 token) using golang. Of course, one way would be to use abigen and instantiate a ...
user avatar
  • 119
1 vote
0 answers
48 views

Expose aditional APIs via Go Geth Ethereum Client

I am asking more experienced Go Geth developers what is the module that is in charge of exposing variables on the Geth Console / RPC. What I need is to expose the variable containing the addresses in ...
user avatar
  • 123
0 votes
0 answers
40 views

geth is not attached with JavaScript console

I am Nikhil Upadhyay I am trying to connect geth with javaScript Console but it didn't work for me here are few steps which I already tried but could not resolve it geth attach ipc:gethDataDir/ geth....
user avatar
0 votes
0 answers
21 views

Transferring tokens with Geth: what's outdated about this tutorial?

I'm using this e-book to learn about using go-ethereum, but it's pretty outdated. I'm on the part about transferring tokens and I'm getting an invalid opcode when estimating gas. I have a private key ...
user avatar
  • 3
0 votes
0 answers
557 views

Call getReserves() from goweb3

I've been using https://github.com/umbracle/go-web3 as my go web3 library, and I am having trouble finding out how to call the "function getReserves(address factory, address tokenA, address ...
user avatar
0 votes
0 answers
274 views

How to create a USDT wallet on both ERC20 and TRC20 networks using HD wallet?

Suppose I am creating an exchange cryptocurrency such as Binance and I have a main account with both public and private keys. I want to create a Tether wallet (USDT) for any new user registering, ...
user avatar
  • 101
0 votes
0 answers
208 views

1Inch Swap with Go Return amount is not enough

I'm attempting to do a swap with 1Inch and Go but an error of "Return amount is not enough" is returned. The token has been approved and I have tried adjusting the slippage to 10% without ...
user avatar
  • 103
0 votes
0 answers
11 views

Can i get step by step instructions to fork GETH [duplicate]

Can I get step-by-step instructions to fork GETH then make a public node with a private network RPC, chain id, and native coin?
user avatar
0 votes
1 answer
483 views

types.NewTx instead of types.NewTransaction

var data []byte tx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, data) signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, privateKey) NewTransaction is ...
user avatar
  • 1
0 votes
1 answer
36 views

Properly using consensus/ethash module in go-ethereum

Traditionally, Ethereum pools used the deprecated Ethash, which is quite inconvenient to use with modern golang, specifically around the usage of Go modules. Examples of this are Sammy007's Open ...
user avatar
  • 1
1 vote
0 answers
110 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 ...
user avatar
0 votes
1 answer
28 views

Setup Quorum Blockchain

I am setting up a quorum blockchain on my computer. According to the official documentation, I have to first clone the git repo and give the following command: git clone https://github.com/Consensys/...
user avatar
2 votes
1 answer
180 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() { ...
user avatar
0 votes
0 answers
25 views

Chainlink Initiators - Failed testing subscriber: unexpected end of JSON input

I am trying to customize Chainlink External Initiators, since the blockchain is fork of Ethereum. I am simulating the eth.go and created my own version. After updating the program, triggered the ...
user avatar
  • 1

1
2 3 4 5