We are going to build our daemon using golang and Erigon packages, so first of all we are going to create a file in which we are going to store our API methods and informations. (`api.go`).
The type `Api` is the type that is going to contain the methods for our custom daemon. This type has two members: `kv` and `db` which are objects used to interact with the Erigon node remotely. they behave like normal db objects and can be used alongside with the rawdb package.
In our example we are making an rpcdaemon call that by receiving a certain block hash, it give the block number associated as an output. this is all done in `GetBlockNumberByHash`.
Now we are going to make our `main.go` where we are going to serve the api we made in `api.go`.
In the main we are just running our rpcdaemon as we defined it in `APIList`, in fact in `APIList` we are configuring our custom rpcdaemon to serve the ExampleAPI's mathods on namespace `myNamespace` meaning that in order to call GetBlockNumberByHash via json rpc we have to call method `myNamespace_getBlockNumberByHash`.
Let's now try it:
..code-block:: sh
$ go build
$ ./hello-tg-daemon --http.api=myNamespace # the flag enables our namespace.