There’s no way to directly get tx data from the v1 blockchain.
Can you set something up like our explorer (https://explorer.blockstack.org) to replicate how we do it? absolutely, but it may be more trouble than it’s worth.
There are a lot of helper services that need to run properly, and I would generally not recommend it (particularly since we’re moving to v2 soon).
So, here are some methods you can use to retrieve tx data. I’ll be using core.blockstack.org, but you should replace that with your local blockstack_core instance.
The corresponding explorer page: https://explorer.blockstack.org/tx/36ec00d97748ce5ce05767dbb7c547aca0ec4fca1ca48765586ec4fd04d59865
- retrieve a block from the core node:
curl -s https://core.blockstack.org/v1/blockchains/bitcoin/operations/654779 | jq
[
{
"address": "1AUjfGid6qpUo1WLWorEfarmapWMLY1BJR",
"block_number": 598907,
"consensus_hash": "0b31b297596be309954aaa5e35499e20",
"first_registered": 598911,
"importer": null,
"importer_address": null,
"last_renewed": 598911,
"name": "zel_crux.id",
"name_consensus_hash": "4d3c4305cd6234048b11dc526e7a751e",
"name_hash128": "3493e9878d798aa4393eaa27e4157c2e",
"namespace_block_number": 373601,
"namespace_id": "id",
"op": "+",
"op_fee": 5500,
"opcode": "NAME_UPDATE",
"preorder_block_number": 598907,
"preorder_hash": "9866c7b04950c314993632fd87967924f71ad232",
"revoked": false,
"sender": "76a91467f7f9424342a0f1ab222ebbc1fb0192d43fe8ab88ac",
"sender_pubkey": "02841d6cb6500a30c88825c1352c5fa1fe7cea66b7d5f61f49f32ab0d5fdb54a3b",
"token_fee": "0",
"txid": "36ec00d97748ce5ce05767dbb7c547aca0ec4fca1ca48765586ec4fd04d59865",
"value_hash": "abccfd4584f10d2891a05f19a81f5d1c0298f414",
"vtxindex": 293
}
]
- (optional) Using a returned tx id, confirm it exists:
curl -s https://explorer-api.blockstack.org/api/v2/search/36ec00d97748ce5ce05767dbb7c547aca0ec4fca1ca48765586ec4fd04d59865 | jq
{
"found": true,
"type": "btc-tx",
"hash": "36ec00d97748ce5ce05767dbb7c547aca0ec4fca1ca48765586ec4fd04d59865"
}
- Retrieve the tx data from our explorer api:
curl -s https://explorer-api.blockstack.org/api/transactions/36ec00d97748ce5ce05767dbb7c547aca0ec4fca1ca48765586ec4fd04d59865 | jq
Now, some blocks obviously will have multiple tx’s in them, ex: https://core.blockstack.org/v1/blockchains/bitcoin/operations/462592
- so you’d want to loop over that output array to retrieve each txid
.
We do also rate-limit excessive traffic, so please don’t simply loop through all blocks, then retrieve the corresponding tx data.