For the following tutorial, we will make references to https://github.com/Giulio2002/hello-tg-daemon.
We are going to build our daemon using golang and turbo-geth 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`).
our daemon will only contain one method: `myNamespace_getBlockNumberByHash` which will return the block number associated to certain hash.
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 turbo-geth 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.
**Note: Remember to run turbo-geth with --private.api.addr=localhost:9090**