0

I am trying to make APIs in Go by using the ethapi. I need to call the below method from my golang code but i'm not able to call it. Can anyone help me?

func GetAPIs (apiBackend Backend) []rpc.API

1

In Go you can't import an external package if the import path contains the word internal otherwise you get the error use of internal package not allowed. The ethapi is an internal package.

source

  • Is there a fork of Go without stuff like remote dependencies, invalid use of internal, etc... – nick carraway Jun 7 '18 at 19:12
0

I am working in an open-source project to develop a new ethereum compatible blockchain replacing the default PoW by the PoA provided by Tendermint protocol.

To aim that we had to reimplement some of Ethereum APIs, such as net or miner, because in PoA they have different behaviour.

import "github.com/ethereum/go-ethereum/eth" 

func ... (..) .. {
   ethereum, err := eth.New(ctx, ethCfg); // Init ethereum node
   apis := ethereum.APIs(); // Fetch available ethereum apis
}

If you want to see more how we did that check our repository Lightchain, more specifically at this method.

I hope it was useful! :)

  • Your answer seems to be unrelated to the question asked about help using the Ethereum api in go. – Ismael Jun 2 '19 at 19:05
  • IMHO it is, as I pasted a link to an example on how to do it. To sum up: ``` import "github.com/ethereum/go-ethereum/eth" ... ethereum, err := eth.New(ctx, ethCfg); ethereum.APIs(); ``` You need to initialize a ethereum node object and then you can fetch the APIs – Gabriel G. Jun 2 '19 at 20:55
  • Please then put this code directly in the answer and remove the need to go to your external site. – Nicolas Massart Jun 3 '19 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.