Pages:
Author

Topic: Getting unspent outs for arbitrary addresses from BlockExplorer. (Bounty 20BTC) (Read 8676 times)

hero member
Activity: 640
Merit: 771
BTC⇆⚡⇄BTC
Any chance in creating something similiar for Litecoin - LTC?  Wink
hero member
Activity: 688
Merit: 500
ヽ( ㅇㅅㅇ)ノ ~!!
Hello, can anyone help me with a problem? I'm getting this error when trying to use this:

Cannot read property "amount" of undefined

offlineTransaction.js line 220

Code:
// if this came from a transaction to our address...
if (lilendHash in unspenttxs) {
unspenttx = unspenttxs[lilendHash];

// remove from unspent transactions, and deduce the amount from the balance
balance = balance.subtract(unspenttx[p.n].amount); <-- line 220
delete unspenttx[p.n]
if (isEmpty(unspenttx)) {
delete unspenttxs[lilendHash]
}
}

So unspenttx[p.n] is undefined for some reason.

The correct address is deduced from the private key but the balance remains zero and I get this error.

This worked fine the first time I used it, just now it doesn't seem to... Something in the changed output from blockexplorer is causing it to fail...
newbie
Activity: 4
Merit: 0
@dogisland. Thank you for your advise. I understand this problem with quick succession. But no, at my unsuccessful broadcastings I've really observed that there wars no transactions broadcasted. For my tests I've send the BTC's from my offline wallet to my own wallet address handled by the running standard bitcoin client. If broadcasting is done I can see with a small delay for the network distribution the transactions with zero confirmations also before the transaction is bound into the block chain.
But anyway I'm sure the Tx creation is correct and I will use now offline wallets with higher balances to store my Coins.
The only risk for me is the private service from nibor. I can't estimate that he is willing to hold this service available for all time due to the hosting costs and due to the small donations therefore.
May be a more official bitcoin page will double this service.
sr. member
Activity: 262
Merit: 250
Today I've succeeded an offline transaction with BTCurious's Tx generation script and nibor's new broadcasting page. My spending amount wars smaller than my balance and so I've got back the change BTC's to the spending address.
May be my observations posted above are only an unfortunate fortuitousness caused by overloading nibor's broadcasting service.
Again I can confirm that the Tx generation script will work excellent.


If you see issues I'm willing to bet you're sending 2 transactions form 1 private key in quick succession.

This won't work as the the logic will pick the same TX out each time. You'll need to wait for each transaction to be picked up in a block then retrieve the TX outs agian from blockexplorer.
newbie
Activity: 4
Merit: 0
Today I've succeeded an offline transaction with BTCurious's Tx generation script and nibor's new broadcasting page. My spending amount wars smaller than my balance and so I've got back the change BTC's to the spending address.
May be my observations posted above are only an unfortunate fortuitousness caused by overloading nibor's broadcasting service.
Again I can confirm that the Tx generation script will work excellent.
newbie
Activity: 4
Merit: 0
Hi BTCurious,
Your script to generate offline transactions is a very very helpfull idea, much better than the import of my private key to my wallet e.g with the script pywallet. I've used your script and nibor's broadcasting page many times. At most cases I've got success but some times I've got no success.
May be the following observation can help you for debugging:
At all cases I filled my offline address with a small balance by a single transmission. At all cases I spend no fee for the back transmission by your sript. The success depends on the amount for the back transmission. At all cases I spend the entire balance as amount the transmission succeeded. But all times I spend only a part of the balance and the transmission generates a change I found no broadcasting. May be it is not valid to give back the change to the spend address by a single transmission. Please compare with the discussion on http://bitcoin.stackexchange.com/questions/1629/why-does-bitcoin-send-the-change-to-a-different-address
member
Activity: 62
Merit: 10
What do you mean our cooperative pages?

I use your page together with nibor's page.
One for creating tx and another for uploading/broadcasting.
hero member
Activity: 714
Merit: 504
^SEM img of Si wafer edge, scanned 2012-3-12.
Could it be, that those transactions take some time?
No, I usually check if I see any unverified transactions on for example bitcoincharts.org (but the original client shows them too), but even after a longer time it didn't work.

Maybe you ask nibor, maybe he changed in the meantime he's code? (I am very much interested that your cooperative pages work!)
Could be, not sure. Maybe btc_novice could try again now? He originally stated that fees didn't work…
What do you mean our cooperative pages?
member
Activity: 62
Merit: 10
Strange, I tried sending a transaction with a fee via nibor's site, and it didn't get broadcast. Then I sent one via my custom script, and it worked fine. So I figured it was nibor's fault. But now I tried via nibor again, and now it works Huh

