From 451c9bc4158e2d69aa6fffd626ea7c19a86a7aa3 Mon Sep 17 00:00:00 2001 From: KJ Date: Tue, 14 Feb 2023 23:31:59 +0800 Subject: [PATCH] Create ETH address support --- N.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 N.md diff --git a/N.md b/N.md new file mode 100644 index 0000000000..678687c8b5 --- /dev/null +++ b/N.md @@ -0,0 +1,48 @@ +NIP-N +====== + +ETH address support +------------ + +`draft` `optional` `author:kernel1983` + +This NIP defines the alternative address system that the user may choose to use. New NIPs may choose to support this NIP to work with the ETH compatible NFT, DID and token ecosystem. + + +## Events and signatures + +Each user has a secret/private key. Signatures, address, and encodings are done according to the Ethereum way. + +In the `event`, will change the `pubkey` to `eth_addr` : + +```json +{ + "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data, no "0x"> + "eth_addr": <42-bytes lowercase eth addr of the event creator started with "0x">, + "created_at": , + "kind": , + "tags": [ + ["e", <32-bytes hex of the id of another event>, ], + ["p", <32-bytes hex of the key>, ], + ... // other kinds of tags may be included later + ], + "content": , + "sig": <132-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field, started with "0x"> +} +``` + +To obtain the `event.id`, we `sha256` the serialized event. The serialization is done over the UTF-8 JSON-serialized string (with no white space or line breaks) of the following structure: + +```json +[ + 0, + , + , + , + , + +] +``` + +The client and relay may detect the field `pubkey` or `eth_addr` and the length, 0x prefix to check which type user is using. +