# Create

## Text inscriptions

Inscribe general texts and content on Kaspa.

### Typescript example

```ts
const data = "abc";
const buf = Buffer.from(data);
const script = new ScriptBuilder()
  .addData(XOnlyPublicKey.fromAddress(account).toString())
  .addOp(Opcodes.OpCheckSig)
  .addOp(Opcodes.OpFalse)
  .addOp(Opcodes.OpIf)
  .addData(Buffer.from("kns"))
  .addI64(0n)
  .addData(buf)
  .addOp(Opcodes.OpEndIf);
```

## Domain inscriptions

Create domains on Kaspa.

### Standard

Domains follow the same standard as [ENS](https://docs.ens.domains/faq#what-characters-are-supported)

We use the [ENS library](https://www.npmjs.com/package/@adraffy/ens-normalize) to normalize the domain name.

Any characters outside this standard will not be verified.

### Rules

* Price is calculated based on the visual character length of the domain. See [here](#pricing)
  * For example: '🏳️‍🌈' has a visual character length of 1
  * We use [graphemer](https://www.npmjs.com/package/graphemer) to calculate the character length
* Domains are registered in a first-come, first-serve basis
* Fees have to be paid to the KNS receiving address in output 0 of the reveal transaction
  * Testnet 10 payment address: `kaspatest:qq9h47etjv6x8jgcla0ecnp8mgrkfxm70ch3k60es5a50ypsf4h6sak3g0lru`
  * Mainnet: `kaspa:qyp4nvaq3pdq7609z09fvdgwtc9c7rg07fuw5zgeee7xpr085de59eseqfcmynn`
* JSON format

  | key | required | description                                                        |
  | --- | -------- | ------------------------------------------------------------------ |
  | op  | yes      | operation. "create"                                                |
  | v   | yes      | inscription value. length has to be greater than 1.                |
  | p   | yes      | protocol. "domain"                                                 |
  | s   | no       | the top level domain, defaults to kas, currently only supports kas |

### Pricing

* Mainnet (price in kaspa). char indicates character length of the string

  |       | 1 char | 2 char | 3 char | 4 char | 5 char |
  | ----- | ------ | ------ | ------ | ------ | ------ |
  | Price | 4200   | 4200   | 2100   | 525    | 35     |

### Typescript example

This would create a `example.kas` domain

```ts
const data = JSON.stringify(
  { op: "create", p: "domain", v: "example" },
  null,
  0
);
const buf = Buffer.from(data);
const script = new ScriptBuilder()
  .addData(XOnlyPublicKey.fromAddress(account).toString())
  .addOp(Opcodes.OpCheckSig)
  .addOp(Opcodes.OpFalse)
  .addOp(Opcodes.OpIf)
  .addData(Buffer.from("kns"))
  .addI64(0n)
  .addData(buf)
  .addOp(Opcodes.OpEndIf);
```

## Inscriptions of other mimeTypes

* hex string of the file data

### Typescript example

```ts
const mimeType = "image/jpeg";
const data = (file as Buffer).toString("hex");
const script = new ScriptBuilder()
  .addData(XOnlyPublicKey.fromAddress(account).toString())
  .addOp(Opcodes.OpCheckSig)
  .addOp(Opcodes.OpFalse)
  .addOp(Opcodes.OpIf)
  .addData(Buffer.from("kns"))
  .addOp(1)
  .addOp(1)
  .addData(Buffer.from(mimeType))
  .addI64(0n)
  .addData(data)
  .addOp(Opcodes.OpEndIf);
```


---

# Agent Instructions: 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://kns-2.gitbook.io/kns-docs-1/inscriptions/operations/create.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.
