All Questions
235 questions
30
votes
2
answers
5k
views
What is the merit of creating new smart contract languages like Solidity instead of using other languages?
What is the pros and cons of creating new languages like Solidity for smart contracts instead of using other computer languages like Golang or Python?
13
votes
5
answers
23k
views
why did it returned null after call miner.start()
> miner.start()
> null
before it , I had created a account like this .
user1 = eth.accounts[0]
"0xb62f0bae52d153365661c4e23ab1d594484e9bef"
11
votes
6
answers
16k
views
How to decode input data with ABI using golang?
There is a tool on npm ethereum-input-data-decoder. And yes, i can read input data as hex.
And i hope that i can decode transaction's inputdata using golang.
For example ...
10
votes
2
answers
5k
views
Raw transaction data in Go
I would like to generate raw transactions in golang without any go binding and I'm wondering if there is library to dynamically encode my argument parameter using go?
https://github.com/ethereum/wiki/...
8
votes
2
answers
6k
views
LevelDB in Geth, key and values
When parsing through the levelDB or RocksDB (Depending on the client you are using) there are string values representing the key and the value. These are both stored as Byte arrays as well.
My ...
8
votes
4
answers
10k
views
How to decode Log.Data in Go
I'm fetching the logs using client.SubscribeFilterLogs. The event parameters are encoded in types.Log.Data. How can I decode it in go?
8
votes
6
answers
5k
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 ...
7
votes
2
answers
3k
views
What's the best way currently to get events to a Go app that uses go-ethereum?
I have generated and used Go bindings to deploy a few contracts and that worked very well, but I see events are not implemented yet. Is this work discussed somewhere?
I'd like to understand what ...
6
votes
3
answers
7k
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 ?
6
votes
2
answers
4k
views
How to communicate with the JSON RPC server programmatically using Go?
Is there a way to interact with the JSON RPC server directly in Go?
I tried the following:
Starting the RPC Server with "geth --rpc"
Running the following code:
package main
import (
"fmt"
...
5
votes
2
answers
4k
views
Ethereum HD Wallet implementation in Golang, is there any library in go?
I need a library in golang to implement HD Wallet.
5
votes
3
answers
5k
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 ...
5
votes
2
answers
10k
views
How generate number type uint256 in Go
My smart contract has a function like this
function setTest(uint256 test) returns (bool){
testNumber = test;
return true;
}
I used these piece of code Go to create a transaction to set new ...
5
votes
1
answer
3k
views
ethereum-go how to get the latest block?
I've set up a private local Ethereum node with just a genesis block I made, and I have this Go code I want to run on the private local network:
package main
import (
"fmt"
"math/...
4
votes
2
answers
851
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 ...
4
votes
2
answers
8k
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 = ...
4
votes
2
answers
8k
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/...
4
votes
2
answers
4k
views
How to validate an etherum address (go)?
I'm looping through various addresses and I need to know which ones are BTC addresses and which are ETH addresses. So far I just check if the address is hex encoded. Is this function safe to use?
...
4
votes
1
answer
3k
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 ...
4
votes
1
answer
965
views
Convert pem public key into ethereum address by Go
I have ECC_SECG_P256K1 Public key PEM File generated by AWS KMS.
I want to convert pem public key into ethereum address by Go.
How can I get it?
Sample Pem Data
-----BEGIN PUBLIC KEY-----
...
4
votes
2
answers
10k
views
What's the difference between using Golang and writing code in Solidity to create a decentralized application?
I've been working on creating my first decentralized application, and I'm currently working on this tutorial which attempts to create a decentralized version of Twitter.
I want to integrate an IPFS ...
3
votes
4
answers
10k
views
Decode raw transaction
How can I decode a raw transaction using Go / go-ethereum ? There is no method/function to read the raw bytes or the hex into a transaction https://godoc.org/github.com/ethereum/go-ethereum/core/types ...
3
votes
2
answers
1k
views
Geth 1.6.1 hangs throwing "unexpected fault address" fatal error
Since upgraded to version 1.6.1, Geth node hangs form time to time (once a week) with following fatal error:
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7f6453b72c88 pc=...
3
votes
1
answer
2k
views
Dangling hash node ref: too many open files
I'm running two supernodes with the geth client. At peak times they have 500-800 connections and handle around 16GB traffic per hour.
This is how I run the node:
geth --networkid "1" --identity "...
3
votes
1
answer
481
views
Are there Ethereum API wrappers?
I'm looking into developing some Go software on Ethereum and I'm wondering - are there any API wrappers around for Ethereum (something like BTCSuite's BTCRPCClient is for Bitcoin)? I know there is a ...
3
votes
1
answer
2k
views
Is it possible to include Go code in a Solidity contract?
I've learned Solidity first and now I am learning the Go language. Throughout my learning process I am noticing that both languages are very similar. So, is it possible in future to include Go code in ...
3
votes
1
answer
5k
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 ...
3
votes
2
answers
1k
views
Using home brew to install ethereum but it keeps returning a make error
I am using home brew to install ethereum but it keeps returning this error. Is there anyway I can fix it?
3
votes
1
answer
3k
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 ...
3
votes
1
answer
278
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(...
3
votes
1
answer
581
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 ...
3
votes
1
answer
913
views
send a tx, json rpc, golang
I tried to send a tx via geth json rpc using the following code. But the geth rpc server response with "Invalid sender".
I also tried HomesteadSigner. In that case there is no error received, but I ...
3
votes
1
answer
84
views
for loop containing types.Sender sometimes does not leave and consumes 100% CPU
I have this simplified code here:
signer := types.LatestSignerForChainID(s.ethApiBackend.ChainConfig().ChainID)
log.Info("Before msg generation", "txsLen", len(txs))
msgs := make([]...
3
votes
2
answers
1k
views
Verified go signature in solidity (EIP712 TypedData)
I am trying to recover the signer of a TypedData message (eip712).
I am able to sign and verify with ethersJS and validate in the contract as well.
With Go, I can sign and verify as well but the ...
3
votes
1
answer
3k
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 ...
3
votes
0
answers
191
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 ...
3
votes
1
answer
1k
views
How to access non-indexed event arguments from Go types.Log?
The Go bindings have a type called Log that has the following fields
type Log struct {
// Consensus fields:
// address of the contract that generated the event
Address common.Address `...
3
votes
1
answer
2k
views
Encode method signature and parameters using Go-Ethereum
Is there any way to use the Go-Ethereum library to get the string I have to send to JSON RPC to call a contract method. I mean, Go-Ethereum comes with a CLI, so there must be some built-in functions ...
2
votes
2
answers
2k
views
Await transaction using `go-ethereum/ethclient`
In ethers.js, one can wait for a transaction to be mined with wait(). Is there a way to do this when using ethclient from go-ethereum as a package? I would like to wait for the result before moving on ...
2
votes
1
answer
3k
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(...
2
votes
2
answers
1k
views
type *types.Transaction has no field or method AsMessage)
I am following
https://github.com/miguelmota/ethereum-development-with-go-book/tree/master/en/transaction-query
Complete code
package main
import (
"context"
"fmt"
&...
2
votes
2
answers
6k
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
3
answers
479
views
How to implement the below solidity code in golang? especially the `abi.encode` function?
How to implement the below solidity code in golang? especially the abi.encode function?
abi.encode(
keccak256("delegate(address sender,string amount, string to)"),
sender,
amount,...
2
votes
1
answer
2k
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 = '...
2
votes
1
answer
2k
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 ...
2
votes
1
answer
3k
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 ...
2
votes
1
answer
693
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....
2
votes
1
answer
1k
views
Go can't find common and types package when building Geth client node project?
I am trying to build the Ethereum Geth client node on an Ubuntu 14.04 LTS box. I am using the 2017.3 Goland client. When I try to compile the project I get the errors below:
interfaces.go:25:2: ...
2
votes
1
answer
555
views
error when getting TransactionReceipt from parity node with ethereum-go
In my golang oracle, I need to get the TransactionReceipt for my transaction.
To do so I call client.TransactionReceipt(context.TODO(), txHash)
This yields a transaction receipt when the node is ...
2
votes
1
answer
132
views
How to correctly pack Log data in Go
Using go-ethereum, I want to convert a struct containing my log fields into a types.Log{} object containing the data bytes and topics. Essentially, I want to do the opposite of the Parse<EventName&...