# How Strike Works

STRIKE is designed to simplify interactions with canisters (smart contracts) on the Internet Computer Protocol (ICP). Here's an overview of how Strike works, including the steps for setting it up, creating actions, and sharing them through platforms like Twitter (X).

### **1. Installing the Chrome Extension**

* The first step for users is to **install the Strike Chrome extension**. This extension is required for users to interact with Strike URLs and the canisters they link to.
* Without the extension, users can only view basic metadata (e.g., images and descriptions), but with the extension installed, they can fully engage with the canister's actions.

### **2. Creating the Actions JSON File**

* Users can **create an `actions.json` file** that defines the actions they want to allow on their canister. The JSON file contains metadata, such as action labels, descriptions, canister IDs, and the actions available (e.g., "Get Owner," "Set Owner").
* Users can write their own actions using the **JSON format** provided in the documentation. These actions are defined as methods that interact with the canister, such as retrieving or updating ownership.
* Once the `actions.json` file is created, it can be **hosted anywhere** (e.g., GitHub, a custom domain, or any publicly accessible location).

### **3. Sharing the JSON Link**

* After creating and hosting the `actions.json` file, users can **share the JSON link on platforms like Twitter (X)**. When they post the Strike URL, the platform will unfurl the link, showing a preview of the canister’s actions and metadata.
* This preview will include clickable actions (e.g., buttons for "Get Owner" or "Set Owner") that other users can interact with, provided they also have the Strike Chrome extension installed.

### **4. Performing Actions**

* **Once users have the Strike extension installed**, they can interact directly with the canister by clicking the action buttons. These actions trigger interactions with the canister based on the JSON file's definitions, allowing for seamless engagement.
* For example, users can **share tokens**, perform **smart contract functions**, or update canister information directly from the platform.


# About STRIKE

Smart Transaction Route Integration Kit

**STRIKE** is a powerful tool that enables users to **share actionable links** with ease, powered by the **Internet Computer Protocol (ICP)**. With **STRIKE**, anyone can interact with **canisters** (smart contracts) directly from social platforms like **Twitter (X)** by sharing a simple link. These links unfurl into interactive **STRIKE Cards** that allow users to perform predefined actions without the need for complex Web3 development or coding.

STRIKE makes it easy to integrate blockchain-based functionality into everyday interactions, such as **placing bets**, **transferring ownership**, or **retrieving information** from smart contracts, all with the click of a button. The **STRIKE Chrome extension** enhances this experience, allowing users to authenticate and securely engage with canisters directly from their browser.

#### Key Features of STRIKE:

* **Actionable Links**: Share links that allow users to take immediate action (e.g., place a bet, manage an asset) via STRIKE **Cards**.
* **Powered by ICP**: STRIKE utilizes the **Internet Computer Protocol** to interact with decentralized applications and smart contracts.
* **Ease of Use**: No need for Web3 coding—users simply share and click to engage with canisters.
* **Interactive STRIKE Cards**: Links unfurl into rich media cards with clickable buttons that perform canister actions.
* **Cross-Platform Integration**: Currently works on **Twitter (X)**, with future support for additional platforms.
* **Secure Authentication**: Uses **Internet Identity** to ensure secure and authenticated interactions.


# Key Components

STRIKE is built on several foundational concepts and components that enable users to interact seamlessly with canisters (smart contracts) on the Internet Computer Protocol (ICP). Below are the key concepts and components that define STRIKE's functionality and the ease of interaction it offers.

### **Canisters (Smart Contracts)**

A **canister** is a special type of smart contract that runs on the **Internet Computer Protocol (ICP)**. Canisters are responsible for managing logic and state in decentralized applications (dApps) on the Internet Computer. Each canister is uniquely identified by a **canister ID**, which is similar to an address for smart contracts on other blockchains (e.g., Ethereum).

In STRIKE:

* **Canister IDs** represent the specific canister with which users will interact.
* Canisters allow users to perform operations like viewing or updating ownership, executing code, and managing data on the blockchain.
* Users interact with canisters through a STRIKE URL, which triggers actions defined in the associated JSON file.

### **Link Unfurling**

