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

Calculate compiled ErgoScript hash from URL #25

Closed
greenhat opened this issue Jun 24, 2022 · 5 comments · Fixed by #26
Closed

Calculate compiled ErgoScript hash from URL #25

greenhat opened this issue Jun 24, 2022 · 5 comments · Fixed by #26

Comments

@greenhat
Copy link
Member

greenhat commented Jun 24, 2022

Motivation

To show a hash of serialized ErgoTree for a published contract(ErgoScript). Think of a contract in EIP that is then used in some off-chain code. The idea is to give a user a way to check the hash of the published contract (EIP) to be equivalent to the hash of the compiled contract used in the app(off-chain code).

Implementation details

Fetch ErgoScript from a given URL (i.e. github), compile it to ErgoTree, serialize then calculate a hash. Print the hash along with P2S addresses for mainnet and testnet, and also print serialized ErgoTree in Base16 encoding (node/explorer API format).

@kettlebell
Copy link
Collaborator

Hi @greenhat, do you want this feature to be packaged as a separate playground, or part of the library? Also, does the dependency on ergo-scala-compiler overlap with appkit? Thanks.

@greenhat
Copy link
Member Author

Part of the library. In the end, I see a link in EIP repo to Scastie that calculate and shows the hash for the contract in EIP's PR.
ergo-scala-compliler is ErgoScala to ErgoTree compiler, not ErgoScript. ErgoScala is compiled via Scala macros and is in PoC status.

@kettlebell
Copy link
Collaborator

When it's convenient for you, could I please get write access to this repo? I've got a PR for this issue ready to go.

@greenhat
Copy link
Member Author

Sure. I sent an invitation.

@kettlebell
Copy link
Collaborator

Thank you!

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 a pull request may close this issue.

2 participants