gagliardetto / solana-go

Go SDK library and RPC client for the Solana Blockchain
Apache License 2.0
942 stars 266 forks source link

Issue with solana-go Library: Unable to Recover Funds Due to 65-Byte Private Key Generating Public Key #256

Closed algopsycho closed 3 weeks ago

algopsycho commented 3 weeks ago

Hi,

I mistakenly used a private key with an extra character (making it 65 bytes instead of the standard 64 bytes).

Using this invalid 65-byte private key, I generated a public key with the solana-go library.

I sent funds to this public key. Now, I'm unable to access the funds because the private key is invalid, and standard methods are not working.

Does anyone have any ideas how to fix this issue?

gagliardetto commented 3 weeks ago

hi @algopsycho

unfortunately there's no way to recover funds sent to an invalid public address (if the private key is invalid, then you can't create valid signatures with it and thus can't send any transaction that moves the funds).

gagliardetto commented 3 weeks ago

Please also DON'T click on random support links.

algopsycho commented 3 weeks ago

hi @algopsycho

unfortunately there's no way to recover funds sent to an invalid public address (if the private key is invalid, then you can't create valid signatures with it and thus can't send any transaction that moves the funds).

Understood, thought might be a chance it created a PDA and could write some program to transfer the funds, but all leads back to the fact that it's an invalid private key.

However, I wonder why it would even be allowed to create a public key if the private key is invalid?

gagliardetto commented 3 weeks ago

However, I wonder why it would even be allowed to create a public key if the private key is invalid?

Missing checks. I'll add a panic.