Questions tagged [golang]
Questions related to the Go programming language
156
questions
0
votes
0answers
31 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
21 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
24 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
11 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
15 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
27 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
0answers
15 views
Ethereum light client and verifying proofs in Go programming language
I am looking to write or integrate a toy Ethereum light client in Go-based applications to see how easily other (Tendermind / Cosmos) based blockchains could verify proofs from Ethereum main chain. ...
0
votes
0answers
21 views
using “eth_sendRawTransaction” by Go but got invalid argument 0: json: cannot unmarshal non-string into Go value of type hexutil.Bytes
I signed my transaction and my transaction used the standard structure: *types.Transaction
here is my transaction:
to := common.HexToAddress(toStr)
gasPrice_ :=new(big.Int).SetUint64(gasPrice)
...
0
votes
0answers
28 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
0answers
41 views
How uploaded form in golang store files in ipfs?
I have uploaded form written in golang and I want that when user upload file, it goes to ipfs not save in local directory. I used daemon and go-ipfs-api package to upload directory in ipfs but how ...
0
votes
1answer
31 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
0answers
15 views
Abigen doesn't create free data retrieval call for public state variable
I'm looking at an example contract using go-ethereum. In the book, when a go file is created in Store.sol through abigen, the code that automatically gets the Version() string is generated. However, ...
0
votes
0answers
21 views
What is the difference in the two mapping structures
Is the below mapping structure a legit way to create a restricted mapping, or is the latter best practice?
mapping(address => SomeStruct)[5] private structs;
and
mapping(address => mapping(...
2
votes
0answers
80 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 ...
1
vote
1answer
107 views
How to calculate CREATE2 address in golang?
I have a factory pattern smart contract that creates other smart-contracts by cloning the master smart contract via Minimal Proxy Contract and CREATE2 opcode. What is the proper way to calculate ...
0
votes
0answers
37 views
Error while calling a erc721 contract funciton using go-language
I am trying to call a function which is "mintUniqueTokenTo(address,uint256,string)" in a ERC721 token using go language , but for some reason it is failing. I think one reason could be that ...
1
vote
1answer
447 views
How to install solc of a specific version?
I want to install solc 0.4.24 but the commands given below installs the new version.
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
Or
sudo snap install ...
1
vote
1answer
22 views
Plans to migrate go-ethereum to rust-ethereum?
Is anyone planning to migrate go-ethereum to rust-ethereum? Rust with all its features such as zero-cost abstractions, safe memory management, fearless concurrency really outshines Go.
Nathan Aw (...
0
votes
1answer
61 views
Generate directory hash without upload using Swarm API
I am using the Swarm API (github.com/ethersphere/swarm/) with go to upload a directory on a private network. The client API(/api/client) provides a UploadDirectory function which returns a manifest ...
1
vote
0answers
52 views
go-ethereum: Return data from contract function
I have a smart contract written in solidity. I deployed the contract to my Ganache network and I can interact with it via go-ethereum using stubs generated by abigen. My function returns a uint256, ...
0
votes
0answers
23 views
Getting suffix of blockchain domain
I have a program that can get me the first part of registered blockchain domains, but not the suffix (.eth, .zil, etc.) and am not sure how to associate suffixes with names. I know that in some cases, ...
1
vote
0answers
35 views
Getting Blockchain Domains From Transaction Hashes
I am compiling a list of some blockchain domains (.eth, .crypto, etc.) and was wondering what would be the best approach.
My strategy is to take something like this:
https://etherscan.io/address/...
0
votes
0answers
52 views
Address generate with xpub key
Hy everyone,
I'm doing a hd wallet generator (normal child) with only use xpub key. Therefore, can someone help me pls. With library of golang or main flow of generating from: (xpub key, index) -> ...
1
vote
1answer
622 views
How do I increase the amount of memory geth can use for cache?
I'm running geth on a system with 96GB of memory, soon to be bumped up to 192GB. I currently start geth with --cache 32768 but I plan to double it when my memory is upgraded. However, I've noticed ...
1
vote
0answers
23 views
Geth's golang contract bindings need “RPC subscription features that are still under review” to process event logs. What are those features?
The documentation for Geth's golang contract bindings start out with
Please note, events are not yet implemented as they need some RPC subscription features that are still under review.
What ...
0
votes
1answer
39 views
Infura node seems to crash when tryining to deploy contract
I am trying to deploy a contract and run some tests on the functions within it.
Here is what my code currently looks like:
package main
import (
"context"
"crypto/rand"
"encoding/hex"
...
0
votes
1answer
19 views
Balance returning zero after sending KETH to it
I have sent the following transactions to the account 0x2D76d8729F9Cfa5bC3CEba8a504400FE30bb53D2:
0x8667bd1859a5ccc99bcc77b38c5453195bf32b308b4038ae409b47b002546344
...
2
votes
0answers
29 views
How to reduce corruption in developing countries using Ethereum [closed]
I would like an honest opinion on whether or not the picture below is self-explanatory. I would also like to know what more functionalities I can add to reduce the capital flight by government ...
0
votes
0answers
70 views
How it works with modified go-ethereum source code
I modified go-ethereum source code and built it. I am wondering if I want to test and run geth with the modified source code in mainnet or testnet, and how it works in the mainnet or testnet.
How to ...
0
votes
1answer
235 views
Decode transaction inputs with go-ethereum
When making a contract transaction using go-ethereum (golang) how can I decode the transaction inputs.
Specifically
Given a tx.Data []byte , the contract's contractABI abi.ABI and the method that ...
0
votes
1answer
77 views
How is Ethereum Virtual Machine (EVM) isolated (sandboxed)?
I always had this question in mind:
What are the used technologies, in order to achieve the isolation of the EVM? does it just run as an isolated process in its own namespaces using the linux feature ...
2
votes
1answer
393 views
Different outputs for Keccak256(), which one is right?
To get a value from contract storage I used this geth code succesfully:
var contractAddress = '0x88e726de6cbadc47159c6ccd4f7868ae7a037730'
var index = '...
1
vote
1answer
65 views
Subscribe to events using local geth in light mode?
I've followed this guide to subscribe to events. I succesfully subscribed to the new block headers using Infura provider. But when I try to use local geth node syncing in light mode, it connects, but ...
1
vote
0answers
33 views
Retrieving a State_object value on go-ethereum
I have a deployed contract address and I need to query a contract storage value, a token account balance that is stored on a mapping variable:
mapping (address => uint256) balances;
From go-...
0
votes
1answer
254 views
Is there a web3 api written in golang to interact with Eth nodes?
I'm looking for a library that can easily interact with Ethereum nodes that is similar to Web3.js.
go-ethereum is written entirely in go so I would of thought I could write scripts pretty easily.
1
vote
1answer
189 views
Connecting my Golang Backend server with Metamask
I'm trying to build a Ticket-Office project in one of my courses at the University.
The project uses a backend server (which I'm writing in Golang) and it should be able to deploy and use smart ...
1
vote
1answer
121 views
How can I make new account by JSON-RPC of Go
I'd like to make new account by JSON-RPC.I've checked the wiki of Ethereum, however I could not find out how to do that.
I've found call existed accounts, but it isn't what I want.
eth_accounts
...
2
votes
0answers
39 views
How to add or modify account_signTransaction function
In this github.com/ethereum/go-ethereum/accounts/external/backend.go of Ethereum project i see the "account_signTransaction" function and i want to edit or update the logic for this function, where ...
1
vote
1answer
267 views
The EVM throws an error “invalid opcode 0x1c” [duplicate]
I have written a simple smart contract that allows to store a string, and I'am trying to use go-ethereum(which is similar to web3j).
When I execute a transaction, I have this error
VM returned ...
1
vote
1answer
46 views
How to programmatically check the type of Ethereum node/backend that I'm connected to using Go?
I'm aware that I can do this using CURL like so:
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' https://the-node-ip-...
0
votes
1answer
98 views
connecting geth to web3.go 1.0 via websockets or HTTP
Is there anyThing similar to web3.js written in go that allows me to communicate with the geth client ?
3
votes
1answer
109 views
How to get an evm reference inside go-ethereum GetBalance function?
In order to modify GetBalance function to fork go-ethereum, I find difficulties to get a reference of the running evm. The function has a reference for self *StateDB:
func (self *StateDB) GetBalance(...
0
votes
1answer
55 views
Reading genesis config on GoLang
In a custom fork of Ethereum my team is developing, we need to read a new config parameter from genesis block. At https://github.com/ethereum/go-ethereum/blob/master/cmd/evm/runner.go#L100 the code ...
3
votes
1answer
493 views
Calling contract method internally from geth code
On developing a custom geth fork there is the need to call a specific hardcoded smart contract when ETH transfer occur. This is not an Ethereum normal behaviour but a new feature we want to implement ...
1
vote
0answers
321 views
No contract code at give address
Its a bit of a long question...
I am using Go to deploy a Smart Contract using the following code:
client, err := ethclient.Dial("http://localhost:8545")
if err != nil {
errorhandler.HandleErr(...
0
votes
1answer
201 views
Genesis allocation and (address, balance) tuples
On go-ethereum souce code at core\genesis_alloc.go(19):
...
package core
// Constants containing the genesis allocation of built-in genesis blocks.
// Their content is an RLP-encoded list of (...
1
vote
0answers
53 views
Handling EOF when subscribing to Event Logs
I'm trying to subscribe to events logs to handle Transfer(address,address,uint64) events. I've followed this example.
https://github.com/miguelmota/ethereum-development-with-go-book/blob/master/en/...
1
vote
1answer
111 views
How to parse input data in transaction using go programming language?
I know there are some resolutions about parsing transaction input data, but they don't work with go. I wander if there is any way i can use with abi available.
Specifically, When i receive a ...
4
votes
2answers
912 views
Given a RAW Transaction - how to get senders address
Is it possible to get the senders address using golang when all you have is the raw transaction string. I can decode it and get the nonce, hash, to etc as these are all exported functions from the ...
0
votes
1answer
114 views
Converting Log Topics to int64 correctly in Go
I currently use the code below to extract the ERC721 Token ID from Transfer Event Logs:
txHash := newLog.TxHash.Hex()
hexString := common.BytesToAddress(newLog.Topics[3].Bytes()).Hex()
flowerNum, _ :=...