adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 26, 2013, 10:58:33 AM |
|
HI there, I am interested in building a web page that watches a set of transactions and their number of confirmations as they rise. As a novice developer, what's the best and/or easiest way to do this? I checked http://blockchain.info/api/blockchain_api and confirmed transactions doesn't appear part of their api for Single transaction. How could I get the necessary data realtime? cheers.
|
|
|
|
Mike Hearn
Legendary
Offline
Activity: 1526
Merit: 1129
|
|
July 26, 2013, 05:33:39 PM |
|
You can do this with bitcoinj if you are OK with Java.
|
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1354
aka tonikt
|
|
July 26, 2013, 07:37:53 PM |
|
I just wonder, why do you even need it? Watching a set of transactions and their number of confirmations as they rise - seems pretty crazy for me
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1354
aka tonikt
|
|
July 26, 2013, 07:49:06 PM |
|
I mean, I dont want to be mean, but if you explain you application maybe we could explain you better.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 26, 2013, 11:03:29 PM |
|
I just wonder, why do you even need it? Watching a set of transactions and their number of confirmations as they rise - seems pretty crazy for me Thanks for responses. I just want to know when a few transactions I will make have hit 4 confirmations. Can I do that with bitcoinj on transactions where I don't hold any keys... totally independent of me? Or rather, I don't want to link the web app in any way to my wallet, so I make the transaction, and then close my wallet app... but tell the confirmation app the transaction address(es) to track for subsequent confirmations. I skimmed the documentation.. but not sure if I can do that with bitcoinj.
|
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1354
aka tonikt
|
|
July 26, 2013, 11:13:53 PM |
|
I just want to know when a few transactions I will make have hit 4 confirmations/ So you basically want to send a tx, from you wallet, and then get some alatm clock tiggered, when it reaches 4 confiscation. How much secured you need to have ii? If not, I belvbe any block explorer would ro.
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 26, 2013, 11:21:05 PM |
|
I just want to know when a few transactions I will make have hit 4 confirmations/ So you basically want to send a tx, from you wallet, and then get some alatm clock tiggered, when it reaches 4 confiscation. How much secured you need to have ii? If not, I belvbe any block explorer would ro. Thanks what's the easiest or fastest way to build my own block explorer.. or can bitcoinj do what is required if it knows the transactions to watch.. or does it require keys of some sort?
|
|
|
|
Come-from-Beyond
Legendary
Offline
Activity: 2142
Merit: 1009
Newbie
|
|
July 26, 2013, 11:25:08 PM |
|
HI there, I am interested in building a web page that watches a set of transactions and their number of confirmations as they rise. As a novice developer, what's the best and/or easiest way to do this? I checked http://blockchain.info/api/blockchain_api and confirmed transactions doesn't appear part of their api for Single transaction. How could I get the necessary data realtime? cheers. [ block_height acquired via http://blockchain.info/latestblock] minus [ block_height of ur transaction] plus 1
|
|
|
|
piotr_n
Legendary
Offline
Activity: 2053
Merit: 1354
aka tonikt
|
|
July 26, 2013, 11:25:38 PM |
|
I just want to know when a few transactions I will make have hit 4 confirmations/ So you basically want to send a tx, from you wallet, and then get some alatm clock tiggered, when it reaches 4 confiscation. How much secured you need to have ii? If not, I belvbe any block explorer would ro. Thanks what's the easiest or fastest way to build my own block explorer.. or can bitcoinj do what is required if it knows the transactions to watch.. or does it require keys of some sort? So what are you going to do, after the alarm clock triggers the 4th confirmation?
|
Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.PGP fingerprint: AB9E A551 E262 A87A 13BB 9059 1BE7 B545 CDF3 FD0E
|
|
|
|
Come-from-Beyond
Legendary
Offline
Activity: 2142
Merit: 1009
Newbie
|
|
July 27, 2013, 02:07:40 PM |
|
It's better to keep things simple. I would poll the latest block each 10 sec.
|
|
|
|
Abdussamad
Legendary
Offline
Activity: 3640
Merit: 1571
|
|
July 27, 2013, 02:41:47 PM |
|
See here: http://blockchain.info/q/See under address lookups Also in future if you ever find yourself wondering how to do something bitcoin related go through the ENTIRE page below: http://blockchain.info/api/Blockchain.info has half a dozen different APIs and it is easy to miss a few.
|
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 28, 2013, 12:47:37 PM |
|
Cheers. I just found this: "Bitcoin blockchain in a MongoDB database to allow querying of block and transaction data.. In order to use bitcoinquery you need a Bitcoind RPC server. " http://github.com/thelinuxkid/bitcoinqueryLong term, probably better to move away from third party APIs if opening to outside users.
|
|
|
|
assortmentofsorts
Member
Offline
Activity: 91
Merit: 10
|
|
July 28, 2013, 02:21:16 PM |
|
HI there, I am interested in building a web page that watches a set of transactions and their number of confirmations as they rise. As a novice developer, what's the best and/or easiest way to do this? I checked http://blockchain.info/api/blockchain_api and confirmed transactions doesn't appear part of their api for Single transaction. How could I get the necessary data realtime? cheers. [ block_height acquired via http://blockchain.info/latestblock] minus [ block_height of ur transaction] plus 1 The way I do it is.. using http://blockchain.info/api/api_websocket api, I subscribe to new blocks. Every time a block is found, I store the block height from the JSON payload that is sent back (as a key in redis). I store my 0-confirmation transaction indexes (which I again fetch from blockchain: http://blockchain.info/rawtx/$tx_hash) in a collection ( pending_transactions) in mongodb. The JSON payload for a new block contains a list of transaction indexes ( block.x.txIndexes) which I match against the ones stored in my mongodb collection (and increment their confirmation count by 1). I also increment confirmation counts of all those transactions(excluding the txIndexes sent in the payload) that already have 1 confirmation (note: I don't increment 0 confirmations). When it hits 6 confirmations, I move the transaction from pending_transactions collection to confirmed_transactions collection. The reason I do all this nonsense is that sometimes 0 confirmation transactions never get included in the new blocks (ex: when you send with 0 fee). So doing a latest_block_height - block_height_of_transaction + 1 may not work for such edge cases. Also there are times where your server might crash due to unknown bugs. When the server reboots, I fetch all blocks from where I left off (use the last stored block height in redis and then fetch block heights from blockchain. Example: http://blockchain.info/block-height/246536?format=json) and catch-up to the latest block (and repeat the whole process again). This is temporary though. My future plan is to write my own client with these features (esp notifications on confirmations; it sucks that there is no API to subscribe for notifications) or fork the bitcoin client and make these necessary changes.
|
If you want to tip: BTC 1KbjTUEfcziwMv7BMXcjmvNAKEpTJbZCsF
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 28, 2013, 03:29:17 PM |
|
Yeah, I found this Lua script that uses twilio and mailgun that is used to curl to alert via email, sms, or phone when something completes. http://gist.github.com/jnankin/6089984
|
|
|
|
Mike Hearn
Legendary
Offline
Activity: 1526
Merit: 1129
|
|
July 29, 2013, 12:45:06 PM |
|
With bitcoinj you can use a depth future. Something like the following would work (not compiled or testing, just typed from memory): byte[] pubkeybytes = ....;
Wallet wallet = new Wallet(params); wallet.addKey(new ECKey(null, pubkeybytes));
... (insert usual boilerplate setup here) ...
wallet.addEventListener(new AbstractWalletEventListener() { public void onCoinsReceived(Wallet wallet, Transaction tx, BigInteger prevBalance, BigInteger newBalance) { // Transaction was received. Get a callback when 4 confirmations have occurred. ListenableFuture<Transaction> future = tx.getConfidence().getDepthFuture(4); Futures.addCallback(future, new FutureCallback<Transaction>() { public void onSuccess(Transaction tx) { System.out.println("Transaction " + tx + " now has 4 confirmations - party time!!"); } }); } });
The syntax is a bit verbose - languages like Java 8 or Kotlin have some features to make it more fluid, if you don't mind what language you use. Also, if your app restarts, you'll have to re-register the confidence listeners on the loaded wallet of course.
|
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
July 29, 2013, 01:06:47 PM |
|
Thanks Mike - I think the key is to differentiate watching confirmations for a private wallet and watching them for a public blockchain. For my application, it's all about OPCs -- other people's confirmations, because I want to separate the new app from my wallet app. Does bitcoinj allow that?
A Confirmation Party site would be good... you could have a $20,000 confirmation party room and a $500,000 room - social networking for high rollers.
|
|
|
|
Mike Hearn
Legendary
Offline
Activity: 1526
Merit: 1129
|
|
July 29, 2013, 02:28:42 PM |
|
The key issue is scalability. If you want to monitor tens of thousands of keys/transactions, bitcoinj probably won't scale to what you need. If you want to monitor less than that, it might work. You could try it.
|
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
August 08, 2013, 02:46:52 PM |
|
A London-based hacker has been working on this site idea with me, to my delight, and we'll have something up in the next week that will alert on confirmations, with some other lookup goodies in the pipeline.
|
|
|
|
adrian33 (OP)
Member
Offline
Activity: 118
Merit: 10
|
|
September 21, 2013, 05:07:50 PM |
|
We've finally got something up. -- http://donebit.comThe site gives information on any transaction or any address, with ability to setup email notifications on transactions (regarding confirmations) and addresses (regarding input and outputs according to certain triggers.) Check it out.
Would be happy to hear feedback or answer questions.
|
|
|
|
|