Bitcoin Forum
November 16, 2024, 05:18:43 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Is there a remote, trustless bitcoin API that doesn't require local storage?  (Read 2635 times)
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 15, 2013, 04:34:09 PM
 #1

http://bitcoin.stackexchange.com/questions/7697/is-there-a-remote-trustless-bitconi-api

This question asks about how to work with bitcoin via an API without requiring a local blockchain. The only answer is about blockchain.info's JSON API, but it appears that unlike the web version of blockchain.info, the JSON API requires the account passwords to be sent to the server.

Is there another remote API that allows one to perform various bitcoin operations without compromising security - without sending private keys anywhere, but rather signing transactions locally?

If I recall correctly then Stratum was supposed to be this API. Did it ever take off?

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 15, 2013, 06:23:07 PM
 #2

FYI SPV is of course not the answer I'm looking for, I'm interested in a client API that can just turn on, not download anything, and work.

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
jim618
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
February 15, 2013, 06:45:57 PM
Last edit: February 15, 2013, 07:03:06 PM by jim618
 #3

FYI SPV is of course not the answer I'm looking for, I'm interested in a client API that can just turn on, not download anything, and work.

Hi ripper234,

It doesn't answer your exact question but I thought I would mention it anyhow.

If you don't mind including a headers-only blockchain (currently 23.7 MB) you can get pretty close with bitcoinj now that bloom filters are available. (Uses bitcoind v0.8.0rc1 + bitcoinj v0.7-SNAPSHOT).

You can:
1) connect to whichever bitcoinds you like.
2) use fastcatchup to 'topup' your headers only blockchain (very quick).
3) set up a bloom filter for whatever you are interested in (very small bandwidth, quick)
4) send tx as you like.


It is not exactly trustless as the bitcoinds could 'overfilter' your tx of interest but with judicious use of a PeerGroup I think you could get round that (if you want to be completely trustless you are going to end up with a bitcoind I think).

The code to do all this is in bitcoinj/ MultiBit already so you could just take it and use it. No development required.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
jim618
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
February 15, 2013, 07:01:41 PM
 #4

There is also BCCAPI, the server backend to BitcoinSpinner.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 07:11:59 AM
 #5

I wonder if this is possible and the solution to your question but take a bitcoind in the conf make the max connections 0, then use the create raw tx (createrawtransaction), then use blockchain api to push it (http://blockchain.info/pushtx) this would be the only way to do it.

Interesting, didn't know of the blockchain tx transmission API. That might be an excellent answer.
I think bitcoinj will suffice, don't need a bitcoind for that (I'll be working in Java/Scala, so bitcoinj is a perfect fit).



If I recall correctly then Stratum was supposed to be this API. Did it ever take off?

Stratum is a mining protocol (http://mining.bitcoin.cz/stratum-mining)

Stratum is a proposal for an open source client-server "Overlay" protocol that enables thin clients (currently used by Electrum client).



There is also BCCAPI, the server backend to BitcoinSpinner.

Interesting, if the server was open source it would be a perfect fit.
I asked whether the server code can be open sourced.



If you don't mind including a headers-only blockchain (currently 23.7 MB) you can get pretty close with bitcoinj now that bloom filters are available. (Uses bitcoind v0.8.0rc1 + bitcoinj v0.7-SNAPSHOT).

You can:
1) connect to whichever bitcoinds you like.
2) use fastcatchup to 'topup' your headers only blockchain (very quick).
3) set up a bloom filter for whatever you are interested in (very small bandwidth, quick)
4) send tx as you like.


It is not exactly trustless as the bitcoinds could 'overfilter' your tx of interest but with judicious use of a PeerGroup I think you could get round that (if you want to be completely trustless you are going to end up with a bitcoind I think).

The code to do all this is in bitcoinj/ MultiBit already so you could just take it and use it. No development required.

Hmm, very interesting but I'm not sure this is sufficient.
I want to build a service that needs to do bitcoin tx, and I would want to architect it so it is as simple as possible.
The simplest architecture I can think of is having just a stateless set of web servers with a bitcoin client library (a-la BCCAIP). I want the servers to be able to start as fast as possible from zero previous data/state. While downloading 23.7 MB might be "almost instant", a pure stateless client library is even better.

I guess that out of the approaches above, perhaps the best one is:

1. Using blockchain.info for queries
2. Using bitcoinj to sign transactions
3. Using blockchain.info broadcast API to broadcast transactions

Blockchain.info is such a huge service that I can trust it to be reliable and secure - I can trust that it won't lie to me and its servers will be up 99.9% of the time.


Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
Jouke
Sr. Member
****
Offline Offline

Activity: 426
Merit: 250



View Profile WWW
February 16, 2013, 08:33:54 AM
 #6

I wonder if this is possible and the solution to your question but take a bitcoind in the conf make the max connections 0, then use the create raw tx (createrawtransaction), then use blockchain api to push it (http://blockchain.info/pushtx) this would be the only way to do it.

Interesting, didn't know of the blockchain tx transmission API. That might be an excellent answer.
I think bitcoinj will suffice, don't need a bitcoind for that (I'll be working in Java/Scala, so bitcoinj is a perfect fit).



