Bitcoin Forum
December 17, 2017, 03:23:53 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: Is bitcoind reliable when depending on it for web services?  (Read 2099 times)
SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 13, 2013, 10:30:39 PM
 #1

Hey all, I created a question here: http://bitcoin.stackexchange.com/questions/10878/is-bitcoind-reliable-when-depending-on-it-for-web-services

was wandering as there are a lot of technical minded people with bitcoin knowledge and knowledge of bitcoind and it's application in web services could answer it for me as I want to start work on a small project but my worry is scalability later on in running a service.

Here's the question:

"What I mean by the title is, say If I create a service with bitcoind being used to create and store large numbers of accounts and address, is it likely to take the strain? Can I setup multiple instances of bitcoind to access information about the network or would I need to one large instance of a bitcoin daemon to handle everything?

If not is there an alternative to be used that can keep up with an expanding web service?"

Please feel free to discuss here but if you have an experienced answer to give I'd hope you'd answer the question for me on stack exchange and so it's filed away easily for others to find.
1513481033
Hero Member
*
Offline Offline

Posts: 1513481033

View Profile Personal Message (Offline)

Ignore
1513481033
Reply with quote  #2

1513481033
Report to moderator
1513481033
Hero Member
*
Offline Offline

Posts: 1513481033

View Profile Personal Message (Offline)

Ignore
1513481033
Reply with quote  #2

1513481033
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513481033
Hero Member
*
Offline Offline

Posts: 1513481033

View Profile Personal Message (Offline)

Ignore
1513481033
Reply with quote  #2

1513481033
Report to moderator
1513481033
Hero Member
*
Offline Offline

Posts: 1513481033

View Profile Personal Message (Offline)

Ignore
1513481033
Reply with quote  #2

1513481033
Report to moderator
1513481033
Hero Member
*
Offline Offline

Posts: 1513481033

View Profile Personal Message (Offline)

Ignore
1513481033
Reply with quote  #2

1513481033
Report to moderator
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2366



View Profile
May 14, 2013, 02:11:42 AM
 #2

You don't mention what "service" you intend on providing, so it's hard to say.  Generally it's not advisable to use bitcoind directly as your sole accounting system because there is no synchronous replication of metadata and internal transactions (e.g. "move"s).

Bitcoin will not be compromised
SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 14, 2013, 07:58:11 AM
 #3

You don't mention what "service" you intend on providing, so it's hard to say.  Generally it's not advisable to use bitcoind directly as your sole accounting system because there is no synchronous replication of metadata and internal transactions (e.g. "move"s).

Ideally it's just to read data about transactions and get address balances but it needs each account to potentially be read once per hour.
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 15, 2013, 11:32:51 AM
 #4

If not is there an alternative to be used that can keep up with an expanding web service?"

An alternative that can really take the heat of a web service is the BOP Enterprise Bitcoin Server.

You can run several instances of it and send requests to them through a load balancing message bus.
See the example repository https://github.com/bitsofproof/bop-explorer that shows a simple REST API forwarding to the bus.
The server code is in https://github.com/bitsofproof/supernode

Bits of Proof will launch its offer in two days in San Jose, dramatically reducing the pain of integrating with the Bitcoin protocol.
SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 15, 2013, 02:17:04 PM
 #5

If not is there an alternative to be used that can keep up with an expanding web service?"

An alternative that can really take the heat of a web service is the BOP Enterprise Bitcoin Server.

You can run several instances of it and send requests to them through a load balancing message bus.
See the example repository https://github.com/bitsofproof/bop-explorer that shows a simple REST API forwarding to the bus.
The server code is in https://github.com/bitsofproof/supernode

Bits of Proof will launch its offer in two days in San Jose, dramatically reducing the pain of integrating with the Bitcoin protocol.

Interesting so, I can run the server myself or is this a service being sold so I'd have to pay per request for example? Secondly, is there much in the way of documentation for the REST API? I'm assuming you don't have any other examples or libraries that aren't Java?
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 15, 2013, 03:14:24 PM
 #6

You can run the server yourself, and we have also hosted offers, as of:

Bits of Proof launches world's first enterprise-ready Bitcoin server

we even have a complementary offer during Bitcoin 2013.

Pricing is not by request, but we offer maintenance and support contracts of several levels and hosted servers, the later will be priced by vCPU allocated.

The hosted solution saves you the effort to set up a server for development and I hope you will find it care free for your production.
We will have shared and dedicated servers and also load balanced server farms depending on your need.

The primary API is the Bus, that speaks STOMP and is transporting Protobuf format messages, so you can connect e.g. with python, ruby or PHP, I am sure you find examples using both STOMP and Protobuf quickly with google for your choice of language.

The rest API  in the bop-explorer is just a demo how easy is to create one. The BCCAPI that powers the Android app is also technically a REST adapter over the Bus.

The clients side Java code using the Bus API adds a layer of abstraction, that can surely be achieved with other languages. I hope that a community around the product will share those that are popular. You are not exposed to java directly if you do not want it. In the hosted case you do not even have to care of compiling and running the server using java.