**Link unfurling** is one of STRIKE’s core features, allowing users to enter a URL and generate a preview that includes metadata and actionable content. This process enables users to interact with the underlying canister actions directly through the unfurled link.

When a STRIKE URL is shared on platforms like **Twitter (X)**, it unfurls to show:

* **Action buttons** (e.g., "Hello," "Get Owner," "Set Owner") that users can click to interact with the canister.
* **Metadata** such as the title, description, and image associated with the canister and its actions.

This link unfurling mechanism simplifies blockchain interaction, making it more accessible for users by abstracting the complexity of smart contracts into a user-friendly interface.

### **JSON Metadata and Actions**

STRIKE relies on **JSON files** to define the metadata and actions associated with each canister. These JSON files outline the structure of the interaction between the user and the canister. Key components of the JSON file include:

* **Icon**: The image displayed in the unfurled URL preview.
* **Label**: A short label that represents the action (e.g., “Simple ownership”).
* **Title**: The title of the canister or action.
* **Description**: A brief description of the canister’s purpose or the action.
* **Canister ID**: The unique identifier for the canister with which the user is interacting.
* **Links**: Defines the actions and their respective endpoints

JSON files are hosted online and referenced when a user interacts with a STRIKE URL. They define the entire user experience and interaction workflow with the canister.

### STRIKE **Chrome Extension**

The **STRIKE Chrome extension** is essential for users to fully interact with the canisters and perform actions. Without this extension, only the metadata (e.g., image, title, and description) will be displayed when the URL is unfurled, but no actions can be performed.

Key functions of the STRIKE Chrome extension:

* **Enabling Interactions**: Users can perform predefined actions (e.g., setting ownership or triggering canister functions) once the extension is installed.
* **Authentication with Internet Identity**: The extension securely authenticates users using **Internet Identity**, the native authentication system for the Internet Computer. Once authenticated, users can execute the available actions.
* **Platform Integration**: The extension renders actions directly on the platform (e.g., Twitter) where the Strike URL is shared, making interactions seamless and native to the user’s environment.

### **Internet Identity Authentication**

Strike uses **Internet Identity** to securely authenticate users before they interact with canisters. Internet Identity is a decentralized identity solution that ensures only authorized users can perform actions, such as updating ownership or executing canister functions.

Users authenticate via Internet Identity when interacting with a Strike URL that contains actions requiring verification (e.g., "Set Owner"). The authentication ensures the user’s identity is securely linked to their actions.


# Privacy Policy

### Introduction

Oranj Base Pvt. Ltd. ("Company", "we", "us", or "our") respects your privacy and is committed to protecting it through compliance with this policy. This policy describes:

* The types of information we may collect from you or that you may provide when you use our Strikes application or related services.
* Our practices for collecting, using, maintaining, protecting, and disclosing that information.

This policy applies to information collected:

* Through our Strikes application and related services.
* In email, text, and other electronic communications between you and Strikes.
* Through any APIs, developer tools, or decentralized protocols ("Services") developed by the Company.

### Individuals Under the Age of 18

Our services are not intended for children under 18. We do not knowingly collect personal information from anyone under 18. If you believe we have collected information from a child under 18, please contact us at <hello@oranj.co.in>.

### Information We Collect

We collect information:

* By which you may be personally identified, such as name, email address, wallet address, and other personal information.
* About your device, internet connection, and usage details.
* Automatically as you navigate through our application using technologies like cookies or similar tracking technologies.

### How We Use Your Information

We use your information to:

* Provide, operate, and improve our Strikes application and services.
* Process transactions and send notices about your transactions.
* Communicate with you regarding your account or inquiries.
* Fulfill any purpose for which you provide information.
* Analyze usage patterns and improve user experience.

### Disclosure of Your Information

We may disclose information:

* To our subsidiaries, affiliates, contractors, and third-party service providers.
* To comply with legal obligations, enforce our terms of service, or respond to legal requests.
* In the event of a merger, acquisition, or sale of all or a portion of our assets.

### Data Security

We implement measures designed to protect your personal information. However, the transmission of data over the internet is not completely secure, and we cannot guarantee its absolute security.

### Your Rights and Choices

Depending on your location, you may have certain rights regarding your personal information, including:

