Coder Social home page Coder Social logo

overtorment / cashier-btc Goto Github PK

View Code? Open in Web Editor NEW
284.0 284.0 100.0 156 KB

๐Ÿ’ฐ Self-hosted Bitcoin payment gateway (เธฟ)

JavaScript 100.00%
bitcoin bitcoin-payment-gateway btc invoice microservice payment-gateway payment-request request-payment

cashier-btc's People

Contributors

micxsamonte avatar overtorment avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cashier-btc's Issues

btc_actual and btc_unconfirmed shows zero

Hi,
Thanks for the great project, i'm facing a problem, only btc_expected value showing correct value.

{"btc_expected":0.0154,"btc_actual":0,"btc_unconfirmed":0}

Please help.

Thanks in advance!

Failing to use /payout, everything else working.

I got Cashier-BTC working, npm test run without any errors and all ok.
It's possible to check balanace, create new transaction, check seller balance the only thing not working is the payout.

I already checked if it could be because of balance issues or fee too high etc, which is all perfectly fine. In debugging I can see amount, amountToOutput, changeAddress, feeInSathoshis, fixedFee are all spendable and ok.

What could have caused the following error and how would I be able to fix it? Have not been able to locate the issue yet so any help will be appreciated.

code:500

message:"{"result":null,"error":{"code":-26,"message":"mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)"},"id":"62986010-8ef5-4917-9d5f-ab43ba5b957c"}\n"

stack:"Error: {"result":null,"error":{"code":-26,"message":"mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)"},"id":"62986010-8ef5-4917-9d5f-ab43ba5b957c"}\n\n at IncomingMessage. (/home/user/BitcoinPayment/Cashier-BTC/node_modules/jayson/lib/client/http.js:74:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (_stream_readable.js:1064:12)\n at _combinedTickCallback (internal/process/next_tick.js:138:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)"

Makes huge number of requests to bitcore, even when no requests are made?

After starting up cashier, in the bitcore logs it is reporting many requests per second trying to find address information for the same several addresses. Here is a small portion of the logs:

[2017-03-26T02:45:12.546Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1FRVpkvSPeYfuDoW1i6peK9GjTuBQydi7T?noTxList=1" 200 239 0.499 "-" 
[2017-03-26T02:45:12.614Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/19WwaMfB1bmjMSJkFCCfrFFqiVrHwKzM2P?noTxList=1" 200 239 0.521 "-" 
[2017-03-26T02:45:12.687Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1Nd2AGwSkNFwYQav6bQimtnN8faa5XD6Gx?noTxList=1" 200 239 0.527 "-" 
[2017-03-26T02:45:12.757Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1JPpt6YD5dkFB87cDGiFRoDXxhKcmnqBhv?noTxList=1" 200 239 0.508 "-" 
[2017-03-26T02:45:12.821Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1LayKNbHyf5MVqRe9GV1bsN2EfBxKUE27A?noTxList=1" 200 239 0.498 "-" 
[2017-03-26T02:45:12.884Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1Q8M4oRCPiQ1qdmcSHMFP5HUtoeP9o35pZ?noTxList=1" 200 239 0.469 "-" 
[2017-03-26T02:45:12.964Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1NSwBKJBTPQDwiMfHdaGAP1twRXDqzdFUn?noTxList=1" 200 239 0.469 "-" 
[2017-03-26T02:45:13.037Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/18DcKe8QMwhhMHJXuJKrDzxHDjKtoUG8bz?noTxList=1" 200 239 2.011 "-" 
[2017-03-26T02:45:13.102Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1EsLX2oc8grjSxC6AwbQrewjZnaYMX25wu?noTxList=1" 200 239 0.598 "-" 
[2017-03-26T02:45:13.170Z] info: ::ffff:127.0.0.1 "GET /insight-api/addr/1PBKZBWn2tbmvDMS6t47kTiXPfNyW4ht5e?noTxList=1" 200 239 0.542 "-"

I have never even made any api calls to cashier. Is this normal?

BTC not showing up

So I seem to be having another issue.

I created a test transaction, sent the BTC, and after executing curl http://localhost:2222/check_payment/3LRqq2SSQMozv9ucBvgTGybiuuNYLoaPK5 I get {"btc_expected":0.00034435,"btc_actual":0,"btc_unconfirmed":0}

Is this normal? When I put the address 3LRqq2SSQMozv9ucBvgTGybiuuNYLoaPK5at bitref.com it can see the transaction so how come Cashier-BTC isn't able to?

EDIT: I am by no means an expert, but I have tried to recover my funds by downloading the database and extracting the WIF. After trying to convert it to a private key it comes out as invalid, so maybe the issue is that invalid WIFs are stored.

Inputting sample WIFs at http://gobittest.appspot.com/PrivateKey successfully gets the private key, but when I put my own WIFs from the database the site returns "Private key is not on curve" indicating they're invalid.

Creating a POST version of the current API endpoints

I am working on creating a POST version of the current GET api endpoints. And organizing the routes to a routers folder, converting the current controller scripts to modules. It will also leave the GET endpoints still usable as is.

This way we can introduce optional parameters, e.g. message or custom fees etc.

Thoughts on this?

Trouble with Sync

Hi, I tried running below command

  mkdir datadir

Then

      ./bin/bitcoind -port=8444 -rpcport=8442 -datadir=./datadir -rpcuser=user  -rpcpassword=pass -rpcbind=0.0.0.0  -rpcallowip=44.33.22.11

After 30 minutes or so nothing happens, is it an error or what I am doing wrong? I check debug.log and shows this many lines, but no signs of error. I am on windows using ubuntu 16 in a virtualbox machine

  2018-01-06 08:09:10 UpdateTip: new best=000000
  2018-01-06 08:09:10 UpdateTip: new best=000000

demo?

Curious about a demo for quick evaluation of payment/invoicing projects

Moving out BTC?

Hello, thank you for this tool! I was just wondering since a BTC address is created for each transaction, how would I claim all of the BTC?

npm test error

Hi
i do npm test and face me error
i have installed btc full node and also couchdb and i just configure the config js file and then i just run npm test and face me error :

SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at /downloads/Cashier-BTC/node_modules/mocha/lib/mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (/downloads/Cashier-BTC/node_modules/mocha/lib/mocha.js:228:14)
at Mocha.run (/downloads/Cashier-BTC/node_modules/mocha/lib/mocha.js:536:10)
at Object. (/downloads/Cashier-BTC/node_modules/mocha/bin/_mocha:573:18)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
at bootstrap_node.js:507:3
npm ERR! Test failed. See above for more details

its installed on centos 7 x64

is there any customization for centos ?

"code":-5,"message":"Invalid Bitcoin address"

Firstly, thanks for creating this very useful code. I am using it to test payment gateway with Bitcoin testnet. I have altered signer.js for testnet -

let testnet = bitcoinjs.networks.testnet // define bitcoin testnet
exports.generateNewSegwitAddress = function () {
// let keyPair = bitcoinjs.ECPair.makeRandom() -- for bitcoin mainnet
let keyPair = bitcoinjs.ECPair.makeRandom({network: testnet})

But when I hit the -"http://localhost:2222/request_payment/0.005/BTC/wheres%20the%20money%20lebowski/seller3/customer2/http%3A%2F%2Fgoogle.com%2F"

it returns - " "error": "{"result":null,"error":{"code":-5,"message":"Invalid Bitcoin address or script"},"id":"2c015994-6f01-4acd-94e4-77bd2b1d547c"}\n""

Please suggest if I need to add something to make it work on the bitcoin testnet. Thanks in advance!

npm test failing at loading express responds to /check_payment/:address:

storage
get_document()
โœ“ should return any db document
save_address() && get_address()
โœ“ should save document with address data, and get it back (77ms)
save_payout()
โœ“ saves document with details on the payout (49ms)
save_seller()
โœ“ saves document with details on the seller (59ms)

blockchain
#create_transaction()
โœ“ should return valid TX hex (54ms)
โœ“ should correctly consider all used inputs

9 passing (1m)
6 failing

  1. loading express responds to /check_payment/:address:
    Uncaught Error: getaddrinfo ENOTFOUND http http:80
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

  2. loading express "after each" hook for "responds to /check_payment/:address":
    Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

  3. blockchain #broadcast_transaction() should broadcast TX:
    Uncaught Error: getaddrinfo ENOTFOUND http://35.154.27.8 http://35.154.27.8:3001
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

  4. blockchain #fetch_transactions_by_address() should return TXs by address :
    Uncaught Error: getaddrinfo ENOTFOUND http http:80
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

  5. blockchain #fetch_transactions_by_address() should return all TXs:
    Uncaught Error: getaddrinfo ENOTFOUND http http:80
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

  6. blockchain #get_address() should return balances associated with this address :
    Uncaught Error: getaddrinfo ENOTFOUND http http:80
    at errnoException (dns.js:26:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

"message":"Address not found in wallet"

Hello!

I get the following error when i run nodejs worker.js although npm test works

(node:13420) UnhandledPromiseRejectionWarning: Error: {"result":null,"error":{"code":-4,"message":"Address not found in wallet"},"id":"ca143925-f031-42eb-b559-d36c8a6c08ce"}

at IncomingMessage.<anonymous> (/home/Desktop/Cashier-BTC/node_modules/jayson/lib/client/http.js:74:21)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1103:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

(node:13420) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13420) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What should i do ?
Thank you in advance

Better routes

I don't really think that your routes are comfortable to use, for example:

GET /request_payment/:expect/:currency/:message/:seller/:customer/:callback_url

When you build a wrapper, joining these parameters is very tricky process: you should always match values with position. Maybe they should be passed via query string?

Can we change from Bitcoin to An Altcoin?

Hi, if yes, can we know which settings to change? It says

(node:7211) UnhandledPromiseRejectionWarning: Error: {"result":null,"error":{"code":-5,"message":"Invalid Hilux address"},"id":"21ce350b-fd60-426b-bfc7-a340421bffe3"}

When running nodejs worker.js
and npm test.

Appreciate any help we can get.

How to keep bitcore running?

Hello,
is there anyway I can keep bitcoin core running? I know that there's some instructions for keeping the node files running but I'm kind of lost on how to keep bitcoin core up. Not even an hour after I execute it, it dies with the message "Killed"

getting error when worker2.js transferring amount

[
'broadcasting',
'010000000001018b0b33aed894fab40f8b2169cd6ef4fe9698d0ceda169995ebb14f1ef616977c0000000017160014f66fce40a9defb9bf913452dcdea39d1ae8c005affffffff01000000000000000017a914b84e23ed387fdeb8f85f8aff075e98bb8d83e5ec870247304402201f95722f6115fe44c2e393530b0efe483e02d418865aad928f920a52d760cd6a022053ea25cd1ac4ce47b7b778fb2a9a95d0193ac34ed2dbbacaf1fe51f22e99abdd0121034a153f20b6571c58a9751d5fb62f8452941d86a4949b0546712f9702d40e6dbb00000000'
]
(node:10594) UnhandledPromiseRejectionWarning: Error: {"result":null,"error":{"code":-26,"message":"dust (code 64)"},"id":"b7ede744-211a-4603-a95b-328b2d3901b0"}

at IncomingMessage.<anonymous> (/root/Cashier-BTC/node_modules/jayson/lib/client/http.js:74:21)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1168:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11)

(node:10594) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10594) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Feature to enable merchant's extended private key as a seed to generate derived addresses for merchant

I want to build a feature by which we can use anyone's extended private key to generate addresses so that we can generate as many addresses as we want without the ability to spend them(because this needs a private key). Can you suggest anything, i just need to modify the code regarding address generation and i have seen that in the existing codebase we are generating a new private key using bitcore.js and storing it along with the address and other invoice details in the database.

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.