diff --git a/src/toolchain/torii/reference.md b/src/toolchain/torii/reference.md new file mode 100644 index 00000000..aca45453 --- /dev/null +++ b/src/toolchain/torii/reference.md @@ -0,0 +1,56 @@ +## torii reference + +### Name + +torii - An automatic indexer and networking layer for a world contract. + +### USAGE + +```sh +torii [OPTIONS] +``` + +### DESCRIPTION + +`torii` starts the indexer and exposes GraphQL/gRPC API endpoints. The indexer queries the specified Starknet RPC endpoint for transaction blocks and listens for transactions related to the world contract. These transactions can include component/system registrations, entity state updates, system calls, and events. The parsed data is then stored in a local SQLite database. + +The GraphQL and gRPC API endpoints run in tandem with the indexer, providing custom queries specific to the world contract for client applications. + +#### Database URL + +`torii` uses a sqlite database to store indexed data. The database can be stored either in-memory or persistently on the filesystem. + +- The in-memory database is ephermal and only lasts as long as the indexer is running. This is a fast and simple option to start the indexer for development/testing. +- Presistent storage should be used in production. It relies on the local filesystem for storage. + +Note: If using in-memory db, after a period of inactivity the memory will be garbage collected and queries will result in errors. Workaround is starting `katana` with `--block-time` or use persistent database. + +```sh +# Persistent database storage using file indexer.db +torii --database-url sqlite:indexer.db +``` + +### OPTIONS + +#### General Options + +`-w, --world` +     Address of the world contract to index + +`--rpc` +     Starknet RPC endpoing to use [default: http//localhost:5050] + +`-m, --manifest ` +     Specify a local manifest to initialize from + +`-d, --database-url ` +     Database URL (read more above) [default: sqlite::memory:] + +`-s, --start-block ` +     Specify a block to start indexing from, ignored if stored head exists [default: 0] + +`-h, --help` +     Print help + +`-V, --version` +     Print version