Questions tagged [golang]

Questions related to the Go programming language

Filter by
Sorted by
Tagged with
0
votes
1answer
17 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
57 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 = '...
0
votes
1answer
14 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
23 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
31 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.
0
votes
0answers
23 views

How to enable and use the accounting module?

I found the accounting module in this line and want to use them. i attached the accounting module to parameter --rpcapi accounting when run console node but could not found this module. run node: ....
1
vote
1answer
31 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
21 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 ...
0
votes
0answers
26 views

Problems trying to implement Nexus (NXS) Skein-Keccak (SK1024) in Golang

) I know this might not be the perfect place to ask, but as ETH is also a Blockchain Tech and also uses Go within their stack, I couldn't find a forum that seems more appropriate. My Problem: I'm ...
1
vote
0answers
23 views

How does one find/generate the SectionHead, CHTRoot and BloomRoot on a private network

I'm relatively new to go-lang and Ethereum, so I started off by deploying a private network at home and over a few servers. I'm now working on trying to get light clients to sync but I know for a fact ...
2
votes
0answers
30 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
94 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 ...
0
votes
0answers
43 views

Instantiation of an EVM on goLang

I'm dealing with goLang on an go-ethereum fork. In order to query a contract endpoint I need to get a fresh EVM reference for properly call the contract. I've found there is a NewEVM function that ...
1
vote
1answer
21 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
22 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
84 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
42 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 ...
0
votes
0answers
27 views

How to backup and restore txpool data?

I'm using Geth to create a PoA Clique based private blockchain. I'm currently facing this problem and I'm looking for ways to backup and restore txpool data. From the problematic node, this is my ...
2
votes
1answer
108 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
95 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
96 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 (...
0
votes
0answers
24 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/...
0
votes
0answers
24 views

Private Ethereum network. How to create block with go-ethereum library?

The other day I decided to play around with Ethereum and write a simple program that will load the network with transactions as close as possible to the real environment. For these needs, I used my ...
1
vote
1answer
59 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 ...
1
vote
2answers
268 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
39 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
25 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
107 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
48 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
56 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
2answers
480 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
269 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
39 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
37 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 ...
1
vote
1answer
752 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
61 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.
2
votes
2answers
128 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
166 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
262 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
247 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
85 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
49 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
2answers
97 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
176 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
165 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
151 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
429 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
87 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
67 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
408 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 ...