Unofficial C# client library for Peach Bitcoin API - a peer-to-peer platform for non-KYC Bitcoin trading. Currently in early development.
Official API Docs: https://docs.peachbitcoin.com/
- PeachApiClient (
src/Core/PeachApiClient.cs) - Main API client with RestSharp HTTP wrapper - MessageSigner (
src/Core/MessageSigner.cs) - ECDSA signature generation for authentication - Models (
src/Core/Models/) - DTOs for offers, users, filters, requests
- NBitcoin 9.0.1 - Bitcoin crypto operations
- RestSharp 112.1.0 - HTTP client
- SharpX 8.3.6 - Functional utilities (Maybe monad, guards)
- Microsoft.Extensions.* - Logging, DI, Options pattern
Uses public key cryptography with BIP32 key derivation:
- Derive key from master using path
m/48'/0'/0'/0' - Sign message:
"Peach Registration {unix_timestamp_ms}" - Create ECDSA signature (SHA256 hash, compact 64-byte format)
- Submit to
/user/registeror/user/authwith public key + signature - Receive JWT access token (valid 60 min)
- Include token in
Authorization: Bearer {token}header
Implementation: MessageSigner.CreateSignature() in MessageSigner.cs:13-42
GetSystemStatusAsync()- System health checkGetBtcMarketPriceAsync(fiat)- BTC price in specified fiatSearchOffersAsync(offerType, pagination, sort)- Search buy/sell offers (GET request to/offer/search/sellor/offer/search/buy)GetOfferAsync(id)- Get specific offer details
RegisterAccountAsync(privateKey)- Create new accountAuthenticateAccountAsync(privateKey)- Login to existing accountGetIdentity()- Retrieve current user profileUpdateUserAccount(updateData)- Update user settings (PGP, FCM, referral, fees)CreateOfferAsync(insertData)- Post new buy/sell offer
Offer(Id, Type, User, Amount[], MeansOfPayment, Online, PublishingDate, Premium, Prices, Escrow)- Type: Ask (sell) or Bid (buy)
- Amount: [min, max] range in satoshis
- MeansOfPayment:
{ "EUR": ["revolut", "sepa"], ... } - Premium: Percentage above/below market
User { Id, CreationDate, Trades, Rating, Medals[], Disputes, PgpPublicKey, ... }enum OfferTypeFilter { Sell, Buy }Note: OfferFilter class has been deprecated after Peach API breaking change. Search is now simplified to GET requests with type-based routing.
- Breaking change: Changed from POST with
OfferFilterbody to simple GET with type-based routing - Routes:
/offer/search/sell(for Sell) or/offer/search/buy(for Buy) - Still supports pagination and sorting via query parameters
- Large JSON → custom
JsonDocumentparsing skipPgpFieldsoption to trim payload- Implemented in
SearchOffersAsync()(PeachApiClient.cs:97-179)
- Levels: Warning / Default / Critical
ValidateResponse()checks nulls, HTTP status, data- Logging via
FailWith()andPanicWith()
- Custom converters: decimals, offer filters, PGP skipping
- Global JSON: camelCase, ignore nulls
- Separate options for offer-specific serialization
Test structure in tests/ClientTests/:
SearchOffers.cs- Offer search functionalityGetOffer.cs- Single offer retrievalAccount.cs- Registration/authentication_More.cs- Additional test scenarios
- Keep the code as clean and simple as possible, while adhering to the existing style
- Do not remove features arbitrarily unless explicitly requested
- Do not create unit tests unless explicitly requested