Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[memocash/memo]: Add private/direct message support? #40

Open
chaintip opened this issue Jul 3, 2018 · 4 comments
Open

[memocash/memo]: Add private/direct message support? #40

chaintip opened this issue Jul 3, 2018 · 4 comments

Comments

@chaintip
Copy link
Owner

chaintip commented Jul 3, 2018

Repository: memocash/memo
Issue #58: Add private/direct message support?

I suggest adding a new memo message type to the protocol which would be I guess 0x6d15?

It would simply be an encrypted message, where the encryption is via your private key and the public key of the address you are sending the message to. You can encrypt via https://github.com/kevinejohn/bitcoin-encrypt (with the binary encrypted message then base64 encoded and posted to memo), and you can find people's public keys by doing something like https://github.com/zhoujianfu/Public-Key-from-BCH-Address .

Note, if an encrypted message is too long for the OP_RETURN, it should instead be posted to a public url, and just that URL is encrypted and posted in the memo message. Kind of like a pointer. Here's a little php script to post a too-long encrypted message to pastebin site paste.city for example (and get the URL to the text).

$txt = 'txt='.urlencode('encryptedtextthatistoolongforanOP_RETURN');
$url = 'https://paste.city';

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $txt);
curl_setopt($ch,CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);
$headers = get_headers_from_curl_response($result);
$parts = preg_split("/\//",$headers['Location']);
print $url.'/'.$parts[1]."\n";

curl_close($ch);

function get_headers_from_curl_response($response) {
    $headers = array();
    $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
    foreach (explode("\r\n", $header_text) as $i => $line) {
        if ($i === 0) {
            $headers['http_code'] = $line;
        } else {
            list ($key, $value) = explode(': ', $line);
            $headers[$key] = $value;
        }
    }
    return $headers;
}

When going to read DMs, memo.cash would just look at the stream of ALL 0x6d15 messages (since the last time they attempted to read DMs), and attempt to decrypt them with their own private key. If you can decrypt it, that means the message was to you! By using this technique, nobody can actually even see publicly who is DMing whom! Hmm, I suppose you'd need an automated way to know if a message was successfully decrypted. Maybe each decrypted message should start with some short standard code like "OK"?

Here's a little discussion of the idea on memo.cash:
https://memo.cash/topic/Direct%2FPrivate+Messages

Overall, I think this would be super-duper awesome and allow a whole wealth of new features in the memo protocol! Like, you can basically reproduce craigslist if you have private messages! And make all sorts of decentralized marketplaces as well.

Please please please consider implementing it!


Total Bounty: 0 BCH| ~ 0.00 USD

To claim this bounty, get a pull request merged with @chaintip fixes #58 in the creation comment.

Returned Tips:

  • 0 BCH| ~ 0.00 USD from zhoujianfu returned 2 years ago.
  • 1.26615414 BCH| ~ 520.30 USD from zhoujianfu returned 2 years ago.

Pull Requests Fixing Issue:

  • [PR #76] Private messages
@DJMcNab
Copy link

DJMcNab commented Jul 30, 2018

@chaintip has the bot bugged out - it is more than two weeks after the bounty was set!

Edit: I wasn't trying to tip it 🥇

@chaintip
Copy link
Owner Author

You can't tip a bounties issue... it creates all sorts of confusion :)

@testtip
Copy link

testtip commented Sep 28, 2018

@DJMcNab, yeah, sorry, it seems that it has. Looking into it now. Wow, that took a long time!

@testtip
Copy link

testtip commented Sep 28, 2018

@zhoujianfu please check your email. I've sent you to check what's up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants