Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow looking up transactions via scripthash #7

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

shesek
Copy link
Collaborator

@shesek shesek commented Dec 7, 2018

This adds the following new endpoints -

Lookup by the scriptpubkey hash:

  • GET /scripthash/:scripthash
  • GET /scripthash/:scripthash/txs
  • GET /scripthash/:scripthash/utxo

Lookup by the scriptpubkey hex:

  • GET /scriptpubkey/:scripthex
  • GET /scriptpubkey/:scripthex/txs
  • GET /scriptpubkey/:scripthex/utxo

Lookup by the pubkey (p2pk only):

  • GET /pubkey/:pubkey
  • GET /pubkey/:pubkey/txs
  • GET /pubkey/:pubkey/utxo

@shesek shesek changed the title Lookup txs via scripthash, scriptpubeky or pubkey Lookup txs via scripthash, scriptpubkey or pubkey Dec 7, 2018
@shesek
Copy link
Collaborator Author

shesek commented Dec 7, 2018

I'm not really sure we really need scriptpubkey and pubkey, maybe just add scripthash?

@romanz
Copy link
Collaborator

romanz commented Dec 9, 2018

I'm not really sure we really need scriptpubkey and pubkey, maybe just add scripthash?

I agree - this way the backend logic will be simpler.

This adds the following new endpoints:

- GET /scripthash/:scripthash
- GET /scripthash/:scripthash/txs
- GET /scripthash/:scripthash/utxo
@shesek
Copy link
Collaborator Author

shesek commented Dec 10, 2018

I force-pushed 16891ae which removes lookup by scriptpubkey/pubkey and leaves just scripthash/address.

@shesek shesek changed the title Lookup txs via scripthash, scriptpubkey or pubkey Allow looking up transactions via scripthash Dec 10, 2018
@shesek shesek merged commit 356e72f into Blockstream:bitcoin_e Dec 10, 2018
@shesek
Copy link
Collaborator Author

shesek commented Dec 10, 2018

Cherry-picked to liquid_e in b631e3f.

@isghe
Copy link

isghe commented Feb 11, 2019

Hi @shesek do you have any working example, I tried with https://blockstream.info/api/scripthash/0054c22ddfa26c9fd050414919dff5320c45a33e587c8e1f3e but I got a "502 Bad Gateway". Thanks :-)

@isghe
Copy link

isghe commented Feb 14, 2019

@shesek solved! the input must be the sha256 of the hextobin of field hex.
Here a working example:

$ echo -n "41041ada81ea00c11098d2f52c20d5aa9f5ba13f9b583fda66f2a478dd7d95a7ab615159d98b63df2e6f3ecb3ef9eda138e4587e7afd31e7f434cbb6837e17feb0c5ac" | xxd -r -p | sha256
24720d8e1c30f12c14b928fa98f82fb58ea977d5ae119e8dec44ed8fde0e4242

https://blockstream.info/api/scripthash/24720d8e1c30f12c14b928fa98f82fb58ea977d5ae119e8dec44ed8fde0e4242

:-)

junderw pushed a commit to junderw/electrs that referenced this pull request May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants