kaushik-himself / pathfinder

A Starknet full node written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to Pathfinder

A StarkNet full node written in Rust.

This project is a work-in-progress and is not yet usable.

A first release will be made with the completion of Milestone I.

Table of Contents

Roadmap

The end goal is to have a node which

  • holds the full StarkNet state
  • synchronises StarkNet state from both L1 and L2 (p2p)
  • verifies L2 state against L1
  • provides an RPC API for interacting with StarkNet state
  • participates in the L2 StarkNet network
    • propagating state
    • propagating transactions

The roadmap has been split into milestones, with goals in the later milestones being less certain and well-defined.

Milestone I

A node which has no p2p capabilities. It synchronises network state using L1 and L2 (StarkNet gateway), and provides an HTTP RPC API.

  • retrieve state updates from L1
    • state root
    • contract deployments
    • contract updates
  • retrieve state from StarkNet sequencer gateway
    • blocks
    • transactions
    • contract code
  • serve RPC API
  • storage
    • global state
    • contract definitions
    • transactions
    • blocks
  • basic user configuration
  • sync state from L1 and L2
  • run starknet_call locally
  • validate contract code against L1
  • integrate various components
  • documentation

Milestone II

Establish p2p network, state is now propagated between nodes.

Add support for syncing completely from L1.

Milestone III

Create a transaction mempool, transactions are now propagated between nodes.

Add contract calls to RPC API: invoke and deploy.

Developers

Note that this project is currently only built on linux; but we do plan on supporting MacOs and Windows in the future.

Getting started

Install Rust, by following the official Rust instructions.

git clone this project and you should be good to go.

Building

Invoke cargo build -p pathfinder from the project root.

Testing

Some of our tests require access to an archive Ethereum node on the Goerli chain. To run these tests you will need to set the following environment variables:

PATHFINDER_ETHEREUM_HTTP_GOERLI_URL       # HTTP(S) endpoint for Goerli chain
PATHFINDER_ETHEREUM_HTTP_GOERLI_PASSWORD  # HTTP(S) password for Goerli chain (optional)

Infura provides such nodes for free (on Goerli testnet), and is what we currently use for our own CI.

In addition, the tests also require access to a non-archive Ethereum node on Mainnet. To run these tests you will need to set the following environment variables:

PATHFINDER_ETHEREUM_HTTP_MAINNET_URL       # HTTP(S) endpoint for Mainnet chain
PATHFINDER_ETHEREUM_HTTP_MAINNET_PASSWORD  # HTTP(S) password for Mainnet chain (optional)

Example with an Infura node:

export PATHFINDER_ETHEREUM_HTTP_GOERLI_URL=https://goerli.infura.io/ws/v3/<project-id>
export PATHFINDER_ETHEREUM_HTTP_MAINNET_URL=https://mainnet.infura.io/ws/v3/<project-id>

Run the tests (invoke from project root):

cargo test

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A Starknet full node written in Rust

License:Other


Languages

Language:Rust 95.5%Language:Python 3.6%Language:Shell 0.8%