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

# Dispute

> Dispute allows you to manage disputes within Story.

## Dispute

### Methods

* raise\_dispute
* cancel\_dispute
* resolve\_dispute
* tag\_if\_related\_ip\_infringed
* dispute\_assertion
* dispute\_id\_to\_assertion\_id

### raise\_dispute

Raises a dispute on a given ipId

| Method          |
| --------------- |
| `raise_dispute` |

Parameters:

* `target_ip_id`: The IP ID that is the target of the dispute.
* `target_tag`: The target tag of the dispute. See [dispute tags](https://docs.story.foundation/docs/dispute-module#dispute-tags). **Example: "IMPROPER\_REGISTRATION"**
* `cid`: Content Identifier (CID) for the dispute evidence. This should be obtained by uploading your dispute evidence (documents, images, etc.) to IPFS. **Example: "QmX4zdp8VpzqvtKuEqMo6gfZPdoUx9TeHXCgzKLcFfSUbk"**
* `liveness`: The liveness is the time window (in seconds) in which a counter dispute can be presented (30days).
* `bond`: The amount of wrapper IP that the dispute initiator pays upfront into a pool. To counter that dispute the opposite party of the dispute has to place a bond of the same amount. The winner of the dispute gets the original bond back + 50% of the other party bond. The remaining 50% of the loser party bond goes to the reviewer.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  from web3 import Web3

  response = story_client.Dispute.raise_dispute(
      target_ip_id="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
      # NOTE: you must use your own CID here, because every time it is used,
      # the protocol does not allow you to use it again
      cid="QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR",
      # you must pick from one of the whitelisted tags here:
      # https://docs.story.foundation/docs/dispute-module#dispute-tags
      target_tag="IMPROPER_REGISTRATION",
      bond=Web3.to_wei(0.1, 'ether'),  # minimum of 0.1
      liveness=2592000,
      tx_options={"wait_for_transaction": True}
  )
  print(f"Dispute raised at transaction hash {response['tx_hash']}, Dispute ID: {response['dispute_id']}")
  ```

  ```python Request Parameters theme={null}
  target_ip_id: str  # The IP ID that is the target of the dispute
  target_tag: str  # The target tag of the dispute
  cid: str  # Content Identifier for the dispute evidence
  liveness: int  # Time window in seconds for counter disputes
  bond: int  # Amount of wrapper IP for the dispute bond
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str,  # The transaction hash
    "dispute_id": int  # The ID of the raised dispute
  }
  ```
</CodeGroup>

### cancel\_dispute

Cancels an ongoing dispute

| Method           |
| ---------------- |
| `cancel_dispute` |

Parameters:

* `dispute_id`: The ID of the dispute to be cancelled.
* `data`: \[Optional] Additional data used in the cancellation process. **Defaults to "0x"**.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.Dispute.cancel_dispute(
      dispute_id=1,
      tx_options={"wait_for_transaction": True}
  )
  print(f"Dispute cancelled at transaction hash {response['tx_hash']}")
  ```

  ```python Request Parameters theme={null}
  dispute_id: int  # The ID of the dispute to be cancelled
  data: str = "0x"  # Optional: Additional data for cancellation
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

### resolve\_dispute

Resolves a dispute after it has been judged

| Method            |
| ----------------- |
| `resolve_dispute` |

Parameters:

* `dispute_id`: The ID of the dispute to be resolved.
* `data`: The data to resolve the dispute.
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.Dispute.resolve_dispute(
      dispute_id=1,
      data="0x",
      tx_options={"wait_for_transaction": True}
  )
  print(f"Dispute resolved at transaction hash {response}")
  ```

  ```python Request Parameters theme={null}
  dispute_id: int  # The ID of the dispute to be resolved
  data: str # Additional data for resolution
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str  # The transaction hash
  }
  ```
</CodeGroup>

### tag\_if\_related\_ip\_infringed

Tags a derivative if a parent has been tagged with an infringement tag or a group ip if a group member has been tagged with an infringement tag.

