What is Nostr?
npub13zy…2rce
2025-03-11 11:52:22

npub13z…l2rce on Nostr: "sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized ...

"sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field>
}

how to sign event correctly, always get response from relay: false,"invalid: bad signature"?
getting this error at least mean event id is correct, otherwise it will show bad event id.

def compute_event_id(json_string):
return hashlib.sha256(json_string.encode('utf-8')).digest()
def sign_event(private_key, event_id):
sk = ecdsa.SigningKey.from_string(bytes.fromhex(private_key), curve=ecdsa.SECP256k1)
signature = sk.sign(event_id)
return signature.hex()


#asknostr
Author Public Key
npub13zyg3zysfylqc6nwfgj2uvce5rtlck2u50vwtjhpn92wzyusprfsdl2rce