> For the complete documentation index, see [llms.txt](https://kns-2.gitbook.io/kns-docs-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kns-2.gitbook.io/kns-docs-1/inscriptions/operations/create.md).

# 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);
```
