M
M
Meksvinz2019-03-03 13:16:06
go
Meksvinz, 2019-03-03 13:16:06

How to create a block using the go-ethereum library?

In general, I decided to study the issue of writing a program in the Go language that will create accounts in the test (private) Ethereum network and drive transactions between them (this is necessary to approach the real network environment, where more than one transaction passes per second). I immediately found go-ethereum, and quickly realized that there is very little information on this lib, and if there is, it comes down to creating a couple of accounts or interacting with geth.
Using the method of highly scientific poke, I learned how to create key pairs and create accounts based on them so that the same geth can see these accounts. I even learned how to send a transaction to the network. But I still don’t understand how to create a block (mining, mining). In geth, this is done indecently simply by miner.start (), but in go-ethereum you will understand horseradish. The only worthwhile thing that can somehow help is this method, which returns a pointer to the Miner type

func New(eth Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, recommit time.Duration, gasFloor, gasCeil uint64, isLocalBlock func(block *types.Block) bool) *Miner

But he just takes some wild number of incomprehensible arguments as an input (to me personally, as a beginner in go-ethereum, incomprehensible).
If at least someone knows in which direction to dig here or how to implement the creation of a block using go-ethereum, please help. Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-03-03
@dimonchik2013

Well, if you get comfortable with geth itself and can run it in miner mode, why complicate your life?

S
Semyon Novikov, 2019-03-13
@semennovikov123

There seems to be nothing about creating a block, but in any case, this is very useful material for working with go-ethereum:
https://goethereumbook.org/en/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question