> For the complete documentation index, see [llms.txt](https://whitepaper.kindredlabs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.kindredlabs.ai/agentic-kindred-protocol-on-blockchain/core-infrastructure/agent-genesis-contract.md).

# Agent Genesis Contract

The **Agent Genesis Contract** is a foundational smart contract in the **Agentic Kindred Protocol**, enabling the creation, registration, and initialization of agents within the blockchain ecosystem. With the integration of **KIN tokens**, it introduces a token-based gating mechanism, ensuring that the deployment of agents contributes to the protocol’s sustainability and tokenomics. Designed with modularity and scalability, it interacts seamlessly with other protocol components like the **Kindred DAO**, **AS-DAOs**, **ICV**, and **IAO Bonding Curve** to ensure secure and transparent agent creation and governance.

***

#### **Core Responsibilities**

**1. Agent Creation**

* Mints a unique NFT as the on-chain representation of the agent.
* Deploys a custom ERC-20 token associated with the agent’s economy.
* Enforces a fixed amount of **KIN tokens** (e.g., **10,000 KIN**) as a prerequisite for agent creation.
* Initializes the agent’s metadata, tokenomics, and linked contributions.
* Creates and links an **AS-DAO** for decentralized governance.

**2. Integration with the Ecosystem**

* Links to the **ICV** for accessing datasets, models, and other contributions.
* Sets up bonding curves to bootstrap liquidity and token price discovery.
* Registers the agent in the ecosystem, making it accessible to users and contributors.

**3. Governance Compliance**

* Enforces approval workflows through the **Kindred DAO** for proposal validation.
* Transfers governance responsibilities to the agent’s AS-DAO after initialization.
* Ensures treasury-backed operations for liquidity provisioning and reward distribution.

***

#### **Technical Architecture**

**1. Contract Structure**

The **Agent Genesis Contract** is composed of modular components designed for distinct functionalities, enabling scalability and interoperability across multiple agents.

***

**2. Key Functions**

**A. Agent Creation**

Creates a new agent by minting its NFT, deploying its token, and initializing its AS-DAO.

```solidity
solidityCopy codefunction createAgent(
    string memory name,
    string memory description,
    address contributionReference,
    uint256 initialSupply
) public returns (uint256, address) {
    uint256 requiredKIN = 10000 * 1e18; // Fixed amount of KIN tokens required
    require(kinToken.balanceOf(msg.sender) >= requiredKIN, "Insufficient KIN tokens");

    // Transfer KIN tokens to treasury
    kinToken.transferFrom(msg.sender, treasuryAddress, requiredKIN);

    // Mint Agent NFT
    uint256 agentId = _mintAgentNFT(name, description);

    // Deploy ERC-20 Token
    address tokenAddress = _deployToken(agentId, initialSupply);

    // Initialize AS-DAO
    address asDaoAddress = _initializeAgentSpecificDAO(agentId);

    // Register Agent in Ecosystem
    _registerAgent(agentId, tokenAddress, contributionReference, asDaoAddress);

    return (agentId, asDaoAddress);
}
```

**Inputs**:

* `name`: The unique name of the agent.
* `description`: Metadata describing the agent’s purpose and characteristics.
* `contributionReference`: Address referencing contributions stored in the **ICV**.
* `initialSupply`: Total supply of the agent’s ERC-20 token.

**Outputs**:

* `Agent ID`: A unique identifier for the created agent.
* `AS-DAO Address`: Address of the deployed Agent-Specific DAO.

***

**B. Bonding Curve Initialization**

Sets up a bonding curve for the agent’s ERC-20 token to manage liquidity and pricing.

```solidity
solidityCopy codefunction initializeBondingCurve(
    uint256 agentId,
    uint256 initialLiquidity,
    uint256 curveParameters
) public onlyDAO {
    // Set up bonding curve for token
    _setupBondingCurve(agentId, initialLiquidity, curveParameters);
}
```

**Inputs**:

* `agentId`: Unique identifier of the agent.
* `initialLiquidity`: Amount of liquidity to bootstrap the curve.
* `curveParameters`: Configuration parameters for the bonding curve.

**Outputs**:

* Initialized bonding curve linked to the agent’s ERC-20 token.

***

**C. Agent Registration**

Registers the agent in the ecosystem and links it to its AS-DAO.

```solidity
solidityCopy codefunction registerAgent(
    uint256 agentId,
    address tokenAddress,
    address contributionReference,
    address asDaoAddress
) internal {
    // Add agent details to registry
    agents[agentId] = Agent({
        tokenAddress: tokenAddress,
        contributionReference: contributionReference,
        asDaoAddress: asDaoAddress,
        status: "Active"
    });
}
```

**Inputs**:

* `agentId`: Unique identifier for the agent.
* `tokenAddress`: ERC-20 token contract address.
* `contributionReference`: Address referencing ICV contributions.
* `asDaoAddress`: Address of the agent’s AS-DAO.

***

**3. Data Structures**

Stores metadata, token details, and AS-DAO references for all created agents.

```solidity
solidityCopy codestruct Agent {
    address tokenAddress;
    address contributionReference;
    address asDaoAddress;
    string status;
}

mapping(uint256 => Agent) public agents;
```

***

#### **Integration with Other Components**

**1. Kindred DAO**

* Approves proposals and validates the required KIN token payment for agent creation.
* Delegates governance responsibilities to the AS-DAO after initialization.

**2. AS-DAO**

* Governs the agent’s updates, tokenomics, and treasury.
* Manages agent-specific contributions and community proposals.

**3. ICV**

* Retrieves datasets and models stored in the vault.
* Verifies cryptographic integrity of contributions linked to agents.

**4. IAO Bonding Curve**

* Initializes dynamic pricing and liquidity management for the agent’s ERC-20 token.
* Links liquidity pools to decentralized exchanges like Uniswap.

**5. SAR**

* Deploys the agent for real-time interaction with users.

***

#### **Security Features**

* **Access Control**:
  * Ensures only DAO-approved proposals can invoke agent creation and bonding curve initialization.
  * Protected with `onlyDAO` and `onlyAdmin` modifiers.
* **Reentrancy Protection**:
  * Implements `nonReentrant` guards to prevent exploits during token initialization and bonding curve setup.
* **Immutable Data**:
  * Verifies cryptographic proofs for ICV contributions before deployment.
* **Error Handling**:
  * Reverts transactions for invalid proposals, insufficient DAO votes, or improper metadata.

***

#### **Workflow**

1. **Proposal Submission**:
   * A contributor submits an agent creation proposal to the Kindred DAO.
2. **Governance and Approval**:
   * The Kindred DAO reviews and votes on the proposal.
   * Upon approval, the contributor provides **10,000 KIN** tokens for agent creation.
3. **Agent Initialization**:
   * The contract mints the agent NFT, deploys its token, and initializes its AS-DAO.
4. **Tokenomics Setup**:
   * A bonding curve is initialized for liquidity and pricing.
5. **Agent Deployment**:
   * The registered agent is deployed through the SAR for interaction with users.

***

#### **Conclusion**

The **Agent Genesis Contract** incorporates **KIN tokens** as a fixed prerequisite for initial agent creation, ensuring the economic sustainability of the protocol. This integration balances token utility with accessibility while maintaining the modularity, scalability, and transparency required for decentralized governance and agent deployment.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.kindredlabs.ai/agentic-kindred-protocol-on-blockchain/core-infrastructure/agent-genesis-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
