看起来流程是对的,但是不知道 json_hash 是不是字节数组。
Discussion
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>
}