Bitcoin Forum
May 04, 2024, 10:08:25 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: NBitcoin : Payment Protocol Implementation  (Read 637 times)
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 619


View Profile
May 31, 2014, 03:33:01 PM
 #1

Hello all,
I'm happy to announce the release of NBitcoin v1.0.4.1, which include the payment protocol (BIP 70, 21, 72).
How to use can be found in the tests here : https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin.Tests/PaymentTests.cs

Example
Quote
public void CanTalkToPaymentServer()
{
   using(var server = new PaymentServerTester())
   {
      var uri = server.GetPaymentRequestUri(2);
      BitcoinUrlBuilder btcUri = new BitcoinUrlBuilder(uri);
      var request = btcUri.GetPaymentRequest();
      Assert.True(request.VerifySignature());
      Assert.Equal(2, BitConverter.ToInt32(request.Details.MerchantData, 0));
      var ack = request.CreatePayment().SubmitPayment();
      Assert.NotNull(ack);
   }
}

Have fun ! Wink

Github : https://github.com/NicolasDorier/NBitcoin
Nuget : https://www.nuget.org/packages/NBitcoin/

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
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!