No description
Find a file
2024-12-13 13:57:30 +01:00
migrations feat: return layout as metadata 2024-07-29 15:02:37 -04:00
src cleanup 2024-12-13 13:57:30 +01:00
.env.example chore: readme 2024-07-29 08:09:49 -04:00
.gitignore potential fix 2024-12-13 13:27:11 +01:00
Cargo.lock cleanup 2024-12-13 13:57:30 +01:00
Cargo.toml cleanup 2024-12-13 13:57:30 +01:00
docker-compose.yml potential fix 2024-12-13 13:27:11 +01:00
LICENSE chore: clean up initial config 2024-07-26 16:30:32 -04:00
README.md chore: update readme 2024-08-07 01:54:16 -04:00

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
}