1 min read

Stark/Cairo Tutorial 1-Hello World

Stark/Cairo is a bit obtuse, but you can get to a hello world equivalent by creating hello_world.cairo file with the following:

%builtins output

from starkware.cairo.common.serialize import serialize_word

func main{output_ptr : felt*}():
    return ()

Compile and run the file

cairo-compile hello_world.cairo \
--output hello_world_compiled.json

cairo-run --program=hello_world_compiled.json \
--print_output --layout=small

Program output:

The explanations for this code are found here.

Github for the above here.