The weakest point in our offer is the documentation, but this is just temporary as all resources went into development to hit the target for Bitcoin 2013, and we did. Next focus is documentation. I believe the example code you find in our GitHub repos give a head start.


SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 15, 2013, 03:41:05 PM
 #7

Sounds great, genuinely excited, have you got particular locations for running hosted solutions, like will you be running some one cloud providers like Amazon or will you be purely in house?

I'd love to put some time in to make a PHP client library if I can get the time for it, obviously might be quite difficult until you guys have full documentation down.
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 15, 2013, 04:00:32 PM
 #8

Sounds great, genuinely excited, have you got particular locations for running hosted solutions, like will you be running some one cloud providers like Amazon or will you be purely in house?

I'd love to put some time in to make a PHP client library if I can get the time for it, obviously might be quite difficult until you guys have full documentation down.

Bits of Proof already operates several servers at world class data centers in Germany.
Incremental server locations will be aligned with our customer's need and preference.
burnside
Legendary
*
Offline Offline

Activity: 1008



View Profile WWW
May 15, 2013, 06:41:28 PM
 #9

In my experience bitcoind has been stable.

It's also fairly slow, and has been unable to handle minimal (~3k users) "getBalance/listtransactions/move" load on btct.co even with a caching layer on top of it for frequent queries.

I tackled the missing replication with frequent backups + external transaction logging.  (such that I should be able to restore the wallet, then replay the transactions.)  Rolling out a drbd implementation is next on my list.

Unfortunately I've also stumbled into a fairly major bug for a webservice.  It's really strange but listtransactions does not return transactions in chronological order for me anymore.

https://bitcointalk.org/index.php?topic=205647.0

Not sure what's going on there.

Hope that helps somewhat.  Wink



I'm not a Coinbase fan -- I placed a buy order, they took the funds out of my account, then a week later the price went up and they canceled the buy and closed my account.  You've been warned.  Use a different exchange.
jdbtracker
Hero Member
*****
Offline Offline

Activity: 687


Minimum Effort/Maximum effect


View Profile
May 16, 2013, 06:09:47 AM
 #10

If not is there an alternative to be used that can keep up with an expanding web service?"

An alternative that can really take the heat of a web service is the BOP Enterprise Bitcoin Server.

You can run several instances of it and send requests to them through a load balancing message bus.
See the example repository https://github.com/bitsofproof/bop-explorer that shows a simple REST API forwarding to the bus.
The server code is in https://github.com/bitsofproof/supernode

Bits of Proof will launch its offer in two days in San Jose, dramatically reducing the pain of integrating with the Bitcoin protocol.

That is an excellent idea, VPN powered Virtual Server, multiple connections from strategic locations, excellent. Multi Coin management, This will definitly make it possible to go beyond the 500kb/block limit.

so how far have you been able to implement it?

If you think my efforts are worth something; I'll keep on keeping on.
I don't believe in IQ, only in Determination.
SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 16, 2013, 07:58:02 AM
 #11

You can run the server yourself, and we have also hosted offers, as of:

Bits of Proof launches world's first enterprise-ready Bitcoin server

The primary API is the Bus, that speaks STOMP and is transporting Protobuf format messages, so you can connect e.g. with python, ruby or PHP, I am sure you find examples using both STOMP and Protobuf quickly with google for your choice of language.


Is there by any chance someone where that documents all the possible messages that can be set and expected results etc? Even as a really rough document?
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 16, 2013, 12:53:54 PM
 #12


That is an excellent idea, VPN powered Virtual Server, multiple connections from strategic locations, excellent. Multi Coin management, This will definitly make it possible to go beyond the 500kb/block limit.

so how far have you been able to implement it?

It is implemented.
Product release is tomorrow.
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 16, 2013, 12:55:11 PM
 #13

Is there by any chance someone where that documents all the possible messages that can be set and expected results etc? Even as a really rough document?

Just a few days of patience please. We are in conference mode. Probably I get it written up while in the airport lounge Smiley
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 16, 2013, 01:24:23 PM
 #14

Is there by any chance someone where that documents all the possible messages that can be set and expected results etc? Even as a really rough document?

I try quick and dirty here:

All messages are STOMP ByteArray where the payload is Protobuf as defined in https://github.com/bitsofproof/supernode/blob/master/api/src/main/protobuf/BCSAPIMessage.proto

Messages go to queues and topics. Queues are read by a single server instance (this does the load balancing) while topics are broadcast to all server and clients listening.

The following broadcast is allowed from clients to servers
/topic/newTransaction - send a new Transaction
/topic/newBlock - send a newly mined block

Synchronous requests from client to server:
Client sends a message to a request queue and sets the reply-to queue of the message to a temporary queue /queue/temp.XXXXX
The server that picks up the request will send reply to that temp queue.