* The right to access and receive a copy of your personal information.
* The right to correct or update your personal information.
* The right to request deletion of your personal information.
* The right to object to or restrict certain processing of your information.

To exercise these rights, please contact us using the information provided in the "Contact Information" section.

### Changes to Our Privacy Policy

We may update this policy periodically. The date of the last revision will be noted at the top of this page. Continued use of our services after changes means acceptance of the updated policy.

### Contact Information

To ask questions or comment about this policy, contact us at: <hello@oranj.co><br>


# Installation and Setup

**STRIKE** makes it easy for users to share actionable links that allow interactions with **canisters** on the **Internet Computer Protocol (ICP)**. Through **STRIKE Cards**, users can share custom links that perform canister actions, like placing bets, directly on social media platforms like **Twitter (X)**.

### **Downloading the** STRIKE **Chrome Extension**

Users need to install the STRIKE Chrome extension from the official STRIKE website to interact with STRIKE Cards and execute canister actions.

* Go to the official **STRIKE website** at [strike.oranj.co](https://strike.oranj.co/)
* Click on the **download link** to get the STRIKE Chrome extension.
* Open the downloaded file in Chrome and follow the prompts to install it.
* Ensure that the extension is active in your Chrome browser.
* Once installed, the STRIKE Chrome extension icon will appear in your Chrome toolbar.

### **Creating and Hosting the `actions.json` File**

STRIKE enables users to create and host custom **`actions.json` files** that define canister actions. These files allow users to specify actions like placing bets, transferring ownership, or interacting with other blockchain-related operations.

**Steps for Setting Up the `actions.json` File:**

* Write your **`actions.json` file** to define the actions users can take. For example, in the context of **BetBTC**, the actions might involve placing bets on political outcomes or sports events.
* Host the file on a public server such as **GitHub Pages** or **Google Drive**. Ensure that it is accessible via a URL.

**Example JSON File**:

```json
  "icon": "https://your-icon-url.png",
  "label": "Bet on President",
  "title": "Who will become the next President?",
  "description": "Place your bets using BetBTC through STRIKE",
  "canisterId": "your-canister-id",
  "links": {
    "actions": [
      {
        "label": "Click Here to Bet",
        "href": "/betAction.json"
      }
    ]
```

### **Sharing and Using** STRIKE **Cards for BetBTC**

**STRIKE Cards** share interactive links that allow users to perform actions like placing bets or executing smart contract functions. When shared on social media platforms such as Twitter, STRIKE Cards unfurl and display a visual preview with clickable action buttons.

In the case of **BetBTC**, users can place bets directly through the STRIKE Card.


# Actions

The **JSON file** used in STRIKE is a key component for defining actions and interactions with canisters on the Internet Computer. This JSON file contains metadata that defines the structure, appearance, and functionality of the STRIKE component when a user interacts with a canister via a shared URL (such as through Twitter). &#x20;

Below is a detailed breakdown of the JSON format, followed by an explanation of the image provided.

<figure><img src="https://3132120113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpW8tWJ9lnxDDF8Fs2C3%2Fuploads%2F2kBGvjsB35YxEtTlRnJ4%2FScreenshot%202025-02-17%20043529.png?alt=media&amp;token=249503d6-fefb-453c-956d-646315edf989" alt=""><figcaption><p>Actions</p></figcaption></figure>

### **JSON File Structure**

```json
json{
  "icon": "https://strike.oranj.co/hello-strike.png",
  "homepage": "https://strike.oranj.co",
  "label": "Simple Ownership",
  "title": "Simple Ownership",
  "description": "Demo canister integration with STRIKE",
  "canisterId": "ea6rm-nyaaa-aaaak-ak2wa-cai",
  "actions": [
    {
      "label": "Hello",
      "method": "hello",
      "type": "query",
      "input": [],
      "output": ["Text"],
      "inputParameters": [],
      "uiParameters": [],
    },
    {
      "label": "Get owner",
      "method": "get_owner",
      "type": "query",
      "input": [],
      "output": ["Principal"],
      "inputParameters": [],
      "uiParameters": [],
    },
    {
      "label": "Set owner",
      "method": "set_owner",
      "type": "update",
      "input": ["Principal"], 
      "output": [], 
      "uiParameters": [
        {
          "name": "owner",
          "label": "Enter a new owner",
          "candidType": "Principal"
        }
      ],
      "inputParameters": ["{owner}"],
    }
  ]
}
```

#### **1. Icon**

* **Field**: `"icon"`
* **Value**: URL of the image that will be displayed in the STRIKE interface as an icon.
* **Example**: `"https://ucarecdn.com/e75cce91-c367-4f74-9ffe-2b6d63398ce1/-/preview/880x864/-/quality/smart/-/format/auto/"`
* **Purpose**: This image will be displayed at the top of the interface. It’s used as a visual representation of the canister or the action.

### **2. Label**

* **Field**: `"label"`
* **Value**: Text that appears below the icon to give a short, identifying name to the action or canister.
* **Example**: `"Simple ownership"`
* **Purpose**: This label is used to indicate the type of action or function that the canister represents.

### **3. Title**

* **Field**: `"title"`
* **Value**: A brief title that gives more information about the purpose of the action.
* **Example**: `"Simple ownership"`
* **Purpose**: The title is used as a headline to summarize the action or canister's functionality.

### **4. Description**

* **Field**: `"description"`
* **Value**: A description that explains the action or purpose of the canister in more detail.
* **Example**: `"Demo canister integration with STRIKE"`
* **Purpose**: This description gives context to the user about the canister and the specific interactions they can perform.

### **5. Canister ID**

* **Field**: `"canisterId"`
* **Value**: A unique identifier for the canister that the JSON file is interacting with. This ID is similar to a smart contract address.
* **Example**: `"ea6rm-nyaaa-aaaak-ak2wa-cai"`
* **Purpose**: The canister ID links the user’s interaction to a specific canister on the Internet Computer, ensuring they are working with the correct contract.

### **6. Links (Actions)**

* **Field**: `"actions"`
* **Value**: A set of actions that users can perform with the canister.
* **Example**:

  ```json
  json{
    "actions": [
      {
        "label": "Hello",
        "method": "hello",
        "type": "query",
        "input": [],
        "output": ["Text"],
        "inputParameters": [],
        "uiParameters": [],
      },
      {
        "label": "Get owner",
        "method": "get_owner",
        "type": "query",
        "input": [],
        "output": ["Principal"],
        "inputParameters": [],
        "uiParameters": [],
      },
      {
        "label": "Set owner",
        "method": "set_owner",
        "type": "update",
        "input": ["Principal"], 
        "output": [], 
        "uiParameters": [
          {
            "name": "owner",
            "label": "Enter a new owner",
            "candidType": "Principal"
          }
        ],
        "inputParameters": ["{owner}"],
      }
    ]
  }
  ```

  * **Label**: A short name for the action (e.g., "Hello," "Get Owner," "Set Owner").
  * **Method:** A method to do update call(e.g., "hello", "get\_owner", "set\_owner").
  * **Type:** The types of calls to interact with a canister's methods(e.g., "query", "update").
  * **Input:** The data type of input parameter.
  * **Output:** The data type of output parameter.
  * **Ui Parameters:** A Input parameters being rendered to the user.
  * **Input Parameters:** (for actions like "Set Owner"): Any input required for the action (e.g., a new owner in the "Set Owner" function).
* **Purpose**: This defines the available actions for the user, providing the necessary paths and input fields for interacting with the canister.


# Developer Guide

### **Introduction**&#x20;

STRIKE is designed to streamline interactions with canisters (smart contracts) on the Internet Computer Protocol (ICP).&#x20;

This guide provides an overview of how STRIKE operates, including setup instructions, action creation, and sharing through platforms like Twitter (X).

To interact with STRIKE URLs and the canisters they reference, you must install the STRIKE Chrome extension.

### **Getting Started with a Simple Example**

Let's begin with a fundamental example: a "Hello" backend on the Internet Computer.

```
use candid::Principal;
use ic_cdk::{query, update};
use std::cell::RefCell;

struct State {
    owner: Principal,
}

impl Default for State {
    fn default() -> Self {
        Self {
            owner: Principal::anonymous(),
        }
    }
}

thread_local! {
    static STATE: RefCell<State> = RefCell::new(State::default());
}

#[query]
fn hello() -> String {
    let caller = ic_cdk::caller();
    format!("Hello, {}!", caller)
}

#[update]
fn set_owner(owner: Principal) -> String {
    STATE.with(|s| s.borrow_mut().owner = owner);
    format!("Owner is {}!", owner)
}

#[query]
fn get_owner() -> Principal {
    STATE.with(|s| s.borrow().owner)
}

ic_cdk::export_candid!();
```

This canister implementation includes three functions: `hello`, `set_owner`, and `get_owner`.&#x20;

We will now proceed with implementing these functions.

### **Creating the Actions JSON File**&#x20;

To enable interactions with the canister, we need to create an `actions.json` file that defines the permitted actions.&#x20;

This JSON file includes metadata such as action labels, descriptions, canister IDs, and the available actions (`"Hello"`, `"Get Owner"`, and `"Set Owner"`).

Create a new file named `actions.json` and add the following configuration:

```
{
  "icon": "https://strike.oranj.co/hello-strike.png",
  "homepage": "https://strike.oranj.co",
  "label": "Simple Ownership",
  "title": "Simple Ownership",
  "description": "Demo canister integration with STRIKE",
  "canisterId": "ea6rm-nyaaa-aaaak-ak2wa-cai"
}
```

* **`icon`**: A URL linking to the image that will be displayed at the top of the interface.
* **`homepage`**: A string that represents the canister’s homepage.
* **`canisterId`**: The identifier of the canister.

For further details on these values, refer to the [Actions ](/installation-and-development/actions)page.

### **Implementing the Functions for Interaction**&#x20;

Next, we need to define the available actions in the JSON file.&#x20;

Append the following script to `actions.json`:

```
{
  ...
  "actions": [
    {
      "label": "Hello",
      "method": "hello",
      "type": "query",
      "uiParameters": [],
      "input": [],
      "inputParameters": [],
      "output": ["Text"]
    },
    {
      "label": "Get Owner",
      "method": "get_owner",
      "type": "query",
      "uiParameters": [],
      "input": [],
      "inputParameters": [],
      "output": ["Principal"]
    },
    {
      "label": "Set Owner",
      "method": "set_owner",
      "type": "update",
      "uiParameters": [
        {
          "name": "owner",
          "label": "Enter a new owner",
          "candidType": "Principal"
        }
      ],
      "input": ["Principal"],
      "inputParameters": ["{owner}"],
      "output": []
    }
  ]
}
```

This configuration defines three actions:

* **`Hello`**: A query method that returns a greeting message.
* **`Get Owner`**: A query method that retrieves the current canister owner.
* **`Set Owner`**: An update method that allows modifying the canister owner.

By setting up these actions, we enable seamless interaction with the canister through STRIKE.

### **Hosting and Deployment**&#x20;

Once the `actions.json` file is created, it can be hosted on any public platform (e.g., GitHub, a custom domain, or any publicly accessible location).&#x20;

Deploy the code and use the generated link to test it on [strike.oranj.co](https://strike.oranj.co/).

<figure><img src="https://3132120113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpW8tWJ9lnxDDF8Fs2C3%2Fuploads%2F2kBGvjsB35YxEtTlRnJ4%2FScreenshot%202025-02-17%20043529.png?alt=media&amp;token=249503d6-fefb-453c-956d-646315edf989" alt=""><figcaption></figcaption></figure>

### **R**egistering on the STRIKE registry

&#x20;To enable STRIKE card unfurling on Twitter/X, you must register it in the STRIKE registry. Once your STRIKE card is ready, you can fill out [**this form**](https://forms.gle/XLYKtsLABGmzo7Ne8) for registration.

<figure><img src="https://3132120113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpW8tWJ9lnxDDF8Fs2C3%2Fuploads%2FINzpvY04OxvkUVJx4Orq%2Fimage.png?alt=media&amp;token=aecb5369-c617-40c1-93ec-7b7458c920ef" alt=""><figcaption></figcaption></figure>

### **Conclusion**

&#x20;In this guide, we explored the fundamentals of STRIKE, canister integration, and strike card routing. We also demonstrated a simple ownership model using STRIKE Actions.


