Bitcoin Forum
November 16, 2024, 12:27:35 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Blockchain.info vs. Biteasy API  (Read 1507 times)
cimm (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
April 28, 2014, 01:47:22 PM
Last edit: April 28, 2014, 03:04:30 PM by cimm
 #1

I am trying to redeem a multisig transaction using the bitcore.io library (signing client side in the browser). I need the unspent outputs to to do so. Both Blockchain.info and Biteasy.com have an unspent outputs endpoint:

BLOCKCHAIN.INFO: https://blockchain.info/unspent?active=3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H
Code:
"tx_hash": "db29f6a52fa09bf852cefd514fdd71027894f2b19f6fc752cb5e001dc323079e",
"tx_index": 54805310,
"tx_output_n": 0,
"script": "a914798f9646eb0c7efdd33eaf019a35fc6e37bffb4287",
"value": 100000,
"value_hex": "0186a0",
"confirmations": 1369

BITEASY: https://api.biteasy.com/blockchain/v1/addresses/3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H/unspent-outputs
Code:
"transaction_hash": "9e0723c31d005ecb52c76f9fb1f294780271dd4f51fdce52f89ba02fa5f629db",
"script_pub_key": "HASH160 [798f9646eb0c7efdd33eaf019a35fc6e37bffb42] EQUAL",
"to_address": "3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H",
"value": 100000,
"transaction_index": 0,
"is_spent": 0,
"script_sent_type": "PAY_TO_HASH"

I understand there are small differences between the 2 APIs but... they seem to differ heavily.

  • The tx_hash (db29...) and transaction_hash (9e07...) are not the same?!
  • The tx_index (5480...) and transaction_index (0) are not even close (guess the transaction_index from Biteasy matches with the tx_output_n (0) from Blockchain but if so, what is the tx_index (0))?
  • The script (a914...) and script_pub_key (HASH...)  are in a different format (guess you can encode one in the other)?

Do they simply use different ways to present the same data or is the data different between the two?
Buziss
Hero Member
*****
Offline Offline

Activity: 896
Merit: 1000


View Profile
April 28, 2014, 03:38:48 PM
 #2

I am trying to redeem a multisig transaction using the bitcore.io library (signing client side in the browser). I need the unspent outputs to to do so. Both Blockchain.info and Biteasy.com have an unspent outputs endpoint:

BLOCKCHAIN.INFO: https://blockchain.info/unspent?active=3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H
Code:
"tx_hash": "db29f6a52fa09bf852cefd514fdd71027894f2b19f6fc752cb5e001dc323079e",
"tx_index": 54805310,
"tx_output_n": 0,
"script": "a914798f9646eb0c7efdd33eaf019a35fc6e37bffb4287",
"value": 100000,
"value_hex": "0186a0",
"confirmations": 1369

BITEASY: https://api.biteasy.com/blockchain/v1/addresses/3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H/unspent-outputs
Code:
"transaction_hash": "9e0723c31d005ecb52c76f9fb1f294780271dd4f51fdce52f89ba02fa5f629db",
"script_pub_key": "HASH160 [798f9646eb0c7efdd33eaf019a35fc6e37bffb42] EQUAL",
"to_address": "3CmmhMciChAx4FtGxHtYppoPBLpRLcBy1H",
"value": 100000,
"transaction_index": 0,
"is_spent": 0,
"script_sent_type": "PAY_TO_HASH"

I understand there are small differences between the 2 APIs but... they seem to differ heavily.

  • The tx_hash (db29...) and transaction_hash (9e07...) are not the same?!
  • The tx_index (5480...) and transaction_index (0) are not even close (guess the transaction_index from Biteasy matches with the tx_output_n (0) from Blockchain but if so, what is the tx_index (0))?
  • The script (a914...) and script_pub_key (HASH...)  are in a different format (guess you can encode one in the other)?

Do they simply use different ways to present the same data or is the data different between the two?

I don't know much about it, but the first difference (tx_hash) is due to they are in big-endian and little-endian.
If you go to blockchain.info and want to find that transaction, searching with "db29f6a52fa09bf852cefd514fdd71027894f2b19f6fc752cb5e001dc323079e" will give you nothing, and you need to use "9e0723c31d005ecb52c76f9fb1f294780271dd4f51fdce52f89ba02fa5f629db" lol. Smiley

biteasy
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile WWW
April 30, 2014, 10:08:20 AM
Last edit: April 30, 2014, 10:53:54 AM by biteasy
 #3

I replied to you on Github but I will paste here as well in case someone else is wondering.

1. We use big endian format for displaying transaction hashes. `bitcoind` displays them in the same way and I believe Blockchain.info does the same thing. I do not why the show the specific transaction reversed. Maybe a bug on their side?

2. The `tx_index` which blockchain.info uses I assume is their internal MySQL ids. Our transaction_index is the position of the output within the outputs array.

3. Their `script` is the hex encoded string value and ours is converted to a readable string which contains the OP codes as well but we will probably provide the hex encoded string value in the future if a lot of API users request it. The value we provide is basically intended for displaying (like on our Testnet pages).

Blockchain.info does things their way and we are doing things our way Smiley

Let us know if you have more questions and my apologies for the small delay but it has been crazy here, we will be adding more coins to the site and we are in the middle of changing our infrastructure a bit.



dzimbeck
Legendary
*
Offline Offline

Activity: 2412
Merit: 1044


View Profile
November 06, 2014, 12:17:08 PM
 #4

Blockchain.info listunspent is a very worthless api call. If they don't tell you the correct index then you can't spend the output or you could spend the wrong coins!! It can actually cause someone to lose money.
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!