Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [golang]

Questions related to the Go programming language

0
votes
1answer
16 views

Golang Equivalent to list accounts on node - web3.eth.Accounts()

Does anyone know if its possible to get a list of the accounts on a node using golang, after Dialing to the node, basic PoC would be assuming the accounts are already unlocked via the CLI Basically ...
1
vote
0answers
26 views

How to convert string to type defined by an abi.Type for payload construction?

I am writing a CLI in Go that should faciliate users to be able to make contract function calls from it. This entails generating contract ABIs and providing input parameters to the function arguments ...
0
votes
1answer
29 views

How to correctly send RPC call using Golang to get smart-contract owner?

Update 12 November 2018 Someone shared a very close solution to what I was looking for here. Update 10 November 2018 Since I'm not able to achieve this using the approach in this question, I ...
0
votes
1answer
49 views

Golang binding - call contract method and get its return value or tuple?

Suppose i have contract like: pragma solidity ^0.4.11; contract MyToken { uint256 a; function SimpleGetter() returns(string) { return "something"; } function DoTheGreat(address _to) ...
0
votes
1answer
48 views

How do I check the Ethereum balance and unique transactions count of a Smart Contract over a period of time?

Basically I want to be able to track smart contracts balance and unique transactions over a period of time such as , last 24hours, last hour and so. What would be the best approach into doing this? ...
0
votes
2answers
23 views

Token transfer not dropped no event on MetaMask

I am using the following contract Fixed Contract Example And using this example to transfer token Transfer token example Everything goes fine, i see no error what so ever except MetaMask doesn't ...
0
votes
1answer
33 views

Golang - alloc large Wei amount to address

Im modifying the puppeth genesis wizard file for my own use case. I want to be able to assign a pre-set amount in Wei to a few chosen addresses.. Im having some trouble figuring out how to format the ...
1
vote
1answer
59 views

Golang How to slice Ethereum log events from smart contract to a more readable format

Im looking to use a channel to watch contract log events but the output returns a byte array like this the go code i am using looks like this package main import ( "...
2
votes
1answer
83 views

Invalid transaction signature on sending transaction

Hello guys I'm having a "Invalid transaction signature." error. Can't get pass this one. Am I missing something? client, err := ethclient.Dial("path/to/geth.ipc") if err != nil { return err } ks :...
2
votes
1answer
84 views

Cannot get transaction's field “From” using Golang

How I can get transaction's field "From"? client, err := ethclient.Dial("https://mainnet.infura.io") if err != nil { log.Fatal(err) } blockNumber := big.NewInt(5671744) block, err := client....
2
votes
1answer
105 views

ethereumjs-abi equivalent for Golang?

ethereumjs-abi is great for easily ABI encoding and decoding in javascript. Is there an equivalently simple package for Golang? Geth's accounts/abipackage does this, but there's a lot of setup and it'...
1
vote
1answer
57 views

It is possible to get bytecode from the evm in golang?

Imagine this scenario, I have a contract that has a function where I call with runtime.Call(). But this function returns an address of a newly created contract, but not the bytecode as runtime.Create ...
3
votes
0answers
50 views

Getting error message from require() using golang, and go-ethereum?

From everything I've been able to find, the only way you can get the error message from require() is by using remix which isn't practical for dealing with production issues. Therefore, I'm wondering ...
0
votes
1answer
125 views

go-ethereum event subscriptions doesn't work?

I'm new to go-ethereum and even Golang in general so my terminology might be wrong, I'm guessing event handling is also referred to as "subscription"? Anyways, my actual issue is that I want to test ...
0
votes
1answer
41 views

How to immediately close ethclient.Client RPC sockets so they don't linger in TIME_WAIT status on server?

My server is running out of available sockets while I am using goroutines (limited to 100 concurrently) because once a goroutine finishes the ethclient.Client socket stays open in TIME_WAIT status for ...
0
votes
2answers
29 views

Unable to retreive transaction balance before / after transfer

I am trying to wrap my head around the go ethereum library and sending transactions. The issue is that I want to be able to query the balance BEFORE the transaction and AFTER. The code below gives ...
1
vote
1answer
72 views

go-ethereum keccak256 multi value byte slice does not match solidity keccak256

I have a smart contract with the following function: function testHash( address _sender, uint8 _method, uint256 _number, uint256 _amount) public returns (bytes32) { ...
1
vote
2answers
439 views

Go Ethereum - get the enode before starting geth

I need to get the enode of my geth nodes before I start them up.. is there any way to do this via a command other than actually starting up the node ?
0
votes
0answers
155 views

Creating a new Consensus Algorithm based on Clique

Im working on refactoring clique consensus algorithm to use a smart contract. For my initial proof of concept I am using 2 files, each with 3 node addresses, I am using these files to populate the ...
0
votes
0answers
10 views

copying Config in node.New looks a bit weird

Recently I'm studying go-ethereum code and copying pointer of Config at node.New (node/node.go) looks a bit weird to me. Could you please check? // New creates a new P2P node, ready for protocol ...
0
votes
1answer
374 views

bower vs web3 vs nodejs vs golang apis

What benefits does the use of following bring to my Ethereum application if I wish to interact smart contracts for sending multiple transactions, upload files on blockchain, etc.? bower web3js ...
1
vote
2answers
171 views

How can we implement a new opcode in the Ethereum Virtual Machine.

How can we implement a new opcode in the Ethereum Virtual Machine. For eg : I want to implement an opcode logic such that the opcode number of this operation is 0x21. The EVM-implementation I am using ...
1
vote
1answer
230 views

From golang sha3 to solidity sha3

Trying to match "golang.org/x/crypto/sha3" lib with solidity sha3() is giving me a hard time. Its been discussed in here, but I somehow cant apply it in go. How do I handle a big.Int type s.t i get ...
1
vote
1answer
116 views

Adding JSON-RPC call in geth

I want to build a custom version of geth that provides a new JSON-RPC call to clients. It looks like there are two pieces to make that happen: (1) a Go implementation in internal/ethapi/api.go, and (...
1
vote
1answer
162 views

How to run local VM from golang?

I am going to run the virtual ethereum machine from the code, pass to it a compiled smart contract code. But I do not know how to do it. It's my code: package main import ( "context" "...
1
vote
1answer
491 views

How to send signed transaction to Ropsten through INFURA in Golang

I want to send and broadcast a signed transaction by sender to the Ropsten network through INFURA in Golang. I was able to send a signed transaction and recieved a response from INFURA as per below, ...
0
votes
0answers
20 views

display reported hashrate private pool

You have an idea to recover the reported hashrate on my private pool ? i use claymore and open ethereum pool . it is possible to create an api on my server that retrieves claymore stats? best ...
1
vote
1answer
118 views

How can I receive message by golang - whisper

In geth --shh --rpc console, for example I type f = shh.newMessageFilter({privateKeyId: id}, function(error, messages){console.log(JSON.stringify(messages))}) to receive a posted message by ...
0
votes
0answers
17 views

Problem while running “make geth” on Centos 7 [duplicate]

I'm getting error while trying to run 'make geth' command on Centos 7. Error text is : Please help me
1
vote
1answer
185 views

Using Golang how to get the number of transactions in a block

I cant seem to find any way to get the number or transactions within a block using the block number in golang.. anyone have any idea how to do this
0
votes
1answer
34 views

creating and array using type Big.Int and counting the sum of all integers inside it

Im communicating with a smart contract trying to get the balances from a list of addresses. I then want to get the sum of all balances but I am stuck on actually creating the array to store all the ...
2
votes
2answers
1k views

Convert byte Address to Hex

Using Geth I am reading from a smart contract and a list of addresses is retrieved when outputting to the terminal. These addresses are in byte array format: fmt.printLn("address", address) output = ...
2
votes
1answer
282 views

Developing native dapps with Go

so I was looking around for a decent up-to-date tutorial to start developing native dapps (C++ or GO doesn't really matter), but I can't seem to find a concise tutorial rather than this one. Can ...
1
vote
0answers
32 views

How to configure Geth for accepting future transactions without full sync?

I need to monitor a future (also known as pending or unconfirmed) transactions. First of all, let's start with the source code. In the core/tx_pool.go let's configure logging a little. Replace log....
0
votes
1answer
84 views

Cross chain call contract on ethereum from private network

Im looking for a way to call a contract that is deployed on the ethereum main network using Go (or JS/anything). From what i can see the foolproof way is to do so over json RPC but i would love to ...
1
vote
1answer
11 views

go-ethereum: SimulateBackend AdjustTime is not adjusting time at all, or either in unexpected ways

While using SimulateBackend I attempted to roll forward the time of the simulated blockchain using AdjustTime(604800 *time.Second) which should roll forward time by a week. Checking the returned error ...
1
vote
1answer
238 views

How to properly estimate gas costs of function calls with go-ethereum and golang?

I'm attempting to build out a program in golang to model ethereum gas costs of function calls for the smart contracts I write. I've successfully been able to estimate them using ethclient.EstimateGas ...
1
vote
1answer
520 views

Validating Go Ethereum key signature with ecrecover

Resolved The basic process flow of what I'm writing goes as follows. Sign a message with a private key and create an Ethereum address from the private key (AKA the vettingAddress) Pass the signature ...
1
vote
2answers
458 views

Unable to generate Go Ethereum Bindings using abigen

Not sure what the heck is going on, but I'm unable to use abigen to generate Go Ethereum bindings any more, I get an error that says EvalSymlinks: too many links solidity@pop-os:~/Documents/Code/...
3
votes
2answers
477 views

Ethereum HD Wallet implementation in Golang, is there any library in go?

I need a library in golang to implement HD Wallet.
1
vote
1answer
79 views

Need help with start mining(I am getting like this)

I am new to ethereum private blockchain System information: geth version:1.8.2 os&version:linux synopsis: when i tried to connect peers to my private blockchain it showing like WARN [03-20|11:...
1
vote
1answer
148 views

How to get Code from Contract Acccount?

I have a piece of code that connects to the network and displays transaction data. package main import ( "context" "fmt" "log" "github.com/ethereum/go-ethereum/common" "github....
0
votes
1answer
208 views

How to sign pieces of data (ie strings of text) with golang?

I'm trying to figure out how to sign a piece of data (in this case a string) using golang. So far everything I can find is about signing transactions which wont work for signing pieces of data that is ...
1
vote
0answers
107 views

How to calculate difficulty (int) based on (float)

I am trying to adapt my pool based on github.com/sammy007/open-ethereum-pool to nicehash protocol. It works more or less and I am receiving shares already, but I ran into the problem with difficulty ...
0
votes
0answers
223 views

golang version for web3 or light-weight library for eth development [duplicate]

As the title suggests. The most important thing is that it can help to sign the transaction provided that I have structed transaction params and the private key. I don't need it been able to connect ...
0
votes
1answer
94 views

How do I start to write a function to debug Transaction?

I want to write a program that will do: for the given txhash debug TraceTransaction and return that What can i do in Go ? Do you have any materials, a tutorial or can you give me tips on how to ...
1
vote
1answer
134 views

Can I generate multiple wallet addresses using one keystore?

I am trying to generate multiple wallet addresses using single keystore file. Can someone please advise me if it is possible? OR one keystore can only have one wallet address? I generate keystore and ...
0
votes
1answer
1k views

Get ERC20 Tokens Transferred Information from Transaction Hash

I am building very simple Golang program to get transaction details from HASH. I am able to get the information of any transaction but I am unable to get information what ERC20 token was transferred ...
0
votes
0answers
99 views

Golang Native DApp: increase gas limit in simulator

I am developing Native DApp in Golang and I am trying to use network simulator for testing purposes, but I have a problem increasing gas limit. Some time ago GenesisGasLimit in go-ethereum/params/...
0
votes
1answer
2k views

Geth-Maximum peer count?

I am wondering what does "Maximum peer count ETH=25 LES=0 total=25" What is this eth=25 ? Les = 0 ?"mean and why shoud we have maximum peer count. When we say peer count does it mean people who are ...