diff --git a/src/toolchain/katana/reference.md b/src/toolchain/katana/reference.md index b07c29e2..f92a10dd 100644 --- a/src/toolchain/katana/reference.md +++ b/src/toolchain/katana/reference.md @@ -27,6 +27,55 @@ You can switch from the default mining behaviour to interval mining, where a new katana --block-time 10000 ``` +#### Forking + +Katana supports forking from a Starknet RPC provider. You can configure your node to enable the forking feature by providing a valid RPC provider using the `--rpc-url ` flag., which would initiate Katana to fork the latest block of the provided network. If you would like to fork from a specific block, you can do so using `--fork-block-number `. + +NOTE: This does not allow fetching of historical blocks but only blocks that are mined by Katana. However, support for fetching historical blocks will be added in the future. + +```sh +# Forks the network at block 1200 +katana --rpc-url http://your-rpc-provider.com --fork-block-number 1200 +``` + +#### Messaging + +Katana also allows users to perform L1 <-> L2 integration using the messaging feature. There are two types of messaging service supported by Katana: + +1. _Ethereum_ +2. _Starknet_ (**experimental**) + +If configured to _Ethereum_ messaging, Katana will listen/send messages on an Ethereum chain. This type of messaging behaves similar to the canonical Starknet sequencer with the exception that messages from L2 -> L1 will be sent directly to the settlement chain for consumption, instead of having to wait for the corresponding blocks of the messages to be proven on the settlement chain (which in reality would be a very time consuming process). + +The _Starknet_ messaging, however, is an experimental feature that allows Katana to listen/send messages on a Starknet chain. It attempts to replicate the behaviour of Ethereum messaging but with a Starknet chain as the settlement layer. This is achieved by having Katana listen to the Starknet chain for new blocks and then sending the messages to the settlement chain for consumption. This is an experimental and opinionated feature, and is not recommended for production use. + +```sh +katana --messaging path/to/messaging/config.json +``` + +The messaging config file is a JSON file that contains the following fields: + +```json +{ + /// The type of messaging service to use. Can be either "ethereum" or "starknet". + "chain": "ethereum", + /// The RPC-URL of the settlement chain. + "rpc_url": "http://127.0.0.1:8545", + /// The messaging-contract address on the settlement chain. + "contract_address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + /// The address to use for settling messages. It should be a valid address that + /// can be used to send a transaction on the settlement chain. + "sender_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + /// The private key associated to `sender_address`. + "private_key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + /// The interval, in seconds, at which the messaging service will fetch and settle messages + /// from/to the settlement chain. + "interval": 2, + /// The block on settlement chain from where Katana will start fetching messages. + "from_block": 0 +} +``` + #### Supported Transport Layers Only HTTP connection is supported at the moment. The server listens on port 5050 by default, but it can be changed by running the following command: @@ -72,9 +121,7 @@ Katana supports version **v0.3.0** of the Starknet JSON-RPC specifications. The - `starknet_getStorageAt` - `starknet_getClassHashAt` - `starknet_getClass` -- `starknet_getClassAt` - -- `starknet_syncing` +- **`starknet_getClassAt`** - `starknet_addInvokeTransaction` - `starknet_addDeclareTransaction` @@ -112,7 +159,7 @@ Set an exact value of a contract's storage slot. `--no-mining`      Disable auto and interval mining, and mine on demand instead. -`-b, --block-time ` +`-b, --block-time `      Block time in milliseconds for interval mining. `--dump-state ` @@ -122,6 +169,18 @@ Set an exact value of a contract's storage slot. `--load-state `      Initialize the chain from a previously saved state snapshot. +`--rpc-url ` +     The Starknet RPC provider to fork the network from. + +`--json-log` +     Output logs in JSON format. + +`--fork-block-number ` +     Fork the network at a specific block. + +`--messaging ` +     Configure the messaging service to allow Katana to listen/send messages on a settlement chain that can be either Ethereum or another Starknet sequencer (experimental). + `-h, --help`      Print help (see a summary with '-h').