Bitcoin Forum

Other => Meta => Topic started by: babo on June 25, 2019, 01:00:12 PM



Title: [Userscript] print balance of address - v0.4
Post by: babo on June 25, 2019, 01:00:12 PM
hello there

https://github.com/blackout314/greasemoney-btctalk_btcbalance/tree/master

automatic push a image of balance of address

i used this service http://btc-priceimg.herokuapp.com/

for print image :)

i hope is usefull for community

https://i.imgur.com/BIJiMwc.png


CHANGELOG
v0.4 - https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.4
- support bcxxxx addresses (change img delivery service)

v0.3 - https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.3
- improved regex

v0.2 - https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.2
- fix bug in post new reply page


Title: Re: [Userscript] print balance of address - v0.1
Post by: hd49728 on June 25, 2019, 01:44:14 PM
Thank you, and welcome to my list.
Added newest userscript.
TopicDatewritten bySectionMerit
_________________________________________________________________________________________________________________________
print balance of address - v0.1 (https://bitcointalk.org/index.php?topic=5158298.0)25/6/2019babocheck address balance0+


Title: Re: [Userscript] print balance of address - v0.1
Post by: babo on June 26, 2019, 08:01:44 AM
i found little bug when you send reply
i fix asap with a little trick, i place 'post reply' in blacklist of script (script not work)

let me work on it


Title: Re: [Userscript] print balance of address - v0.2
Post by: babo on June 27, 2019, 12:30:02 PM
released with bugfix

https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.2

now new post link is escluded


Title: Re: [Userscript] print balance of address - v0.2
Post by: Xal0lex on June 27, 2019, 03:04:38 PM
SegWit addresses don't work  :(

https://i.imgur.com/QojuQ9S.png


Title: Re: [Userscript] print balance of address - v0.2
Post by: khaled0111 on June 27, 2019, 03:28:28 PM
SegWit addresses don't work  :(
Because the script uses blockchain.info's API which does not support segwit.


Title: Re: [Userscript] print balance of address - v0.2
Post by: babo on June 27, 2019, 03:55:18 PM
SegWit addresses don't work  :(

https://i.imgur.com/QojuQ9S.png


ok thank you for your issue
tomorrow i will fix it and release 0.3

thank you


Title: Re: [Userscript] print balance of address - v0.2
Post by: Jet Cash on June 27, 2019, 03:59:10 PM
Thank goodness I use multiple addresses and wallets.


Title: Re: [Userscript] print balance of address - v0.2
Post by: pooya87 on June 28, 2019, 04:16:20 AM
you might want to add some more encoding checks (base58 and bech32 if you could add it) to the values you capture as "addresses" instead of a simple regex check for characters. right now it seems like it is possible to catch something like a transaction ID that starts with 1 or 3 (32 byte and having 0-9 and a-f) as an address.


Title: Re: [Userscript] print balance of address - v0.2
Post by: babo on June 28, 2019, 06:05:37 AM
you might want to add some more encoding checks (base58 and bech32 if you could add it) to the values you capture as "addresses" instead of a simple regex check for characters. right now it seems like it is possible to catch something like a transaction ID that starts with 1 or 3 (32 byte and having 0-9 and a-f) as an address.

We can
Transactions? Do you have a regex ready?
Today i'll fix and ehance it


Title: Re: [Userscript] print balance of address - v0.2
Post by: khaled0111 on June 28, 2019, 05:51:25 PM
Transactions? Do you have a regex ready?
try this one:
Code:
^([13][a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[ac-hj-np-zAC-HJ-NP-Z02-9]{11,71})$
I found it here:
http://mokagio.github.io/tech-journal/2014/11/21/regex-bitcoin.html

You can also verify whether the address is valid or not by checking its checksum.


Title: Re: [Userscript] print balance of address - v0.2
Post by: babo on June 28, 2019, 06:07:07 PM
try this one:
Code:
^([13][a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[ac-hj-np-zAC-HJ-NP-Z02-9]{11,71})$
I found it here:
http://mokagio.github.io/tech-journal/2014/11/21/regex-bitcoin.html

You can also verify whether the address is valid or not by checking its checksum.


thank you so much, today i dont have spare time for update it, i'll try tomorrow
is a simple regex sobstitution for catch bc1xxxx address

and after i'll study a method for TX


Title: Re: [Userscript] print balance of address - v0.2
Post by: pooya87 on June 29, 2019, 03:40:34 AM
regex is not enough since it can only check validity of characters. i don't know how JavaScript works but basically you need to add a function instead of that one liner to decode the strings using Base58 encode/decode technique which would mean converting it to its numerical value then hashing the byte array using SHA256 twice and taking 4 bytes of it as checksum then see if it is correct. then pass it to get the balance. more info: https://en.bitcoin.it/wiki/Base58Check_encoding

i didn't mention Bech32 since the btc-priceimg and the blockchain.info API it uses don't support them but here is the link to its documentation: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki


Title: Re: [Userscript] print balance of address - v0.2
Post by: babo on June 29, 2019, 01:54:34 PM
release 0.3 version

https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.3

with improved regex

:)

--- update ---
http://btc-priceimg.herokuapp.com/balance/bc1qh4vcjnq5n26p9rny0mr9nlvcea0d4ksx53g8q0/ff0000

image not work, because btc-priceimg not work


Title: Re: [Userscript] print balance of address - v0.3
Post by: TryNinja on June 29, 2019, 10:45:55 PM
I've made my own "bitcoin balance image" server that also supports Segwit addresses (bech32 included). In case you want to use in your script.

Code:
https://btc.ninjastic.space/balance/ADDRESS/COLOR
(color is optional)

Quote
https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6
Result: https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6

With color:

Quote
https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6/ff0000
Result: https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6/ff0000


Title: Re: [Userscript] print balance of address - v0.3
Post by: RapTarX on June 30, 2019, 04:19:50 AM
I've made my own "bitcoin balance image" server that also supports Segwit addresses (bech32 included). In case you want to use in your script.

Images aren't displayed.


Title: Re: [Userscript] print balance of address - v0.3
Post by: TryNinja on June 30, 2019, 11:03:09 AM
I've made my own "bitcoin balance image" server that also supports Segwit addresses (bech32 included). In case you want to use in your script.

Images aren't displayed.
Hmm... it’s working here. Can you try opening it directly?


Title: Re: [Userscript] print balance of address - v0.3
Post by: babo on June 30, 2019, 01:28:50 PM
I've made my own "bitcoin balance image" server that also supports Segwit addresses (bech32 included). In case you want to use in your script.

Code:
https://btc.ninjastic.space/balance/ADDRESS/COLOR
(color is optional)

Quote
https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6
Result: https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6

With color:

Quote
https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6/ff0000
Result: https://btc.ninjastic.space/balance/bc1qfxj5fzzhkpnuyyezy9z7j7axja7n632d5wxzj6/ff0000

Perfect
I will use your service instead heroku app

Let me code the diff, and release v0.4
Thank you


Title: Re: [Userscript] print balance of address - v0.3
Post by: babo on July 01, 2019, 08:02:08 AM
v 0.4 released

https://github.com/blackout314/greasemoney-btctalk_btcbalance/releases/tag/0.4

now bcxxxx addresses are supported


Title: Re: [Userscript] print balance of address - v0.4
Post by: HCP on July 01, 2019, 11:34:33 AM
Script doesn't seem to be working 100%

Check this thread: https://bitcointalk.org/index.php?topic=5159518.0

For some reason it is detecting the beginning of the transactionID: e7a3e5b1a2f7c2aa5fa9ebf1cc31c123a83367502c7648dfb6c1baa0ff3e8436 as a bitcoin address and attempting to generate the balance image for it??!?

This is what I see:
https://talkimg.com/images/2023/11/15/z9XMq.png


Also, from looking at the "Stake Your Address" thread (https://bitcointalk.org/index.php?topic=996318.10180), it is breaking URLs with addresses in them, for instance Block Explorer links:
So, this URL:
https://talkimg.com/images/2023/11/15/z9dJj.png
is actually encoded as:
https://www.blockchain.com/btc/address/384pXJVj7H49Sp9p9v5RnkbozM3ioVcgnL%20%3Cimg%20src='https://btc.ninjastic.space/balance/384pXJVj7H49Sp9p9v5RnkbozM3ioVcgnL/ff0000'/%3E


and it is also struggling with large blocks of "hex"... like GPG keys etc:
https://talkimg.com/images/2023/11/15/z9upG.png

and Signed Messages:
https://talkimg.com/images/2023/11/15/z9ASD.png


Not sure if this is a Chrome/Tampermonkey specific issue.


Title: Re: [Userscript] print balance of address - v0.4
Post by: babo on July 01, 2019, 11:55:29 AM
ok
thank you for your report

we have
- fix problem with large element (like pgp signature)
- fix problem with bcxxx address
- fix problem with a href