Bitcoin Forum
December 13, 2024, 04:01:54 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Accepting payments efficiently (SPV tracking)  (Read 1131 times)
btcfaucet (OP)
Full Member
***
Offline Offline

Activity: 166
Merit: 100


Bitcoin Faucet


View Profile
January 05, 2016, 03:42:32 PM
 #1

I have a bunch of sites and I accept bitcoin payments for good and services. I have done this with Bitcoind, BitPay, blockchain.info and other solutions. Unfortunately, they are not great.

* BitcoinD: 50+ GB blockchain, resource invensive, no HD wallets (or ability to import watch-only addresses - and no, hanging the RPC for 10 minutes per address isn't a real option).
* BitPay / bc.info / block.io / etc: third party (privacy and reliability concerns).

What I need is:

- An SPV based client (no need for 50+ GB SSDs)
- Either supporting HD wallets (bip32/37/44) with a custom (high) gap limit, or providing the ability to load custom privkeys or addresses (without hanging the software, obviously)
- Ability to notify (call a script) when a transaction occurs that affects any of the loaded addresses
- Ability to track the spendable balances on these addresses, so I still won't have to query third parties having the blockchain indexed

I could build everything around it and make it a lot more secure, convenient and reliable for all my sites to accept BTC using an internal API.

I'm hoping someone will put me in my place and tell me I overlooked something very obvious and simple. If that doesn't happen, I'm hoping someone out there will say ("Hey, I can just take SPV software X, add some notifications and realtime address-into-wallet importing in 30 minutes"). If someone actually understands what I'm talking about, and they're up to the task, I'm happy to pay them too (but I would prefer to share the end result publicly so accepting payments without third party payment processors would become easier).


achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3570
Merit: 6927


Just writing some code


View Profile WWW
January 05, 2016, 06:41:31 PM
 #2

Use electrum for this.

btcfaucet (OP)
Full Member
***
Offline Offline

Activity: 166
Merit: 100


Bitcoin Faucet


View Profile
January 05, 2016, 07:21:49 PM
 #3

Use electrum for this.

Are you sure about this? Does Electrum have near-instant address importing, and a feature to call a script/notify in some way?

Even if it does, there are other concerns. IIRC Electrum uses its own nodes and its own query structure and doesn't simply connect to Bitcoin nodes as some SPV clients (which is what I am trying to achieve).

Thanks for the suggestion regardless!

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3570
Merit: 6927


Just writing some code


View Profile WWW
January 05, 2016, 07:41:01 PM
Last edit: January 05, 2016, 10:00:14 PM by knightdk
 #4

Are you sure about this? Does Electrum have near-instant address importing, and a feature to call a script/notify in some way?
I don't know about address importing but I think it is fairly quick. It does have a command line so it will work with scripts. I'm not sure about notifying.

Even if it does, there are other concerns. IIRC Electrum uses its own nodes and its own query structure and doesn't simply connect to Bitcoin nodes as some SPV clients (which is what I am trying to achieve).
Electrum uses servers that volunteers setup which use bitcoin core as the backend to connect to the bitcoin network.

XCASH
Legendary
*
Offline Offline

Activity: 929
Merit: 1000


View Profile
January 05, 2016, 09:46:45 PM
 #5

You can tell Electrum which nodes to connect to, and it can import a private key. Normally it generates a bunch of private keys from a pass phrase that you memorize, but it can alternatively import a private key from Bitcoin core. The sync time is very fast, normally a few seconds, but I don't know how well it copes with hundreds of addresses like you would use for a business.

btcfaucet (OP)
Full Member
***
Offline Offline

Activity: 166
Merit: 100


Bitcoin Faucet


View Profile
January 06, 2016, 01:45:48 AM
 #6

it can import a private key.

I'm looking at it now (I've never chosen the 'use imported addresses' feature in the beginning, the other modes don't have importing menus).
I'll see if Electrum can work with a few hacks. If it does, I'll test it with a couple of thousand watch addresses / privkeys.

If it doesn't work out, I will likely post a job (but I will recommend using bitcoin-ruby for it - seems to be a better choice).



achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3570
Merit: 6927


Just writing some code


View Profile WWW
January 06, 2016, 02:20:24 AM
 #7

it can import a private key.

I'm looking at it now (I've never chosen the 'use imported addresses' feature in the beginning, the other modes don't have importing menus).
I'll see if Electrum can work with a few hacks. If it does, I'll test it with a couple of thousand watch addresses / privkeys.
You can use the importprivkey command line function to import private keys into the wallet.

Also, for notifying from electrum, I think it is possible with the addition of another software. See: http://docs.electrum.org/en/latest/merchant.html#add-web-sockets-support

btcfaucet (OP)
Full Member
***
Offline Offline

Activity: 166
Merit: 100


Bitcoin Faucet


View Profile
January 06, 2016, 03:20:47 AM
Last edit: January 06, 2016, 04:05:24 AM by btcfaucet
 #8

* I'm just posting the below as info - these are all good suggestions and I appreciate them all. *


Also, for notifying from electrum, I think it is possible with the addition of another software. See: http://docs.electrum.org/en/latest/merchant.html#add-web-sockets-support

That seems like it's a feature more specialised for the payment-request page itself, not a general use interface to control Electrum or receive notifications for other addresses and events.


You can use the importprivkey command line function to import private keys into the wallet.

I tried importprivkey from the cmd line before, but that only works if I stop the software first. Otherwise it writes to the wallet, and the live one doesn't reload it, and after it's closed it saves the wallet in memory apparently. The 'importprivkey' isn't something I will want to use anyway: I'd prefer to subscribe to addresses only. But that's no problem, as I have a new plan now.

If I could get RPC to work, I could make very good use of its commands like listing unspent tx outputs. I could simply hook a bitcoin daemon to get notified of unconfirmed transactions & new blocks, send the info to my daemon which would request more info from Electrum, then it could update the database and send out any notifications.

One problem is that I'm still very confused about the basics of Electrum. I'm running it as a daemon, but can't get its RPC to work. It only ever listens on the daemon.sock unix socket. Never JSONRPC. And running an Electrum command at cmd line doesn't even use daemon.sock to communicate with the daemon (I deleted the socket, requested a command, it still executed fine). I don't know if two Electrums ran concurrently or whatever happened in the background. In the long run I wouldn't want to launch a process for every Electrum request (like retrieving utxo for an address etc).

*Update: it turns out launching the app starts the daemon temporarily to give it commands if it can't reach it. And RPCJSON I'm not sure if it exists with Electrum but no need anyway, I'll just connect to an Electrum server rather than the client's daemon. It might not even exist anyway.





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!