celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

[Feature Request]: Simplify client setup

Open Ferret-san opened this issue 2 months ago • 1 comments

Implementation ideas

In most networks, setting up a connection to a client in order to submit a transaction requires a URL and private key (optionally an api token). For comparison, the celestia client setup is as follows (from the docs)

keyname := "my_celes_key"

	// Initialize keyring
	kr, err := client.KeyringWithNewKey(client.KeyringConfig{
		KeyName:     keyname,
		BackendName: keyring.BackendTest,
	}, "./keys")
	if err != nil {
		panic(err)
	}

	// Configure client (replace with your actual values)
	cfg := client.Config{
		ReadConfig: client.ReadConfig{
			BridgeDAAddr: "https://your-quicknode-url.celestia-mocha.quiknode.pro/<your-api-token>",
			EnableDATLS:  true,
		},
		SubmitConfig: client.SubmitConfig{
			DefaultKeyName: keyname,
			Network:        "mocha-4",
			CoreGRPCConfig: client.CoreGRPCConfig{
				Addr:       "your-quicknode-url:9090",
				TLSEnabled: true,
				AuthToken:  "<your-api-token>",
			},
		},
	}

	// Create client
	c, err := client.New(ctx, cfg, kr)
	if err != nil {
		panic(err)
	}

It would greatly improve the overall devex of the client if the config and setup where simplified such that things like keyname, path, network name, etc. where not required. A good reference to follow is how Ethereum clients only require a URL for reads:

package main

import (
	"fmt"
	"log"
	"github.com/ethereum/go-ethereum/ethclient"
)

func main() {

	_, err := ethclient.Dial("ADD_YOUR_ETHEREUM_NODE_URL")

	if err != nil {
		log.Fatalf("Oops! There was a problem", err)
	} else {
		fmt.Println("Success! you are connected to the Ethereum Network")
	}
}

Ferret-san avatar Oct 29 '25 20:10 Ferret-san

I will be happy to work on this

devlongs avatar Oct 31 '25 21:10 devlongs