How to convert a private key from phantom (not the seed phrase) into format the CLI expects? (keypair.json, an array of numbers)

I have a private key from a phantom wallet (not the seed phrase). How do I convert it to the format the CLI expects? (array of numbers)

From Private Key from phantom = kahu3h1988178…
To keypair.json = [121,18,10…

I can’t believe this is not in the documentation

Hi @come0x and welcome to the forum! :wave:

You are right, it is very annoying that Phantom doesn’t just allow exporting the private key as a JSON array like the commandline expects. I created a script to convert it. See this comment and the surrounding thread: