Avatar
Heri Sim
b8c85be89f697ebcd0ff6df6c7c28bbb461ebb2b2b1f0e0a3aa433a5f8484f8f
I provide Analysis and Reasoning as to the future price of Bitcoin in the short-term. Definitely an OG.
Replying to Avatar fiatjaf

The code is at https://github.com/fiatjaf/nostr-json-benchmarks

(as you can see, the "leaner" codec is much faster than anything else when running on Go.)

The javascript code does not seem optimal.

Avoid using ‘data.buffer.slice()’ as it allocates memory and creates a copy.

Have you tried using ‘new DataView(data.buffer, byteOffset, byteLength)’ to reference the same buffer?

If you need more performance, you may also use ‘new Uint8Array(data.buffer, byteOffset, length)’ which is common practice.

Replying to Avatar fiatjaf

The code is at https://github.com/fiatjaf/nostr-json-benchmarks

(as you can see, the "leaner" codec is much faster than anything else when running on Go.)

The is code does not seem optimal.

Avoid using ‘data.buffer.slice()’ as it allocates memory and creates a copy.

Instead use ‘new DataView(data.buffer, byteOffset, byteLength)’ to reference the same buffer.

Actually it is pretty close.

Just need "event.sig" (of event.id) like kind 1.

Also "?cipher=aes-gcm" and "?ePubKey=" in the "event.content".

#[3]​ #[4]​ Thoughts?

It even rewrote it! 🐶🐾🤯

NIP-04

======

Enhanced Encrypted Direct Messaging

-----------------------------------

`final` `optional` `author:ChatGPT`

A special event with kind `4`, representing an "enhanced encrypted direct message". The message includes the following attributes:

**`content`** MUST be equal to the base64-encoded, AES-256-GCM or ChaCha20-Poly1305 encrypted string of the user's intended message. This should be encrypted using an ephemeral key derived from Diffie-Hellman key exchange using the recipient's public key and the sender's temporary private key. This appended by the base64-encoded initialization vector and authentication tag as query string parameters named "iv" and "at" respectively. The format is the following: `"content": "?iv=&at="`.

**`tags`** MUST contain an entry identifying the receiver of the message using a rotating anonymous identifier, such that relays may naturally forward this event to them. The form is `["p", ""]`.

**`tags`** MAY contain an entry identifying the previous message in a conversation or a message we are explicitly replying to (such that contextual, more organized conversations may happen), in the form `["e", ""]`.

**Note**: The Diffie-Hellman key exchange should be implemented to support Perfect Forward Secrecy (PFS).

Here's an illustrative code sample for generating such an event in JavaScript:

```js

import crypto from 'crypto'

import * as secp from '@noble/secp256k1'

let ephemeralPrivateKey = crypto.randomBytes(32)

let sharedPoint = secp.getSharedSecret(ephemeralPrivateKey, '02' + theirPublicKey)

let sharedKey = sharedPoint.slice(1, 33)

let iv = crypto.randomBytes(16)

var cipher = crypto.createCipheriv(

'aes-256-gcm',

Buffer.from(sharedKey),

iv

)

let encryptedMessage = cipher.update(text, 'utf8', 'base64')

encryptedMessage += cipher.final('base64')

let ivBase64 = Buffer.from(iv).toString('base64')

let atBase64 = Buffer.from(cipher.getAuthTag()).toString('base64')

let event = {

pubkey: ourPubKey,

created_at: Math.floor(Date.now() / 1000),

kind: 4,

tags: [['p', theirAnonymizedId]],

content: encryptedMessage + '?iv=' + ivBase64 + '&at=' + atBase64

}

```

## Security Warning

Although this standard represents a significant improvement over the previous version, it should be treated with caution and must not be used for communication that needs to remain absolutely confidential. Always consult with a security expert or perform a security audit before deploying cryptographic protocols.

## Client Implementation Warning

Clients *should not* search and replace public key or note references from the `.content`. If processed like a regular text note (where `@npub...` is replaced with `#[0]` with a `["p", "..."]` tag), the tags are leaked and the mentioned user will receive the message in their inbox. Additionally, clients should use rotating anonymous identifiers to reference users, adding another layer of privacy to the protocol.

Using ephemeral sender key for each DM is much better for forward secrecy.

The kind 4 event is still signed with the long-term sender key?

Night Crowd @ Suara Festival Bali

#grownostr #festival

Lively Disco Africa @ Suara Festival Bali

#grownostr #festival #video

Disco Africa @ Suara Festival Bali

#grownostr #festival

Eco Architecture @ Suara Festival Bali

#grownostr #festival #architecture

Spa Market @ Suara Festival Bali

#grownostr #festival

Crowd @ Suara Festival Bali

#grownostr #festival

Crowd @ Suara Festival Bali

#grownostr

Drink bar @ Suara Festival Bali

#grownostr #suarafestival

ZeroX @ Suara Festival Bali

#grownostr #suarafestival

There is no inflation if everything is priced in BTC?

Are things more expensive now in BTC terms?

Ivan on Tech finds correlation between meme coins pumping and BTC dumping

https://youtu.be/KOVafxC0H0I