I think I asked it wrongly. I don't want to load those libraries externally from a CDN or so, just seeing everything together in one file so I can understand the process and there are no external dependencies. Such as https://www.bitaddress.org/ is using one file for generating bitcoin keys. ChatGPT told me to use secp256k1 key generation, but Bech32 can be used as well?

Reply to this note

Please Login to reply.

Discussion

Bech32 is how npubs are encoded from hex keys. Secp256k is the right curve for generating nostr keys.

Thanks again. I tried it again, and what I've understood now is that ChatGPT tried to let me use libraries that are for server side (nodejs), so I used browserify to make client side versions of elliptic and bech32 and told chatgpt to use those. The result is at https://gitlab.com/no-limit/hi-plebs/ . Still it's not working. At https://hi-plebs-no-limit-bdb95ca026aabb14656ee72db9d19f41c60c53621bc67.gitlab.io/ a websocket is connecting to a relay well, but when sending a note I am getting "Failed to process private key: EC is not a constructor". Do you know if there is some documentation how to handle the elliptic library with nostr client side? As elliptic file is too big to be fully read by chatgpt.