Code Monkey home page Code Monkey logo

bustapay's Introduction

bustapay

This project is designed as a reference implementation of the bustapay standard, as well as a simple way to send or receive bustapay payments. It delegates out most the work to bitcoin core's wallet over rpc. When receiving transactions, for simplicity it stores the information in awkward flat-file style database.

Building

It's a pretty simple golang project, so with a golang dev environment setup, it's simply:

dep ensure
go install

Which will create a self-contained executable bustapay

Configuration

Global options are:

  • verbose (default: false)
  • bitcoind_host (default: localhost)
  • bitcoind_port (default: 8332)
  • bitcoind_user (no default)
  • bitcoind_pass (no default)

They can be passed via command line (e.g. --verbose=true) or via the ~/.bustapay/config.yaml (e.g. verbose: true) or env variables (e.g. VERBOSE=true)

Sending

bustapay send $BITCOIN_ADDRESS $BUSTAPAY_URL $AMOUNT_IN_BITCOIN

This works pretty simply under the hood. Conceptually it's:

$UNFUNDED :=  createrawtransaction [] { ""$BITCOIN_ADDRESS": $AMOUNT_IN_BITCOIN }
$FUNDED := fundrawtransaction $UNFUNDED`
$TEMPLATE := signrawtransactionwithwallet $FUNDED`
$PARTIAL := curl -d $TEMPLATE_TRANSACTION $BUSTAPAY_URL
$FINAL := signrawtransactionwithwallet $PARTIAL # after some validation!
sendrawtransaction $FINAL

Receiving

bustapay receive

Also supports the configuration option --port xxx to configure which port to listen to (default 8080)

Which will create an HTTP server that listens for bustapay payments. To avoid making it too opinionated and bringing in a proper database it stores bustapay transactions as a flat file. For each received bustapay transaction it will create the directory:

~/.bustapay/data/$FINAL_TRANSACTION_ID

and in that directory will create the follow files:

  • partial_transaction.hex # the final (but partial) transaction (that the user needs to sign)
  • amount.txt # the amount the person is sending us in satoshis (thus it's an integer)
  • template_transaction.hex # the raw template transaction in hex

It is still the receivers responsibility to do the rest of payment processing, and detecting if a received transaction is a bustapay transaction or not.

bustapay's People

Contributors

rhavar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

p9c currentsea jsh1n

bustapay's Issues

Modification to BIP79

We are implementing that at BTCPay level (see btcpayserver/btcpayserver#1321 (comment))

So there is two thing that bother me with the general approach:

Using a hotwallet is not very safe, also, allowing payjoin also mean that a customer can enumerate the utxos of the merchant. So payjoin has a form of disutility to it.

As such, I think it should be a different payment method on which the merchant can charge an extra network cost for this disutility. But with the current UX, this is an impossible thing to do.

One way would be to modify BIP79 to allow the merchant to set up extra fee.

Would you agree to change your implementation and BIP79 to support such parameter?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.