Skip to content

Commit

Permalink
Update katana reference to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy authored Oct 17, 2023
2 parents 855540c + 0c5a24f commit eb0fdd0
Showing 1 changed file with 63 additions and 4 deletions.
67 changes: 63 additions & 4 deletions src/toolchain/katana/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <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:
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -112,7 +159,7 @@ Set an exact value of a contract's storage slot.
`--no-mining`
&nbsp;&nbsp;&nbsp;&nbsp; Disable auto and interval mining, and mine on demand instead.

`-b, --block-time <MILLISECONDS>`
`-b, --block-time <MILLISECONDS>`
&nbsp;&nbsp;&nbsp;&nbsp; Block time in milliseconds for interval mining.

`--dump-state <PATH>`
Expand All @@ -122,6 +169,18 @@ Set an exact value of a contract's storage slot.
`--load-state <PATH>`
&nbsp;&nbsp;&nbsp;&nbsp; Initialize the chain from a previously saved state snapshot.

`--rpc-url <URL>`
&nbsp;&nbsp;&nbsp;&nbsp; The Starknet RPC provider to fork the network from.

`--json-log`
&nbsp;&nbsp;&nbsp;&nbsp; Output logs in JSON format.

`--fork-block-number <BLOCK_NUMBER>`
&nbsp;&nbsp;&nbsp;&nbsp; Fork the network at a specific block.

`--messaging <PATH>`
&nbsp;&nbsp;&nbsp;&nbsp; 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`
&nbsp;&nbsp;&nbsp;&nbsp; Print help (see a summary with '-h').

Expand Down

0 comments on commit eb0fdd0

Please sign in to comment.