Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
0
votes
0answers
22 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": "...
0
votes
0answers
13 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 ...
1
vote
0answers
29 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 ...
0
votes
0answers
22 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://...
0
votes
0answers
7 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, ...
0
votes
0answers
20 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" "...
1
vote
2answers
24 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 ...
0
votes
0answers
10 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, ...
0
votes
0answers
6 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 ...
0
votes
1answer
47 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 ...
0
votes
1answer
29 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-...
0
votes
0answers
45 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....
1
vote
1answer
89 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 ...
0
votes
0answers
48 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 ...
0
votes
0answers
6 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.
0
votes
0answers
53 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 ...
0
votes
0answers
16 views

How does geth tests do code gen?

I'm trying to understand how the ethereum test related geth golang code work. I'm stuck at how the test json files are processed. https://github.com/ethereum/go-ethereum/blob/master/tests/...
0
votes
0answers
7 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="...
0
votes
0answers
47 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 ...
0
votes
0answers
15 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 ...
1
vote
0answers
34 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 ...
0
votes
0answers
22 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....
0
votes
0answers
18 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 ...
0
votes
0answers
400 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 ...
0
votes
0answers
184 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, ...
0
votes
0answers
128 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 ...
0
votes
0answers
7 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?
0
votes
1answer
160 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 ...
0
votes
1answer
27 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 ...
1
vote
0answers
64 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 ...
0
votes
1answer
24 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/...
1
vote
0answers
95 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() { ...
0
votes
0answers
22 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 ...
0
votes
0answers
247 views

go-ethereum: watching contract for events

I've been trying to get a go program going that monitors a smart contract for emitted events. I had found the amazingly written https://goethereumbook.org/event-read-erc20/ unfortunately it appears to ...
0
votes
1answer
253 views

ParserError: Expected '{' but got 'constant'

This is my error message ParserError: Expected '{' but got 'constant' --> amkcoin.sol:50:35: | 50 | function totalSupply() public constant returns (uint); | ^^^^^^^^ and this is code line.. } /** ...
0
votes
0answers
46 views

How to subscribe to the txpool / mempool of an external node using go-ethereum client?

Currently im trying to learn go by rebuild my already existing nodejs application but im facing the issue to not find a resource regarding the usage/ to consume a txpool from a given websocket ...
0
votes
1answer
92 views

Get smart contract info from transaction

Lets take for example this, we can see that it did not transfer any ether, it interacts with a contract (that's why there's the stamp of the contract creation/execution). Is there a way to get in go-...
3
votes
0answers
78 views

Retrieving the sender of a transaction

I am trying to retrieve the sender address within a transaction in Go and I am facing some issues. As I understand, in order to retrieve the sender of a transaction, you can either try to get the ...
1
vote
0answers
27 views

Could Insufficient Funds error mean the signature is incorrect? - using golang and raw transactions

I want to sign a transaction "offline" without using crypto.sign. The code looks like the following: unsignedTx := types.NewTransaction(nonce, to, amount, gasLimit, gasPrice, nil) networkID ...
0
votes
0answers
52 views

Issue with go-ethereum on freebsd

I got an issue when I am trying to run a sample test code via go to access my full node. Consider the following code snippet: package main import ( "context" "fmt" "log" ...
1
vote
0answers
690 views

How to pull data from DeFi Liquidity Pools

I am relatively new to decentralised development, and apologies in advance if a bit of a dumb question. I am doing a project where I am looking to download the following data. I am trying to figure ...
0
votes
1answer
25 views

I'm here to run the official Go-Ethereum repo. How can i do that?

I want to run go-ethereum in my own PC. Is there any instruction about this? How they deployed it?
0
votes
1answer
649 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/...
0
votes
0answers
17 views

Open Source Gateway

When I launch an Ethereum Node, I would like to offer it as a gateway to other developers, to do this I would need to throttle control the access, and give the developers an Activation key. Is there ...
0
votes
0answers
36 views

I want to fork Ethereum with my own implementation. Like changing name or block size or something like this [duplicate]

I'm such a noob or may be this is a noob type question i just want to fork Ethereum in go(maybe in another language) with my own implementation. Anyone can guide me about that?? Is there any relevant ...
0
votes
1answer
31 views

Ethereum miner does not produce blocks

first time Mining! Watching a YouTube Tutorial about Blockchain basics and it shows how to set up a Genesis Block as well as how to start Mining. I've followed all the steps to the best of my ...
0
votes
1answer
530 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; ...
0
votes
1answer
125 views

How do I receive a revert message using go-ethereum

How do I receive a revert message using go-ethereum? receipt, err := bind.WaitMined(context.Background(), client, tx) if err != nil { fmt.Errorf(err) } fmt.Println(receipt.Status) Now I can only ...
0
votes
1answer
101 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?
2
votes
0answers
182 views

UnhandledPromiseRejectionWarning: Error: nonce generation function failed or private key is invalid in Ganache

In Go I am using go-ethereum to read data from the ethereum smart contract. My smart contract is maintained with truffle. I am trying to fetch candidate information based on candidate id. I have a ...