Why? No, it wasn't. It's even there in the screenshot.
Discussion
i see ,sometimes it doesnt show up in my PC browser though. I can see the format button in my mobile phone browser,but it doesnt response when click the format button.

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))
看起来流程是对的,但是不知道 json_hash 是不是字节数组。
json_hash 是这样的
# Serialize the event data
serialized_event = json.dumps([
0,
event["pubkey"],
event["created_at"],
event["kind"],
event["tags"],
event["content"]
], separators=(',', ':'), ensure_ascii=False
)
print("json content:", serialized_event)
# hash the json using sha-256
json_hash = hashlib.sha256(serialized_event.encode('utf-8')).digest()
json_hash应该是二进制的哈希值吧?
n文档关于sig就这么一句话而已
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>
}
Yes, we don't use ECDSA, but BIP-340 (also known as "schnorr").
I don't know about Python or if that library has it, but take a look at some of the other Nostr Python libraries out there to see how they're doing it.
When asking AI about python schnorr, they give me ecdsa.
Schnorr signatures are a type of digital signature scheme that is known for its simplicity and efficiency. They are based on the hardness of the discrete logarithm problem and are used in various cryptographic applications, including Bitcoin.
Here's a basic implementation of the Schnorr signature scheme in Python. This example uses the ecdsa library, which you can install via pip if you don't have it already:
Sorry, that must mean your signatures are right then. I'll update the protocol spec to work according to what the AI says.