Stack Exchange Network

Stack Exchange network consists of 175 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
0answers
6 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
0answers
22 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, _ :=...
0
votes
1answer
14 views

How does one go about implementing the ContractTransactor interface from the bind package in go-ethereum?

Hey guys thanks in advance! Here is the interface provided by the go-ethereum library in the bin package. I need an example on how to implement this interface please :) // ContractTransactor ...
0
votes
0answers
21 views

Golang web3.eth.abi.encodeParameters equivalent

I need to encode some data in golang like using the web3.eth.abi.encodeParameters(paramsTypes[], params[]) I tried to use golang's ABI.Pack(functionName string, params) but it's not a good solution ...
0
votes
0answers
22 views

Can I use a WebSocket client for multiple abigen watchers?

I have question about abigen and websocket. My code is in Go. I'm sending a bunch of transactions using abigen and I'm using abigen to watch each of the transaction and do something when it's mined. ...
0
votes
0answers
31 views

Balance from ethereum accounts on geth disappears

I have geth private network with 3 accounts A, B and C. each account has 100, 200 and 300 ether balance I connected to this network from Metamask and Transferred the balance of 50 eth from account A ...
1
vote
1answer
48 views

GoEthereum getting public key from private key hex formatting

So I am trying to get public key in hex formatting. In some documentation I found the following will give public key from the private key, but it is not formatted correctly as I can see: publicKey := ...
2
votes
1answer
37 views

goethereum getting publicKeyBytes from given public key

Trying to follow this documentation on verifying a signature: https://goethereumbook.org/signature-verify/ Where I am a bit confused is this line: publicKeyBytes := crypto.FromECDSAPub(...
0
votes
1answer
32 views

Private ethereum network account related query

Please help with below queries: how to reset the paraphrase for an account on private ethereum network Is there a way to delete an account on private ethereum network How to enable the etherscan url ...
0
votes
0answers
20 views

Metamask to Private ethereum communication issue [duplicate]

When i connect to my private ethereum network using the 'Custom RPC' of the metamask, it is getting connected from the MetaMask. FYI, i am connecting from outside the network of my server, and all ...
0
votes
0answers
92 views

How to fix “unexpected directory layout” error when Installing go-ethereum?

All, I hope this question belongs here. I am following a Blockgeeks tutorial, trying to set up my environment for Ethereum blockchain development. I have basically gotten to the final step, ...
0
votes
1answer
21 views

How to use event log in solidity contract using go language

I have created ethereum smart contract using go language. Smart contract successfully deployed. I have a created many transactions on ethereum private network. But I confuse how to get event log.
0
votes
1answer
37 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 ...
2
votes
1answer
75 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
144 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
111 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
57 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
29 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
50 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
88 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
108 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
100 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
176 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
67 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
57 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
225 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
54 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
35 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
93 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
724 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
163 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
11 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
553 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
209 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
344 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
134 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
185 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" "...
2
votes
1answer
628 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
21 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
148 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
19 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
2
votes
1answer
254 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
56 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
2k 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
403 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
40 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
94 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
12 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
284 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
657 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 ...