> For the complete documentation index, see [llms.txt](https://docs.agentipy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentipy.fun/tools/use-light-protocol.md).

# Use Light Protocol

The `Use Light Protocol` tool, part of AgentiPy, allows users to interact with Light Protocol on Solana, focusing on sending compressed airdrops. Light Protocol is known for its solutions enabling private and cost-efficient transactions, including shielded transfers and compressed NFTs/tokens. This tool appears to use an Agentipy proxy service for its operations.

## Functionality

This tool is implemented in the `LightProtocolManager` class. It interacts with an Agentipy proxy service (`agent.base_proxy_url`) to perform actions related to Light Protocol. The agent's private key is encrypted and sent to this proxy, and an OpenAI API key (`agent.openai_api_key`) also seems to be part of the payload.

### Key Methods:

* `send_compressed_airdrop(agent: SolanaAgentKit, mint_address: str, amount: float, decimals: int, recipients: List[str], priority_fee_in_lamports: int, should_log: Optional[bool] = False) -> Optional[Dict[str, Any]]`:
  * Sends a compressed airdrop of an SPL token to multiple `recipients`.
  * Parameters:
    * `agent`: The `SolanaAgentKit` instance.
    * `mint_address`: The mint address of the token to be airdropped.
    * `amount`: The amount of tokens to send to each recipient (in UI units, e.g., 10.5 tokens).
    * `decimals`: The number of decimals for the token.
    * `recipients`: A list of recipient wallet addresses (strings).
    * `priority_fee_in_lamports`: The priority fee to be paid for the transaction(s) in lamports.
    * `should_log`: Optional boolean to indicate if the transaction should be logged by the proxy service.
  * Returns a dictionary containing the transaction signatures (likely one or more if the airdrop is batched) or error details from the proxy.

**Note:** While the class is named `LightProtocolManager`, the provided script only contains the `send_compressed_airdrop` method. Other Light Protocol functionalities like shielding SOL/SPLs, private transfers, or unshielding are not exposed in this particular script.

##

**Important Considerations:**

* **Proxy Service:** This tool relies on an Agentipy proxy service for its operations. The functionality is dependent on this proxy's correct implementation and interaction with Light Protocol.
* **On-Chain Action:** Sending an airdrop is an on-chain action that will transfer tokens from the sender's (agent's) wallet and incur SOL transaction fees.
* **Compressed Airdrops:** This specific function is for "compressed" airdrops, which usually means it's optimized for sending tokens to many recipients efficiently, possibly using Light Protocol's specific mechanisms for compression or privacy.
* **Token Ownership & Fees:** The agent's wallet must own a sufficient amount of the specified SPL token for the airdrop and enough SOL to cover transaction fees, including any priority fees.
* **API Keys:** The use of `agent.openai_api_key` in the payload to the proxy suggests it might be used for some purpose by the proxy service.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_lightprotocol.py>
