mleku on Nostr: i used standard btcec library to do it i don't get how it's being rejected, whatever ...
i used standard btcec library to do it
i don't get how it's being rejected, whatever algorithm you have checking the validity of the public key it generates is rejecting valid secp256k1 curve points
this is the checker in btcec:
// isOnCurve returns whether or not the affine point (x,y) is on the curve.
func isOnCurve(fx, fy *FieldVal) bool {
// Elliptic curve equation for secp256k1 is: y^2 = x^3 + 7
y2 := new(FieldVal).SquareVal(fy).Normalize()
result := new(FieldVal).SquareVal(fx).Mul(fx).AddInt(7).Normalize()
return y2.Equals(result)
}
i added that to recoder thing i did in case there was some issue, it decodes the nsec to raw bytes, then converts it to a btcec key pair, and runs the curve check on it and it's definitely a valid key
whatever library you are using is rejecting valid public keys, i guess i hit the jackpot lol
Published at
2025-04-21 22:41:09Event JSON
{
"id": "4df3c1b1fdbe4cc80770d775322f5f88bce85e413d0dec8e0ddf2028d58fe42e",
"pubkey": "4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f",
"created_at": 1745275269,
"kind": 1,
"tags": [
[
"e",
"ada13f124c118e6d2f6532bb0c2c5d38c3b06a718d73067bb763fa7720efaee3",
"",
"root",
"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
],
[
"e",
"f196779bc032718b25011e6757161e7bc24a12a9ded6b8a21df4cacd62f76095",
"wss://theforest.nostr1.com/",
"reply",
"7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19"
],
[
"p",
"7579076d9aff0a4cfdefa7e2045f2486c7e5d8bc63bfc6b45397233e1bbfcb19"
]
],
"content": "i used standard btcec library to do it\n\ni don't get how it's being rejected, whatever algorithm you have checking the validity of the public key it generates is rejecting valid secp256k1 curve points\n\nthis is the checker in btcec:\n\n// isOnCurve returns whether or not the affine point (x,y) is on the curve.\nfunc isOnCurve(fx, fy *FieldVal) bool {\n\t// Elliptic curve equation for secp256k1 is: y^2 = x^3 + 7\n\ty2 := new(FieldVal).SquareVal(fy).Normalize()\n\tresult := new(FieldVal).SquareVal(fx).Mul(fx).AddInt(7).Normalize()\n\treturn y2.Equals(result)\n}\n\ni added that to recoder thing i did in case there was some issue, it decodes the nsec to raw bytes, then converts it to a btcec key pair, and runs the curve check on it and it's definitely a valid key\n\nwhatever library you are using is rejecting valid public keys, i guess i hit the jackpot lol",
"sig": "45b3ad5c545639b7da701950a47149ffea8bc70bb93152b2748b7b352aeb0ebb151961dc3b2dd84ddf29419979b7160926dadd9277fd094f58f25349a97d7715"
}