Could it be, that those transactions take some time? ... But by definition transaction fee should force tx-s getting through almost immediately? Maybe you ask nibor, maybe he changed in the meantime he's code? (I am very much interested that your cooperative pages work!)
hero member
Activity: 714
Merit: 504
^SEM img of Si wafer edge, scanned 2012-3-12.
Strange, I tried sending a transaction with a fee via nibor's site, and it didn't get broadcast. Then I sent one via my custom script, and it worked fine. So I figured it was nibor's fault. But now I tried via nibor again, and now it works Huh
hero member
Activity: 714
Merit: 504
^SEM img of Si wafer edge, scanned 2012-3-12.
I tried using the offline transaction generator. Two things--  It doesn't seem to work in IE (but does in Firefox), and it doesn't seem to work when you add a transaction fee (but does if you leave it at 0).

BTCurious,
is it really so? Transaction fee > 0 does not work?
Can it be fixed?
Is it really so? Uh, not sure? I haven't noticed it during development, but I'll check it after this weekend (not on my main PC now). If anyone wants to investigate before that, please check what "doesn't seem to work" means. Doesn't show anything? Does give a transaction, but the transaction has no fee? Any different interpretation?

Can it be fixed? Yes, trivially, once I know what exactly is wrong.
member
Activity: 62
Merit: 10
Um, sorry, gotta ask the obvious question:
Why would anyone want to past their private key anywhere ... ever ...

1) Nibor's webpage is downloaded into one's own computer before usage.
2) It's javascript page, therefore computations are made in one's own computer, not on the server side.
legendary
Activity: 4592
Merit: 1851
Linux since 1997 RedHat 4
Um, sorry, gotta ask the obvious question:
Why would anyone want to past their private key anywhere ... ever ...
member
Activity: 62
Merit: 10
I tried using the offline transaction generator. Two things--  It doesn't seem to work in IE (but does in Firefox), and it doesn't seem to work when you add a transaction fee (but does if you leave it at 0).

BTCurious,
is it really so? Transaction fee > 0 does not work?
Can it be fixed?
member
Activity: 62
Merit: 10
Thank you for your efforts, but my Opera 9.63 still heralds errors:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

JavaScript - file://localhost/D:/tmp2/offlineTransaction.html
Inline script compilation
Syntax error while loading: line 1 of linked script at file://localhost/D:/tmp2/lib/json2.js :
Expected statement

-^


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Address is being parsed, balance remains unknown.  Sad

----------------

EDIT:
It was my fault. I did not download the right json2.js file (If you'd uploaded *.zip file, there wouldn't been any error).
Now it's working in Opera!  Cheesy

hero member
Activity: 714
Merit: 504
^SEM img of Si wafer edge, scanned 2012-3-12.
The opera problem is not too hard to fix. Apparently the older operas don't have a native JSON parser, I didn't know that.
Download this new offlineTransaction.html and overwrite the old one: http://ge.tt/9k6qyk9
And put this file in the lib directory: http://ge.tt/88MLyk9

And if you download this offlineTransaction.js and overwrite the old one, the OperaTor problem should be gone too: http://ge.tt/9jstkk9

Internet explorer is a bit harder to fix though… it does some weird things and there's no decent debugger…
member
Activity: 62
Merit: 10
And here is error in OperaTor Javascript console:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

JavaScript - ./offlineTransaction.htm
Inline script compilation
Syntax error while loading: line 209 of linked script at ./offlineTransaction.js :
Expected identifier
      for (var b in tx.in ) {
---------------------^


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
member
Activity: 62
Merit: 10
Address is:
EDIT: deleted

And Opera Javacript errors are:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

JavaScript - file://localhost/D:/tmp2/offlineTransaction.html
Event thread: click
Error:
name: ReferenceError
message: Statement on line 180: Undefined variable: JSON
Backtrace:
  Line 180 of linked script file://localhost/D:/tmp2/offlineTransaction.js: In function parseTxs
       var tmp = JSON.parse(data);
  Line 140 of linked script file://localhost/D:/tmp2/offlineTransaction.js: In function parseFormData
       var result = parseTxs(form.transactions.value,ownAddress); // {balance:, unspenttxs:{ "": { : { amount:, script: