Working with Electrum: Generating Scripthashes from addresses
Electrum is a great way to interact with Bitcoin like blockchains without having to download the whole chain yourself. It allows for something called a light client.
This lightness however comes with a small, but consequential pitfall.
How do you generate Scripthashes?
Scriphashes are not your regular addresses or public keys.
A (multigsig) Peercoin address
Its respective coin hash
They are their own special format to make procceses inside of Electrum servers easier. Depending on the programming language you're using, it can be very cumbersome to convert addresses internally into Electrum-compliant Scripthashes.
Utilizing a Scripthash generator
We have developed two solutions for you.
Using dart_scripthash_generator, a CLI-tool which will return you the Scripthash for a given network, presently Bitcoin, Peercoin and their respective testnets.
This tool requires you to have Dart installed.
Using dart_scripthash_server, a dockerized microservice, which provides a simple endpoint to query Scripthashes fast and reliably. All you need is Docker or docker-compose.
We hope you found this useful!