> ## Documentation Index
> Fetch the complete documentation index at: https://core.anylayer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Protocol Registry Integration

> Complete integration guide for the Protocol Registry contract

## Overview

This guide provides comprehensive examples for integrating with the ZKScore Protocol Registry. It covers protocol registration, data provider management, and cross-protocol coordination.

<Tip>
  Register your protocol to contribute to the ZKScore ecosystem and enable your users to build reputation through your platform.
</Tip>

## Integration Class

<CodeGroup>
  ```javascript JavaScript theme={null}
  class ProtocolRegistryIntegration {
    constructor(provider, registryAddress, abi) {
      this.provider = provider;
      this.contract = new ethers.Contract(registryAddress, abi, provider);
      this.contractWithSigner = null;
    }
    
    setSigner(signer) {
      this.contractWithSigner = this.contract.connect(signer);
    }
    
    async registerProtocol(name, description, type, dataProvider, weight) {
      if (!this.contractWithSigner) throw new Error('Signer not set');
      
      const metadata = ethers.utils.defaultAbiCoder.encode(
        ['string', 'string'],
        ['https://protocol.com', 'v1.0.0']
      );
      
      const tx = await this.contractWithSigner.registerProtocol(
        name, description, type, dataProvider, weight, metadata
      );
      
      const receipt = await tx.wait();
      const event = receipt.events.find(e => e.event === 'ProtocolRegistered');
      
      return {
        success: true,
        protocolId: event.args.protocolId.toString(),
        transactionHash: receipt.transactionHash
      };
    }
    
    async getProtocol(protocolId) {
      const protocol = await this.contract.getProtocol(protocolId);
      return { success: true, protocol };
    }
  }
  ```

  ```python Python theme={null}
  class ProtocolRegistryIntegration:
      def __init__(self, w3, registry_address, abi):
          self.w3 = w3
          self.contract = w3.eth.contract(address=registry_address, abi=abi)
          self.account = None
      
      def set_account(self, private_key):
          self.account = self.w3.eth.account.from_key(private_key)
      
      def register_protocol(self, name, description, protocol_type, data_provider, weight):
          if not self.account:
              raise ValueError('Account not set')
          
          from eth_abi import encode
          metadata = encode(['string', 'string'], ['https://protocol.com', 'v1.0.0'])
          
          tx = self.contract.functions.registerProtocol(
              name, description, protocol_type, data_provider, weight, metadata
          ).buildTransaction({
              'from': self.account.address,
              'gas': 200000,
              'gasPrice': self.w3.eth.gas_price,
              'nonce': self.w3.eth.get_transaction_count(self.account.address)
          })
          
          signed_tx = self.w3.eth.account.sign_transaction(tx, self.account.key)
          tx_hash = self.w3.eth.send_raw_transaction(signed_tx.rawTransaction)
          receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
          
          event = self.contract.events.ProtocolRegistered().processReceipt(receipt)[0]
          
          return {
              'success': True,
              'protocolId': str(event['args']['protocolId']),
              'transactionHash': receipt.transactionHash.hex()
          }
  ```
</CodeGroup>

## Best Practices

1. **Accurate Information**: Provide complete protocol details
2. **Fair Weighting**: Request appropriate score weights
3. **Monitor Events**: Track protocol ecosystem
4. **Update Regularly**: Keep protocol information current

## Related Documentation

* [Contract Overview](/contracts/protocol-registry/overview) - Contract architecture
* [Functions Reference](/contracts/protocol-registry/functions) - Function documentation
* [Events Reference](/contracts/protocol-registry/events) - Event documentation
