Register ENS with NodeJS

Hello! How are you?
My name is Luca, i’am a fintech software engineer and I hope you could guide me in some issues im having with ENS. The last few months I’ve been researching about developing with ENS. Im trying to register an ENS only using NodeJS with etherjs, but I end up with an call_exception error in the final step of registerWithCommit(). I made an GitHub gist to show you what Im doing. Im in a rabbit hole of information so if you could help me or get me with someone who could know it would be really helpful.
Thank you.

Register an ENS domain with nodejs · GitHub

1 Like

Have you considered the 1 minute wait part after the commitment before calling register?

Edit: sorry I didn’t check the Git repo. Yes you did.

The gas limit of 31000 seem very low. Usually register takes max of 300,000 gas (safe bet).

e.g.:
https://etherscan.io/tx/0x2637077d369eeae3e154908ca62f86a0951c53234c0e115df75e6a2726aa8e26

Even though I increase the limit it still fails with the same error.

reason: 'transaction failed',
code: 'CALL_EXCEPTION',

Transaction details.

Thank you for the gas limit tip, I’ll consider it in future implementations.

edit: when is a gas related problem the reason specifies that, so I think is something else.

2 Likes

The resolver you’re using is for mainnet (0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41), try this for Goerli testnet: “0x4B1488B7a6B320d2D721406204aBc3eeAa9AD329”. The registrar will throw if you don’t have the right one provided.

1 Like

Nice catch! unfortunately still doesn’t work. (same generic error)

I created a replit so anyone who wants can easily test the script. You only have to change the address, private key and eth name.

2 Likes

I see, you forgot to provide the rent when calling the registration. The ABI registerWithConfig needed payable so I edited that. makeCommitmentWithConfig is needed for registerWithConfig.

https://replit(dot)com/@wolframeth/ENS-registration-with-NodeJS?v=1

The wallet account is test.

I adjusted the salt prod func. slightly but shouldn’t matter I would think.

https://goerli.etherscan.io/tx/0x2dca85d1a2627345d8fba634b925287ded77626bef5050b9d0f9fa9ec94b9c7d

3 Likes

Amazing. Works like a charm.
After seeing the solution I realize that I would have been lost for a long time haha.
Thank you so much!

2 Likes