阿甘 on Nostr: I can generate the correct event_id, but always get bad signature. Any wrong with my ...
I can generate the correct event_id, but always get bad signature. Any wrong with my sign?
from ecdsa import SigningKey, VerifyingKey, SECP256k1
# create event id
event_id = json_hash.hex()
print("event id:", event_id)
print("evnt id length:", len(event_id))
# signature the json_hash
signature = sk.sign(json_hash)
#convert to hex
sig_hex = signature.hex()
print("sig:", sig_hex)
print("sig length:", len(sig_hex))
Published at
2025-03-12 09:03:18Event JSON
{
"id": "810bcab03898271651ee1e88925abc08195cfd60b782181cbfdde64296518e12",
"pubkey": "8888888890493e0c6a6e4a24ae3319a0d7fc595ca3d8e5cae19954e1139008d3",
"created_at": 1741770198,
"kind": 1,
"tags": [
[
"t",
"convert"
],
[
"e",
"04026697f8533f730473a214838ad757f22405bcdb43ce3ef4fe4cc9ac63a2cd",
"wss://relay.damus.io/",
"root"
],
[
"e",
"000069058b14910a079b9a58f4c34aed5728c6e6dc22adfdd21523328519f6f2",
"wss://nos.lol/",
"reply"
],
[
"p",
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"
]
],
"content": "I can generate the correct event_id, but always get bad signature. Any wrong with my sign?\n\nfrom ecdsa import SigningKey, VerifyingKey, SECP256k1\n\n# create event id\nevent_id = json_hash.hex()\nprint(\"event id:\", event_id)\nprint(\"evnt id length:\", len(event_id))\n\n# signature the json_hash\nsignature = sk.sign(json_hash)\n\n#convert to hex\nsig_hex = signature.hex()\nprint(\"sig:\", sig_hex)\nprint(\"sig length:\", len(sig_hex))\n",
"sig": "5c78be7529ec71dc95fa80cb9aa561dca3569c39fe6be78101baea32c37f5f38d612f7d56afb84a62ce65a6f52fb260d492f5d80daf06b4d56cc25ec8bab47c9"
}