The following synchronous requests are allowed from clients to a server:
/queue/blockRequest - send a Hash message to get a Block message on the reply queue
/queue/headerRequest - send a Hash message to get a Block message on the reply queue, but transactions field is empty
/queue/transactionRequest - send a Hash message to get a Transaction message on the reply queue
/queue/filterRequest - send a FilterRequest message to get a ongoing feed of Transaction messages on the reply queue that match the Bloom filter, this will keep going until you disconnect
/queue/matchRequest - send an ExactMatchRequest to scan the blockchain for transactions matching the filter, where filter is a list of byte vectors. The byte vectors can be addresses, keys or any data in a transaction script. This scans once starting from an optional time point "after" in the message. Resulting transactions will appear on the reply queue.
/queue/scanRequest - works like match request with bloom filter
/queue/ping send a ping msg to server you get back the same. This is to measure latency or to check availability.


SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 16, 2013, 02:10:59 PM
 #15

Is there by any chance someone where that documents all the possible messages that can be set and expected results etc? Even as a really rough document?

/queue/filterRequest - send a FilterRequest message to get a ongoing feed of Transaction messages on the reply queue that match the Bloom filter, this will keep going until you disconnect

/queue/matchRequest - send an ExactMatchRequest to scan the blockchain for transactions matching the filter, where filter is a list of byte vectors. The byte vectors can be addresses, keys or any data in a transaction script. This scans once starting from an optional time point "after" in the message. Resulting transactions will appear on the reply queue.



Thanks so ideally I'm guessing to monitor any of the addresses I've got to either:

1) do a MatchRequest for each address with my address as the receiving address?

Or

2) do I just create a filterRequest with a filter for my receiving address and I'll essentially get my transactions that way?

if so do you have a rough guess on how long these requests are likely to take?
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 16, 2013, 06:34:26 PM
 #16

The matchRequest or scanRequest is to scan the block chain. This would be useful if you import a private key or rescan history for a wallet.
You can submit a long list of patterns (addresses) with a single matchRequest, that is more effective, than one by one. The scanRequest is the same but with abloom filter, this would be useful for to scan for an ever larger set of patterns.

The filterRequest is an ongoing subscription to transactions coming in and matching the filter.

Beware that the bloom filter (for scanRequest or filterRequest) is probabilistic so you can get some transactions you do not care, but it reduces the regular transaction feed by magnitudes. The filter also gets updated automatically, so it will e.g. match for transactions spending a transaction that previously matched the filter. You might want to periodically reset the filter on a long standing connection.

The filter is a bitmap in style of a bloom filter at the moment I can only refer to https://github.com/bitsofproof/supernode/blob/master/api/src/main/java/com/bitsofproof/supernode/api/BloomFilter.java
how it is compiled from byte patterns (keys, addresses, outpoints) you want to filter for.

The Java class https://github.com/bitsofproof/supernode/blob/master/api/src/main/java/com/bitsofproof/supernode/api/DefaultAccountManager.java
shows how filter subscription and scanning is used to implement a client side wallet.
SlyFoxy12
Member
**
Offline Offline

Activity: 112


View Profile
May 16, 2013, 09:52:29 PM
 #17

The matchRequest or scanRequest is to scan the block chain. This would be useful if you import a private key or rescan history for a wallet.
You can submit a long list of patterns (addresses) with a single matchRequest, that is more effective, than one by one. The scanRequest is the same but with abloom filter, this would be useful for to scan for an ever larger set of patterns.

The filterRequest is an ongoing subscription to transactions coming in and matching the filter.

Beware that the bloom filter (for scanRequest or filterRequest) is probabilistic so you can get some transactions you do not care, but it reduces the regular transaction feed by magnitudes. The filter also gets updated automatically, so it will e.g. match for transactions spending a transaction that previously matched the filter. You might want to periodically reset the filter on a long standing connection.

The filter is a bitmap in style of a bloom filter at the moment I can only refer to https://github.com/bitsofproof/supernode/blob/master/api/src/main/java/com/bitsofproof/supernode/api/BloomFilter.java
how it is compiled from byte patterns (keys, addresses, outpoints) you want to filter for.

The Java class https://github.com/bitsofproof/supernode/blob/master/api/src/main/java/com/bitsofproof/supernode/api/DefaultAccountManager.java
shows how filter subscription and scanning is used to implement a client side wallet.


Ok, so I think I've got this down, basically the idea should be rather than directly accessing the 'supernode' from a stateless PHP execution I should probably be creating something like a worker service that will subscribe to batches of addresses and then start storing the results of such like when an address has reached a target amount received?

Cheers for all the help, good luck with the full release  Smiley
grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 17, 2013, 11:33:15 AM
 #18

I suggest to have some cache at your side that is initialized with a scan and than subscribes for updating ttansactions.
The stateless calls can consult that cache. I would persist the cache and rescan from the server at startup from the time point it was last persisted. This avoids having inconsistent state with the servrer and gives best performance.

davout
Legendary
*
Offline Offline

Activity: 1372


1davout


View Profile WWW
May 17, 2013, 11:35:22 AM
 #19

Don't use the "accounts" feat. it doesn't scale.
Manage accounts yourself in whatever data store you're using.

grau
Hero Member
*****
Offline Offline

Activity: 836


bits of proof


View Profile WWW
May 17, 2013, 11:43:52 AM
 #20

Accounts does not scale if implemented naively.

A combination of local cache and subscription can however scale as i described before. BTW this is the logic of the wallet too, just tightly coupled in the satoshi implementation
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!