Bitcoin Forum
November 01, 2024, 03:45:07 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin nanopayments library in Node  (Read 1511 times)
hi-entropy (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
August 18, 2013, 03:46:48 AM
 #1

I'm working on a probabilistic nanopayments library in Node: https://github.com/hi-entropy/bitcoin-nanopayment

It's an implementation of jevon's idea from this thread: https://bitcointalk.org/index.php?topic=62558.0

It's still very much alpha-stage, but it should be usable if anyone wants to start developing applications that make use of nanopayments.  I would love any feedback on documentation clarity, bugs, feature requests, or anything else about it!  So, yeah... have at it!  Cheesy
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
August 19, 2013, 12:23:37 PM
 #2

FYI,
https://github.com/gasteve/node-base58
https://github.com/gasteve/node-libcoin

Should be no need to create/duplicate base58 or bitcoin code, in node.js applications.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1104


View Profile
August 19, 2013, 04:40:45 PM
Last edit: August 19, 2013, 05:03:19 PM by TierNolan
 #3

It's still very much alpha-stage, but it should be usable if anyone wants to start developing applications that make use of nanopayments.  I would love any feedback on documentation clarity, bugs, feature requests, or anything else about it!  So, yeah... have at it!  Cheesy

According to the thread, the same functionality can be achieved using the micro-payment channels system?

Apparently not, that refers to the OP's version.

So,

Bob creates a transaction that pays 0.01 BTC from himself to <public key> which has a hash of H.

Bob says to Alice "Create a transaction which pays 1 BTC to me and is paid from <tx-hash> output 0" and also signs it with "anyone can pay".   <tx-hash> can be any in the range from S to S + N, when S = H - rand(N).

With "anyone can pay", Alice can add extra inputs without invalidating Bob's signature, but she can't change the output (sending the money to Bob).

Alice sends the transaction to Bob.

If <tx-hash> matches, then Bob can submit both his transactions to the network.

The risk is that Alice will submit a transaction spending the input at the same time she sends the transaction to Bob.  However, she doesn't know which of the 1000 transactions is the valid one.

Cost to double spend: f (since you have to pay the BTC fee to add the transaction in the block-chain)
Benefit of double spend: V / N (since that is the expected loss of not double spending)

As long as f > V / N, then it isn't worth double spending.  The means that N has to increase as the value goes up.  Ironically, the transaction fee makes this service useful and also adds to its security.

That's pretty cool.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
hi-entropy (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
August 21, 2013, 04:39:28 AM
 #4

Hi Jeff, thanks for taking a look!  I will definitely switch to use those libraries; they look much better than the current solution that I have shitpatched together.
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1134


View Profile
August 21, 2013, 05:29:02 PM
 #5

Very interesting work and neat protocol, congrats.
hi-entropy (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
August 22, 2013, 01:16:10 AM
 #6

Thanks Mike! Jevon and Casascius pretty much came up with the protocol, I just implemented it. I'll take credit for that though! Wink
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!