| Method                        |
| ----------------------------- |
| `tag_if_related_ip_infringed` |

Parameters:

* `infringement_tags`: An array of tags relating to the dispute
  * `infringement_tags[]['ip_id']`: The `ip_id` to tag
  * `infringement_tags[]['dispute_id']`: The dispute id that tagged the related infringing parent IP
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  response = story_client.Dispute.tag_if_related_ip_infringed(
    infringement_tags=[
      {
        "ip_id": "0xa1BaAA464716eC76A285Ef873d27f97645fE0366",
        "dispute_id": 1
      }
    ],
    tx_options={"wait_for_transaction": True}
  )
  print(f"Tagged related IP at transaction hash {response[0]}")
  ```

  ```python Request Parameters theme={null}
  infringement_tags: list  # List of dictionaries containing ip_id and dispute_id
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  [str]  # An array of transaction hashes
  ```
</CodeGroup>

### dispute\_assertion

Counters a dispute that was raised by another party on an IP using counter evidence.

This method can only be called by the IP's owner to counter a dispute by providing counter evidence. The counter evidence (e.g., documents, images) should be uploaded to IPFS, and its corresponding CID is converted to a hash for the request.

The liveness period is split in two parts:

* the first part of the liveness period in which only the IP's owner can be called the method.
* a second part in which any address can be called the method.

If you only have a `dispute_id`, call `dispute_id_to_assertion_id` to get the `assertion_id` needed here.

<Warning>
  You will need \$WIP that the IP owner will have to deposit themselves using the
  `deposit` function in the [WIP Client](/sdk-reference/python/wipclient).
</Warning>

| Method              |
| ------------------- |
| `dispute_assertion` |

Parameters:

* `ip_id`: The IP ID that is the target of the dispute.
* `assertion_id`: The identifier of the assertion that was disputed. You can get this from the `dispute_id` by calling `Dispute.dispute_id_to_assertion_id`.
* `counter_evidence_cid`: Content Identifier (CID) for the counter evidence. This should be obtained by uploading your dispute evidence (documents, images, etc.) to IPFS. **Example: "QmX4zdp8VpzqvtKuEqMo6gfZPdoUx9TeHXCgzKLcFfSUbk"**
* `tx_options`: \[Optional] Transaction options dictionary.

<CodeGroup>
  ```python Python theme={null}
  # First get the assertion_id from the dispute_id
  assertion_id = story_client.Dispute.dispute_id_to_assertion_id(1)

  # Then dispute the assertion
  response = story_client.Dispute.dispute_assertion(
    ip_id="0xa1BaAA464716eC76A285Ef873d27f97645fE0366",
    assertion_id=assertion_id,
    counter_evidence_cid="QmX4zdp8VpzqvtKuEqMo6gfZPdoUx9TeHXCgzKLcFfSUbk"
  )
  ```

  ```python Request Parameters theme={null}
  ip_id: str  # The IP ID that is the target of the dispute
  assertion_id: str  # The identifier of the assertion that was disputed
  counter_evidence_cid: str  # Content Identifier (CID) for the counter evidence
  tx_options: dict = None  # Optional: Transaction options
  ```

  ```python Response theme={null}
  {
    "tx_hash": str,  # The transaction hash
    "receipt": str # tx receipt
  }
  ```
</CodeGroup>

### dispute\_id\_to\_assertion\_id

Maps a dispute ID to an assertion ID.

| Method                       |
| ---------------------------- |
| `dispute_id_to_assertion_id` |

Parameters:

* `dispute_id`: The dispute ID to convert to an assertion ID.

<CodeGroup>
  ```python Python theme={null}
  assertion_id = story_client.Dispute.dispute_id_to_assertion_id(1)
  ```

  ```python Request Parameters theme={null}
  dispute_id: int  # The dispute ID to convert
  ```

  ```python Response theme={null}
  str  # The assertion ID as a hex string
  ```
</CodeGroup>
