mirror of
https://github.com/HerodotusDev/program_registery.git
synced 2026-05-22 13:26:23 +00:00
No description
- Rust 100%
| migrations | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| docker-compose.yml | ||
| LICENSE | ||
| README.md | ||
Program Registery
The Program Registry is a server that accepts compiled Cairo programs (also known as CASM files), fetches the compiler version dynamically, computes the correct program hash, and stores the bytecode of the Cairo program along with the program hash.
The program hash is a unique calculation of the program bytecode. Based on the compiler version, the computation might vary slightly. You can also retrieve the exact hash via the cairo-run command from cairo-lang.
Our main motivation is to have a registry of Cairo programs so that we can retrieve the compiled Cairo program using the given program hash.
Quick start (local)
1. environment variable
Make sure to have DATABASE_URL on .env file.
2. run migration
sqlx migrate run
3. run program
cargo run -r
/upload-program
curl --location 'http://127.0.0.1:3000/upload-program' \
--form 'program=@"./hdp.json"' \
--form 'version="0"'
response:
0x343995a543ac64616d33fa77670cfa4e498691c96c2d964a0a07181dff4ce81
/delete-program
curl --location --request DELETE 'http://localhost:3000/delete-program?program_hash=0x64041a339b1edd10de83cf031cfa938645450f971d2527c90d4c2ce68d7d412'
/get-program
curl --location --request GET 'http://127.0.0.1:3000/get-program?program_hash=0x343995a543ac64616d33fa77670cfa4e498691c96c2d964a0a07181dff4ce81' \
--header 'Content-Type: application/json'
response will be json file of target program
/get-metadata
request:
curl --location 'http://127.0.0.1:3000/get-metadata?program_hash=0x294cd7453d81e9633bbf295082f5a7e51e2a8714e3c59e70fc5969ea41e3da5'
response:
{
"layout": "recursive_with_poseidon",
"version": 2
}