Bitcoin Forum
May 12, 2024, 07:38:20 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ANN] Node.js ECIES. Encrypt messages to Bitcoin Addresses!  (Read 4637 times)
bardi.harborow (OP)
Member
**
Offline Offline

Activity: 114
Merit: 10



View Profile
May 28, 2014, 12:26:00 AM
 #1

Hey BitcoinTalk!

Just thought I'd show you all my latest invention. Node-ECIES is a Node.js implementation of ECIES, a little known elliptic curve encryption system using ECDH and a Symmetric Cipher (not sure which one, maybe AES). What that means in English, is that given a Bitcoin address' public key, you can encrypt messages to it. Now, this is not all my work, all I did was put a wrapper around node-cryptopp, which in turn is a set of bindings for Crypto++. What I did do is figure out how to use node-cryptopp to do ECIES. Note that you can't send messages to bitcoin addresses, only to public keys, which are available if the user has sent bitcoins from their address.

You can query for the public key by doing: https://blockchain.info/q/pubkeyaddr/1Bardi4eoUvJomBEtVoxPcP8VK26E3Ayxn

Usage:
Code:
var bitcoin = require('bitcoinjs-lib'),
     ecies = require('ecies');
var text = 'Secret ECIES Test Message!';
/* sha256('correct horse battery staple') */
var publicKey = '0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455';
var privateKey = bitcoin.ECKey('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS').toHex();
var cipherText = ecies.encrypt(text, publicKey, 'secp256k1');
var decryptedText = ecies.decrypt(cipherText, privateKey, 'secp256k1');
console.log(text, '->', cipherText, '->', decryptedText);

Install:
Code:
npm install ecies

Source Code
NPM

And of course, where would I be without a selfish request for donations. Coins sent to the address in the signature pay for me to create implementations in different languages.

Have a nice day.
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715542700
Hero Member
*
Offline Offline

Posts: 1715542700

View Profile Personal Message (Offline)

Ignore
1715542700
Reply with quote  #2

1715542700
Report to moderator
1715542700
Hero Member
*
Offline Offline

Posts: 1715542700

View Profile Personal Message (Offline)

Ignore
1715542700
Reply with quote  #2

1715542700
Report to moderator
ThePurplePlanet
Full Member
***
Offline Offline

Activity: 144
Merit: 100


View Profile
May 28, 2014, 02:22:34 AM
 #2

Maybe it is better to post it at Bitcoin dev discussion or  projects discussion
str4wm4n
Legendary
*
Offline Offline

Activity: 1611
Merit: 1001


View Profile
May 28, 2014, 05:19:44 AM
 #3

awesome, I always wondered if this was possible!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!