If I recall correctly then Stratum was supposed to be this API. Did it ever take off?

Stratum is a mining protocol (http://mining.bitcoin.cz/stratum-mining)

Stratum is a proposal for an open source client-server "Overlay" protocol that enables thin clients (currently used by Electrum client).



There is also BCCAPI, the server backend to BitcoinSpinner.

Interesting, if the server was open source it would be a perfect fit.
I asked whether the server code can be open sourced.



If you don't mind including a headers-only blockchain (currently 23.7 MB) you can get pretty close with bitcoinj now that bloom filters are available. (Uses bitcoind v0.8.0rc1 + bitcoinj v0.7-SNAPSHOT).

You can:
1) connect to whichever bitcoinds you like.
2) use fastcatchup to 'topup' your headers only blockchain (very quick).
3) set up a bloom filter for whatever you are interested in (very small bandwidth, quick)
4) send tx as you like.


It is not exactly trustless as the bitcoinds could 'overfilter' your tx of interest but with judicious use of a PeerGroup I think you could get round that (if you want to be completely trustless you are going to end up with a bitcoind I think).

The code to do all this is in bitcoinj/ MultiBit already so you could just take it and use it. No development required.

Hmm, very interesting but I'm not sure this is sufficient.
I want to build a service that needs to do bitcoin tx, and I would want to architect it so it is as simple as possible.
The simplest architecture I can think of is having just a stateless set of web servers with a bitcoin client library (a-la BCCAIP). I want the servers to be able to start as fast as possible from zero previous data/state. While downloading 23.7 MB might be "almost instant", a pure stateless client library is even better.

I guess that out of the approaches above, perhaps the best one is:

1. Using blockchain.info for queries
2. Using bitcoinj to sign transactions
3. Using blockchain.info broadcast API to broadcast transactions

Blockchain.info is such a huge service that I can trust it to be reliable and secure - I can trust that it won't lie to me and its servers will be up 99.9% of the time.



And if you don't want to trust blockchain.info, you can always set up your own Abe server.

Koop en verkoop snel en veilig bitcoins via iDeal op Bitonic.nl
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 10:13:12 AM
 #7

And if you don't want to trust blockchain.info, you can always set up your own Abe server.

Abe server? What is that and how do I set one up?

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
Jouke
Sr. Member
****
Offline Offline

Activity: 426
Merit: 250



View Profile WWW
February 16, 2013, 10:21:50 AM
 #8

And if you don't want to trust blockchain.info, you can always set up your own Abe server.

Abe server? What is that and how do I set one up?

https://en.bitcoin.it/wiki/Abe

Koop en verkoop snel en veilig bitcoins via iDeal op Bitonic.nl
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 10:57:01 AM
 #9

And if you don't want to trust blockchain.info, you can always set up your own Abe server.

Abe server? What is that and how do I set one up?

https://en.bitcoin.it/wiki/Abe


But, is it just a browser, or does it also come with a way to push transactions to the network?

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
Jouke
Sr. Member
****
Offline Offline

Activity: 426
Merit: 250



View Profile WWW
February 16, 2013, 11:19:38 AM
 #10

And if you don't want to trust blockchain.info, you can always set up your own Abe server.

Abe server? What is that and how do I set one up?

https://en.bitcoin.it/wiki/Abe


But, is it just a browser, or does it also come with a way to push transactions to the network?

Ah, you are right about that.
I use a bitcoind and its api to create, sign and push transactions to the network. I use Abe to fetch unspent transactions.

Koop en verkoop snel en veilig bitcoins via iDeal op Bitonic.nl
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1134


View Profile
February 16, 2013, 11:50:42 AM
 #11

Hmm, we have different definitions of "huge service". Blockchain.info is a site run by one man, if I understand correctly Smiley

You don't have to download the headers every time the server starts, obviously they can be saved to disk.

Try playing with MultiBit. It starts instantly. The need to fetch headers only happens at startup.
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 01:26:40 PM
 #12

Hmm, we have different definitions of "huge service". Blockchain.info is a site run by one man, if I understand correctly Smiley

You don't have to download the headers every time the server starts, obviously they can be saved to disk.

Try playing with MultiBit. It starts instantly. The need to fetch headers only happens at startup.

Well, huge compared to most other services in the bitcoin world (regarding number of users / transaction volume), and certainly larger than any service that I might start that relies on it.

How will MultiBit help? I think bitcoinj with SPV mode is very close to what I'm looking for ... still, I prefer the instant zero-blockchain-download that is blockchain.info

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
jim618
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
February 16, 2013, 03:16:41 PM
 #13

The main architectural difference between using blockchain.info and one based on bitcoinj/ MultiBit is whether you want to rely on a single server backend or the Bitcoin network as a whole.

Using one server backend is simpler, but you have a single point of failure.
blockchain.info is pretty high availability but it does occasionally go down for short periods.

