To smooth interoperability, often standards require smart contracts to implement introspection mechanisms.

In Ethereum, the EIP165 standard defines how contracts should declare their support for a given interface, and how other contracts may query this support.

Starknet offers a similar mechanism for interface introspection defined by the SRC5 standard.


Similar to its Ethereum counterpart, the SRC5 standard requires contracts to implement the supports_interface function, which can be used by others to query if a given interface is supported:

trait ISRC5 {
    /// Query if a contract implements an interface.
    /// Receives the interface identifier as specified in SRC-5.
    /// Returns `true` if the contract implements `interface_id`, `false` otherwise.
    fn supports_interface(interface_id: felt252) -> bool;

Computing the interface ID

The interface ID, as specified in the standard, is the XOR of all the Extended Function Selectors of the interface. We strongly advise reading the SNIP to understand the specifics of computing these extended function selectors. There are tools such as src5-rs that can help with this process.

Registering interfaces

For a contract to declare its support for a given interface, we recommend using the SRC5 component to register support upon contract deployment through a constructor either directly or indirectly (as an initializer) like this:

mod MyContract {
    use openzeppelin::account::interface;
    use openzeppelin::introspection::src5::SRC5Component;

    component!(path: SRC5Component, storage: src5, event: SRC5Event);

    impl SRC5Impl = SRC5Component::SRC5Impl<ContractState>;
    impl InternalImpl = SRC5Component::InternalImpl<ContractState>;

    struct Storage {
        src5: SRC5Component::Storage

    #[derive(Drop, starknet::Event)]
    enum Event {
        SRC5Event: SRC5Component::Event

    fn constructor(ref self: ContractState) {
        // Register the contract's support for the ISRC6 interface


Querying interfaces

Use the supports_interface function to query a contract’s support for a given interface.

mod MyContract {
    use openzeppelin::account::interface;
    use openzeppelin::introspection::interface::ISRC5DispatcherTrait;
    use openzeppelin::introspection::interface::ISRC5Dispatcher;
    use starknet::ContractAddress;

    struct Storage {}

    fn query_is_account(self: @ContractState, target: ContractAddress) -> bool {
        let dispatcher = ISRC5Dispatcher { contract_address: target };
If you are unsure whether a contract implements SRC5 or not, you can follow the process described in here.