(This is the same if you use BCCAPI - though I think that is multiple physical servers now at the backend - or your own ABE blockchain server).

Using a more distributed approach is more complicated but as there are working examples that are MIT licenced you don't have to do the dev work to take advantage of the network.

It does not give you your zero bytes starting point though. Only you can decide which of the various design factors are more important for your target application.

One approach you could take is to separate the various areas of:
+ blockchain/ tx reading
+ tx signing
+ tx transmission

So that you can change which service you use in each area (perhaps have multiple services you transmit the tx to for redundancy).

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 483
Merit: 551


View Profile
February 16, 2013, 04:01:17 PM
 #14

trustless bitcoin API that doesn't require local storage

I don't think its possible. You need to store your private keys somewhere.

Either locally, so you need local storage.

Or remote, so you need trust. At the very minimum, you need to trust that the remote storage does not go away.
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 04:05:34 PM
 #15

trustless bitcoin API that doesn't require local storage

I don't think its possible. You need to store your private keys somewhere.

Either locally, so you need local storage.

Or remote, so you need trust. At the very minimum, you need to trust that the remote storage does not go away.


I will store my private keys in my data tier of course, but I was referring to storing the blockchain/SPV data, that needs constant updating and can't just work instantly when the server is up.

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 04:11:52 PM
 #16

The main architectural difference between using blockchain.info and one based on bitcoinj/ MultiBit is whether you want to rely on a single server backend or the Bitcoin network as a whole.

Using one server backend is simpler, but you have a single point of failure.
blockchain.info is pretty high availability but it does occasionally go down for short periods.

(This is the same if you use BCCAPI - though I think that is multiple physical servers now at the backend - or your own ABE blockchain server).

Well, I'm relying on a single logical endpoint, but that endpoint indeed can have multiple backing servers. I don't believe that blockchain.info runs on a single server.

I would like to separate the concerns - I want my app to focus on the business logic, and not on maintaining a blockchain - the other alternatives mentioned at this thread will probably do a better job at this than I am ... I have no reason to believe I'll have less downtime than them.

Using a more distributed approach is more complicated but as there are working examples that are MIT licenced you don't have to do the dev work to take advantage of the network.

It does not give you your zero bytes starting point though. Only you can decide which of the various design factors are more important for your target application.

One approach you could take is to separate the various areas of:
+ blockchain/ tx reading
+ tx signing
+ tx transmission

So that you can change which service you use in each area (perhaps have multiple services you transmit the tx to for redundancy).

I think of opting to use blockchain.info as my backend as separating my concerns and focusing only on what's important for my app. I can always change the layer that access the blockchain later, and setup my own Abe/bitcoind/bitcoinj server if I need it.

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 483
Merit: 551


View Profile
February 16, 2013, 04:24:08 PM
 #17

I will store my private keys in my data tier of course, but I was referring to storing the blockchain/SPV data, that needs constant updating and can't just work instantly when the server is up.

I think bitcoinj is currently the best approach at trustless operation. However, you'd still need to download at least the blockchain headers plus relevant transactions on each start.

You can cut this down dramatically by using checkpoints. However, for this to work you need to update your client with the latest checkpoint data from time to time. Which is of course technically local storage again. Or trust, if you are bootstrapping your client from a remote server each time.
piuk
Hero Member
*****
expert
Offline Offline

Activity: 910
Merit: 1005



View Profile WWW
February 16, 2013, 04:36:16 PM
 #18

This class from the android app may be of some help https://github.com/blockchain/My-Wallet-Android/blob/master/src/piuk/MyRemoteWallet.java. It uses the blockchain API and BitcoinJ to sign locally.

ripper234 (OP)
Legendary
*
Offline Offline

Activity: 1358
Merit: 1003


Ron Gross


View Profile WWW
February 16, 2013, 04:53:33 PM
 #19

This class from the android app may be of some help https://github.com/blockchain/My-Wallet-Android/blob/master/src/piuk/MyRemoteWallet.java. It uses the blockchain API and BitcoinJ to sign locally.

Thanks, look promising - I'll take a closer look when I start implementing.

Please do not pm me, use ron@bitcoin.org.il instead
Mastercoin Executive Director
Co-founder of the Israeli Bitcoin Association
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1134


View Profile
February 16, 2013, 04:57:12 PM
 #20

I don't get the requirement for instant startup. How often do you reinstall your servers? It takes, what, a few minutes to sync for the first time a newly installed server. Are you trying to run your service on a Raspberry Pi or something?

Relying on a third party site like blockchain isn't just a trust issue. You are externalizing some of your costs onto Ben. Why should he pay for a part of your server costs, for free? He might do so for now, because your site will start small and he's a nice guy, but it's kind of rude to assume that if your website gets really big he'll just pony up for serving all your API traffic.

You could also just use the JSON-RPC API on a regular Satoshi node. It's really not such a big deal.

But the details really depend on what you mean by "various operations".
Pages: [1] 2 »  All
  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!