# Welcome to NeoNS Documentation

### What is NeoNS

The Neo Name Service (NeoNS) is a distributed open naming system based on Neo blockchain. The main goal of NeoNS is to map names like `alice.neo` to other source identifiers such as N3 addresses, NeoFS shared link, IPV4 addresses, IPV6 addresses, and other metadata.

NeoNS also has dot-separated hierarchical names called domains. The owner of a domain has full control of all its subdomains.

Top-level domains, like `.neo`, are owned by the Neo Committee. Users can only register domains with the registered top-level domains, such as `alice.neo` instead of `alice.eth` if the top-level domain `.eth` is not registered yet. Once the domain `alice.neo` registered users can register any subdomains ended with it, for example, `hello.alice.neo`, and configure it with records.

### Quick Start

NeoNS Mainnet Contract Hash: 0x50ac1c37690cc2cfc594472833cf57505d5f46de

NeoNS Magnet N3T5 Hash (Recommended): 0x50ac1c37690cc2cfc594472833cf57505d5f46de

The source code can be found \[here]\([non-native-contracts/src/NameService at master · neo-project/non-native-contracts · GitHub](https://github.com/neo-project/non-native-contracts/tree/master/src/NameService)).


# API Reference


# addRoot

Registers the top-level domain, which can be added by the Neo Committee only. You need to input the committee multi-signature address signature to generate a new transaction.

> \[!Note]
>
> Currently only ".neo" is supported.

***

### Parameters

| Name | Type   | Description                | Required |
| ---- | ------ | -------------------------- | -------- |
| root | String | The top-level domain name. | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "addRoot",
                         [{"type":"String","value":"test"}],
    [
      {
        "account": "Nfm8y1ZQMmiMwBQhzYqS9cfu3sX4ESAT5g",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAR0ZXN0EcAfDAdhZGRSb290DBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS",
        "state": "HALT",
        "gasconsumed": "524180",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```


# balanceOf

Gets the number of second-level domain names of the given address.

If the domain has expired, it counts still.

***

### Parameters

| Name  | Type    | Description                      | Required |
| ----- | ------- | -------------------------------- | -------- |
| owner | Address | The address of the domain owner. | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "balanceOf",
                         [
                             {
                                 "type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"
                             }
                         ],
    [
      {
        "account": "NMzaUBM56iumJ8pHfjjCuKsAepKxENkUqN",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBQwGo9RjypKE89yNZP2C3HJZlY8cRHAHwwJYmFsYW5jZU9mDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS",
        "state": "HALT",
        "gasconsumed": "265986",
        "exception": null,
        "stack": [
            {
                "type": "Integer",
                "value": "4"
            }
        ]
    }
}
```


# deleteRecord

Deletes the record of a second-level domain or its subdomains with specific type.

***

### Parameters

| Name | Type    | Description                                                                                                                         | Required |
| ---- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------- |
| name | String  | The second-level domain name, "test.neo"                                                                                            | Required |
| type | Integer | <p>Available types are:<br>1 - IPV4 address record<br>5 - Canonical name record<br>16 - Text record<br>28 - IPV6 address record</p> |          |

### Example

Request body #1

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "deleteRecord",
                         [
                             {
                                 "type":"String","value":"sub1.flamincome.neo"
                             },{"type":"Integer","value":"1"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "EQwTc3ViMS5mbGFtaW5jb21lLm5lbxLAHwwMZGVsZXRlUmVjb3JkDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "1611960",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

Request body #2

Deletes all records of the expired domain:

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "deleteRecord",
                         [
                             {
                                 "type":"String","value":"expired.neo"
                             },{"type":"Integer","value":"1"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAtleHBpcmVkLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "FAULT",
        "gasconsumed": "622077",
        "exception": "An unhandled exception was thrown. The name has expired.",
        "stack": []
    }
}
```


# getAllRecords

Gets all records of the second-level domain and its subdomains.

***

### Parameters

| Name | Type   | Description                                   | Required |
| ---- | ------ | --------------------------------------------- | -------- |
| name | String | The second-level domain name, e.g. "test.neo" | Required |

### Example

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getAllRecords",
						 [
							 {
								 "type":"String","value":"flamincome.neo"
							 }
						 ],
	[]
],
  "id": 1
}
'
```

Response body #1

```json5
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"script": "DA5mbGFtaW5jb21lLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
		"state": "HALT",
		"gasconsumed": "725394",
		"exception": null,
		"stack": [
			{
				"type": "InteropInterface",
				"iterator": [
					{
						"type": "Array",
						"value": [
							{
								"type": "ByteString",
								"value": "c3ViMS5mbGFtaW5jb21lLm5lbw=="
							},
							{
								"type": "Integer",
								"value": "1"
							},
							{
								"type": "ByteString",
								"value": "MTY1LjIzLjM0LjU0"
							}
						]
					},
					{
						"type": "Array",
						"value": [
							{
								"type": "ByteString",
								"value": "ZmxhbWluY29tZS5uZW8="
							},
							{
								"type": "Integer",
								"value": "5"
							},
							{
								"type": "ByteString",
								"value": "YWxpYXMubmVv"
							}
						]
					},
					{
						"type": "Array",
						"value": [
							{
								"type": "ByteString",
								"value": "ZmxhbWluY29tZS5uZW8="
							},
							{
								"type": "Integer",
								"value": "16"
							},
							{
								"type": "ByteString",
								"value": "TlpIZjFOSnZ6MXR2RUxHTFdaamhwYjNOcVpKRkZVWXB4VA=="
							}
						]
					},
					{
						"type": "Array",
						"value": [
							{
								"type": "ByteString",
								"value": "ZmxhbWluY29tZS5uZW8="
							},
							{
								"type": "Integer",
								"value": "28"
							},
							{
								"type": "ByteString",
								"value": "MjAwMToxZGI4OjA6Og=="
							}
						]
					}
				],
				"truncated": false
			}
		]
	}
}
```

Request body #2

Gets all records of the expired domain:

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getAllRecords",
						 [
							 {
								 "type":"String","value":"expired.neo"
							 }
						 ],
	[]
],
  "id": 1
}
'
```

Response body #2

```json5
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"script": "DAtleHBpcmVkLm5lbxHAHwwNZ2V0QWxsUmVjb3JkcwwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
		"state": "FAULT",
		"gasconsumed": "622077",
		"exception": "An unhandled exception was thrown. The name has expired.",
		"stack": []
	}
}
```


# getPrice

Gets the register price for each second-level domain length.

***

### Parameters

| Name   | Type    | Description                    | Required |
| ------ | ------- | ------------------------------ | -------- |
| length | Integer | The second-level domain length | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "method": "invokefunction",
    "params": [
        "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a",
        "getPrice",
        [
            {
                "type": "Integer",
                "value": "3"
            }
        ],
        []
    ],
    "id": 1
}'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "ExHAHwwIZ2V0UHJpY2UMFBqJ1I2J+MGmbT09DvSDLOvOqS8VQWJ9W1I=",
        "state": "HALT",
        "gasconsumed": "375489",
        "exception": null,
        "stack": [
            {
                "type": "Integer",
                "value": "20000000000"
            }
        ]
    }
}
```


# getRecord

Gets the record of a second-level domain or its subdomains with the specific type.

***

### Parameters

| Name | Type   | Description                                                                                                                         | Required |
| ---- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- | -------- |
| name | String | The second-level domain name, e.g. "test.neo", or the subdomain "pay.test.neo"                                                      | Required |
| type | Byte   | <p>Available types are:<br>1 - IPV4 address record<br>5 - Canonical name record<br>16 - Text record<br>28 - IPV6 address record</p> | Required |

### Example

**Example #1 Get the IPV4 address record**

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getRecord",
                         [
                             {
                                 "type":"String","value":"sub1.flamincome.neo"
                             },{"type":"Integer","value":"1"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "EQwTc3ViMS5mbGFtaW5jb21lLm5lbxLAHwwJZ2V0UmVjb3JkDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "1756494",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "MTY1LjIzLjM0LjU0"
            }
        ]
    }
}
```

**Example #2 Get the Canonical name record**

Request body #2

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"5"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "FQwOZmxhbWluY29tZS5uZW8SwB8MCWdldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "1654128",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "YWxpYXMubmVv"
            }
        ]
    }
}
```

**Example #3 Get the Text record**

Request body #3

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"16"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "IAwOZmxhbWluY29tZS5uZW8SwB8MCWdldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "1654128",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "TlFKS1NOZFRnTlgzd25vOVFQWXB3TmhmVVRnNERuRXM2UA=="
            }
        ]
    }
}
```

**Example #4 Get the IPV6 record**

Request body #4

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"28"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #4

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "ABwMDmZsYW1pbmNvbWUubmVvEsAfDAlnZXRSZWNvcmQMFLbLwLkAmZsTjKCyoF2KU3a3VYNTQWJ9W1I=",
        "state": "HALT",
        "gasconsumed": "1654128",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "MjAwMToxZGI4OjA6Og=="
            }
        ]
    }
}
```

**Example #5 Get the record of expired domains**

Request body #5

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "getRecord",
                         [
                             {
                                 "type":"String","value":"expired.neo"
                             },{"type":"Integer","value":"16"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #5

```json5
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"script": "IAwLZXhwaXJlZC5uZW8SwB8MCWdldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
		"state": "FAULT",
		"gasconsumed": "1083138",
		"exception": "An unhandled exception was thrown. The name has expired.",
		"stack": []
	}
}
```


# isAvailable

Check if the second-level domain is available. The expired domain names can be re-registered. If the root does not exist, an error message is thrown.

***

### Parameters

| Name | Type   | Description                              | Required |
| ---- | ------ | ---------------------------------------- | -------- |
| name | String | The second-level domain, e.g. "test.neo" | Required |

### Example

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "isAvailable",
                         [{"type":"String","value":"t5.neo"}]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAZ0NS5uZW8RwB8MC2lzQXZhaWxhYmxlDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS",
        "state": "HALT",
        "gasconsumed": "875181",
        "exception": null,
        "stack": [
            {
                "type": "Boolean",
                "value": false
            }
        ]
    }
}
```

Request body #2

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "isAvailable",
                         [{"type":"String","value":"test.neo"}]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAh0ZXN0Lm5lbxHAHwwLaXNBdmFpbGFibGUMFBqJ1I2J+MGmbT09DvSDLOvOqS8VQWJ9W1I=",
        "state": "HALT",
        "gasconsumed": "1228476",
        "exception": null,
        "stack": [
            {
                "type": "Boolean",
                "value": true
            }
        ]
    }
}
```

Request body #3

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "isAvailable",
                         [{"type":"String","value":"neo.test"}]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAhuZW8udGVzdBHAHwwLaXNBdmFpbGFibGUMFBqJ1I2J+MGmbT09DvSDLOvOqS8VQWJ9W1I=",
        "state": "FAULT",
        "gasconsumed": "629298",
        "exception": "An unhandled exception was thrown. The root does not exist.",
        "stack": []
    }
}
```


# ownerOf

Gets the domain owner. If the domain has expired, an error message is returned instead of the owner.

***

### Parameters

| Name        | Type   | Description                    | Required |
| ----------- | ------ | ------------------------------ | -------- |
| domain name | String | A domain name, e.g. "edge.neo" | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "ownerOf",
                         [
                             {
                                 "type":"ByteArray","value":"ZWRnZS5uZW8="
                             }
                         ],
    [
      {
        "account": "NMzaUBM56iumJ8pHfjjCuKsAepKxENkUqN",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAhlZGdlLm5lbxHAHwwHb3duZXJPZgwUGonUjYn4waZtPT0O9IMs686pLxVBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "589170",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "3f9BbV5KcZwWd8ismxMpFmvXJ+g="
            }
        ]
    }
}
```


# properties

Gets the properties of a domain such as name, expiration, and admin.

***

### Parameters

| Name        | Type   | Description                      | Required |
| ----------- | ------ | -------------------------------- | -------- |
| domain name | String | A domain string, e.g. "edge.neo" | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "properties",
                         [
                             {
                                 "type":"String","value":"edge.neo"
                             }
                         ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAhlZGdlLm5lbxHAHwwKcHJvcGVydGllcwwUGonUjYn4waZtPT0O9IMs686pLxVBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "663480",
        "exception": null,
        "stack": [
            {
                "type": "Map",
                "value": [
                    {
                        "key": {
                            "type": "ByteString",
                            "value": "bmFtZQ=="
                        },
                        "value": {
                            "type": "ByteString",
                            "value": "ZWRnZS5uZW8="
                        }
                    },
                    {
                        "key": {
                            "type": "ByteString",
                            "value": "ZXhwaXJhdGlvbg=="
                        },
                        "value": {
                            "type": "Integer",
                            "value": "1731267713921"
                        }
                    },
                    {
                        "key": {
                            "type": "ByteString",
                            "value": "YWRtaW4="
                        },
                        "value": {
                            "type": "Any"
                        }
                    }
                ]
            }
        ]
    }
}
```

If the domain has expired, an error message is returned instead of the properties.

The expiration is set in milliseconds. If no admin is set, a null is returned.


# register

Registers a second-level domain. It requires the owner's signature. By default it registers a domain for one year.

***

### Parameters

| Name  | Type    | Description                                   | Required |
| ----- | ------- | --------------------------------------------- | -------- |
| name  | String  | The second-level domain name, e.g. "test.neo" | Required |
| owner | Address | The owner to register the second-level domain | Required |

### Example

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "register",
                         [
                             {
                                 "type":"String","value":"aa1a3.neo"
                             },{"type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"}
                         ],
    [
      {
        "account": "NQJKSNdTgNX3wno9QPYpwNhfUTg4DnEs6P",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBQwGo9RjypKE89yNZP2C3HJZlY8cQwJYWExYTMubmVvEsAfDAhyZWdpc3RlcgwUGonUjYn4waZtPT0O9IMs686pLxVBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "803798261",
        "exception": null,
        "stack": [
            {
                "type": "Boolean",
                "value": true
            }
        ]
    }
}
```

Request body #2

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "register",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },
{"type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"}
                         ],
    [
      {
        "account": "NQJKSNdTgNX3wno9QPYpwNhfUTg4DnEs6P",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBRjyd6XR7EomMVu9h9fAkJJigfqxQwOZmxhbWluY29tZS5uZW8SwB8MCHJlZ2lzdGVyDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "801592460",
        "exception": null,
        "stack": [
            {
                "type": "Boolean",
                "value": false
            }
        ]
    }
}
```

Request body #3

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "register",
                         [
                             {
                                 "type":"String","value":"pay.test"
                             },
{"type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"}
                         ],
    [
      {
        "account": "NQJKSNdTgNX3wno9QPYpwNhfUTg4DnEs6P",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBQwGo9RjypKE89yNZP2C3HJZlY8cQwIcGF5LnRlc3QSwB8MCHJlZ2lzdGVyDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS",
        "state": "FAULT",
        "gasconsumed": "692382",
        "exception": "An unhandled exception was thrown. The root does not exist.",
        "stack": []
    }
}
```


# renew

Extends the validity period of the second-level domain names. Anyone can renew other users' domains. The default renewal period is one year, or you can specify the years.

> \[!Note]
>
> Renewal for over 10 years from the current date is not allowed.
>
> Renewal for expired domains is not allowed.

This API returns the new expiration date.

***

### Parameters

| Name  | Type   | Description                                   | Required |
| ----- | ------ | --------------------------------------------- | -------- |
| name  | String | The second-level domain name, e.g. "test.neo" | Required |
| years | Byte   | Years to renew                                | Required |

### Example

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "renew",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DA5mbGFtaW5jb21lLm5lbxHAHwwFcmVuZXcMFLbLwLkAmZsTjKCyoF2KU3a3VYNTQWJ9W1I=",
        "state": "HALT",
        "gasconsumed": "801739239",
        "exception": null,
        "stack": [
            {
                "type": "Integer",
                "value": "1655369469752"
            }
        ]
    }
}
```

Request body #2

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "renew",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },
                             {
                                 "type":"Integer","value":"2"
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "EgwOZmxhbWluY29tZS5uZW8SwB8MBXJlbmV3DBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "1601737499",
        "exception": null,
        "stack": [
            {
                "type": "Integer",
                "value": "1655370669752"
            }
        ]
    }
}
```

Request body #3

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "renew",
                         [
                             {
                                 "type":"String","value":"crosschain1.neo"
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DA9jcm9zc2NoYWluMS5uZW8RwB8MBXJlbmV3DBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "FAULT",
        "gasconsumed": "801394985",
        "exception": "An unhandled exception was thrown. The name has expired.",
        "stack": []
    }
}
```


# resolve

Resolves the record of a second-level domain with the specific type. The maximum resolving depth is 2.

For example, when you resolve a domain "test.neo" with the IPV4 type:

* if the domain has a IPV4 record, then the record is returned directly
* if the domain has a canonical name record "alias.neo", which involves a IPV4 record, then the IPV4 record is returned.

***

### Parameters

| Name | Type    | Description                                                                                                                         | Required |
| ---- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------- |
| name | String  | The second-level domain, e.g. "test.neo"                                                                                            | Required |
| type | Integer | <p>Available types are:<br>1 - IPV4 address record<br>5 - Canonical name record<br>16 - Text record<br>28 - IPV6 address record</p> |          |

### Example

Request body #1

In this example, suppose "test1.neo" has no text record, but it has the cname record "test2.neo"; "test2.neo" has no text record, but it has the cname record "test3.neo"; "test3.neo" has a text record "test3". Then resolving "test1.neo" with the text record will return test3.

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "resolve",
                         [
                             {
                                 "type":"String","value":"test1.neo"
                             },
                             {
                                 "type":"Integer","value":"16"
                             }
                         ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "IAwJdGVzdDEubmVvEsAfDAdyZXNvbHZlDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "4410468",
        "exception": null,
        "stack": [
            {
                "type": "ByteString",
                "value": "dGVzdDM="
            }
        ]
    }
}
```

Request body #2

In this example, the depth is greater than 2 and no record is found.

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "resolve",
                         [
                             {
                                 "type":"String","value":"test1.neo"
                             },
                             {
                                 "type":"Integer","value":"16"
                             }
                         ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "IAwJdGVzdDEubmVvEsAfDAdyZXNvbHZlDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "FAULT",
        "gasconsumed": "4512384",
        "exception": "An unhandled exception was thrown. Too many redirections.",
        "stack": []
    }
}
```


# roots

Returns all the top-level domains.

***

### Parameters

N/A

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "roots",
                         [],
    []
],
  "id": 1
}
'
```

Response body

```json5
{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"script": "wh8MBXJvb3RzDBQaidSNifjBpm09PQ70gyzrzqkvFUFifVtS",
		"state": "HALT",
		"gasconsumed": "228888",
		"exception": null,
		"stack": [
			{
				"type": "InteropInterface",
				"iterator": [
					{
						"type": "ByteString",
						"value": "bmVv"
					}
				],
				"truncated": false
			}
		]
	}
}
```


# setAdmin

Sets the administrator for a second-level domain. Owners and administrators control the domains and subdomains. A second-level domain owner can specify an administrator to manage domains. Invoking this API emits the setAdmin event.

This API requires both the owner and administrator's signatures. If the admin is not specified, the admin record will be cleaned. If the domain has expired, it's not allowed to set admin.

***

### Parameters

| Name  | Type    | Description                                | Required |
| ----- | ------- | ------------------------------------------ | -------- |
| name  | String  | The second-level domain, e.g. "test.neo"   | Required |
| admin | Address | The administrator that the owner specifies | Required |

### Example

**Example #1 Set the admin record**

Request body #1

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setAdmin",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },
                             {
                                 "type":"Hash160","value":"0xc6b7765ce19d382b1af0894c226eee133713fa96"
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      },
      {
        "account": "NZgG83sFer1ciTy2LCjft4A4fiDuWg4XaB",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBSW+hM3E+5uIkyJ8BorOJ3hXHa3xgwOZmxhbWluY29tZS5uZW8SwB8MCHNldEFkbWluDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "1348018",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #2 Clear the admin record**

Request body #2

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setAdmin",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },
                             {
                                 "type":"Hash160","value":null
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      },
        {
              "account": "NZgG83sFer1ciTy2LCjft4A4fiDuWg4XaB",
        "scopes": "CalledByEntry"
        }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "CwwOZmxhbWluY29tZS5uZW8SwB8MCHNldEFkbWluDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "HALT",
        "gasconsumed": "1159492",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #3 Set admin for expired domain**

Request body #3

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setAdmin",
                         [
                             {
                                 "type":"String","value":"expired.neo"
                             },
                             {
                                 "type":"Hash160","value":"0xc6b7765ce19d382b1af0894c226eee133713fa96"
                             }
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      },
        {
              "account": "NZgG83sFer1ciTy2LCjft4A4fiDuWg4XaB",
        "scopes": "CalledByEntry"
        }
    ]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBSW+hM3E+5uIkyJ8BorOJ3hXHa3xgwLZXhwaXJlZC5uZW8SwB8MCHNldEFkbWluDBS2y8C5AJmbE4ygsqBdilN2t1WDU0FifVtS",
        "state": "FAULT",
        "gasconsumed": "593841",
        "exception": "An unhandled exception was thrown. The name has expired.",
        "stack": []
    }
}
```


# setPrice

Sets the registration price for each second-level domain length (for Neo Committee only).

The committee multi-signature address is required to generate a new transaction.

***

### Parameters

| Name      | Type       | Description                           | Required |
| --------- | ---------- | ------------------------------------- | -------- |
| priceList | Long Array | The price list for each domain length | Required |

> \[!Note]
>
> * The first value of the array stands for the default price.
> * The price should not be greater than 10000 GAS.

### Example

In this example, the price for each domain length is set as follows:

* 1 or 2-length domains: unavailable
* 3-length domains: 200 GAS
* 4-length domains: 60 GAS
* 5+ length domains: 8 GAS

Therefore, the domain name "alice.neo" costs 8 GAS, "test.neo" costs 60 GAS, and "pay.neo" costs 200GAS.

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
    "jsonrpc": "2.0",
    "method": "invokefunction",
    "params": [
        "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a",
        "setPrice",
        [
            {
                "type": "Array",
                "value": [
                    {
                        "type": "Integer",
                        "value": "800000000"
                    },
                    {
                        "type": "Integer",
                        "value": "-1"
                    },
                    {
                        "type": "Integer",
                        "value": "-1"
                    },
                    {
                        "type": "Integer",
                        "value": "20000000000"
                    },
                    {
                        "type": "Integer",
                        "value": "6000000000"
                    }
                ]
            }
        ],
        [
            {
                "account": "NbbBtdAbiCdvCaAhdT5dCgrZsAn1ZaUdot",
                "scopes": "Global"
            }
        ]
    ],
    "id": 1
}'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "AwC8oGUBAAAAAwDIF6gEAAAADw8CAAivLxXAEcAfDAhzZXRQcmljZQwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "418093",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```


# setRecord

Sets record for the second-level domain or its subdomains. Both the owner and administrator can set record.

This requires the owner or the administrator's signature, if the domain is expired, it's not allowed to set record.

***

### Parameters

| Name | Type    | Description                                                                                                                         | Required |
| ---- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------- |
| name | String  | The second-level domain, e.g. "test.neo", or subdomains, "pay.test.neo"                                                             | Required |
| type | Integer | <p>Available types are:<br>1 - IPV4 address record<br>5 - Canonical name record<br>16 - Text record<br>28 - IPV6 address record</p> | Required |
| data | String  | The corresponding data                                                                                                              | Required |

### Example

**Example #1 Set IPV4 address record**

The following ipv4 addresses will be rejected:

* 0.x.x.x; 10.x.x.x; 127.x.x.x; >=224.x.x.x
* 169.254.x.x
* 172.(16\~31).x.x
* 192.168.x.x
* x.x.0.x; x.x.255.x

Request body #1

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"1"},{"type":"String","value":"40.122.161.90"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #1

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DA00MC4xMjIuMTYxLjkwEQwOZmxhbWluY29tZS5uZW8TwB8MCXNldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "3230715",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #2 Set CNAME record**

The cname string must meet the following requirements:

* The length is greater than 3, and smaller than 255
* Its format is x.x.x
* Characters are combinations of numbers and Alphabet characters.

Request body #2

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"5"},{"type":"String","value":"alias2.neo"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #2

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAphbGlhczIubmVvFQwOZmxhbWluY29tZS5uZW8TwB8MCXNldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "2858562",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #3 Set Text record**

It is random text string with the length limited to 255. Normally you can set it as N3 address.

Request body #3

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"16"},{"type":"String","value":"NZgG83sFer1ciTy2LCjft4A4fiDuWg4XaB"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #3

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DCJOWmdHODNzRmVyMWNpVHkyTENqZnQ0QTRmaUR1V2c0WGFCIAwOZmxhbWluY29tZS5uZW8TwB8MCXNldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "2694027",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #5 Set IPV6 record**

The compressed IPV6 address is supported, such as 2001:1db8:0:: The following IPV6 addresses will be rejected:

* Start with (<0x2000)
* Start with 0x2002 or 0x3ffe
* Start with (>0x3fff)
* 0x2001:(<0x200 or 0xdb8)

Request body #4

```json5
curl --request POST \
  --url http://localhost:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setRecord",
                         [
                             {
                                 "type":"String","value":"flamincome.neo"
                             },{"type":"Integer","value":"28"},{"type":"String","value":"2001:1db8:3333:4444:5555:6666:7777:8888"}
                         ],
    [
      {
        "account": "NV1butKWMZSpWhBGU7PyP5Qe81Wq3zDkHP",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #4

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DCcyMDAxOjFkYjg6MzMzMzo0NDQ0OjU1NTU6NjY2Njo3Nzc3Ojg4ODgAHAwOZmxhbWluY29tZS5uZW8TwB8MCXNldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "3910838",
        "exception": null,
        "stack": [
            {
                "type": "Any"
            }
        ]
    }
}
```

**Example #5 Set record for expired domains**

Request body #5

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x538355b776538a5da0b2a08c139b9900b9c0cbb6", "setRecord",
                         [
                             {
                                 "type":"String","value":"expired.neo"
                             },{"type":"Integer","value":"1"},{"type":"String","value":"40.122.161.90"}
                         ],
    [
      {
        "account": "NMzaUBM56iumJ8pHfjjCuKsAepKxENkUqN",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body #5

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DA00MC4xMjIuMTYxLjkwEQwLZXhwaXJlZC5uZW8TwB8MCXNldFJlY29yZAwUtsvAuQCZmxOMoLKgXYpTdrdVg1NBYn1bUg==",
        "state": "FAULT",
        "gasconsumed": "1830252",
        "exception": "An unhandled exception was thrown. The name has expired.",
        "stack": []
    }
}
```


# tokens

Gets all second-level domain names including expired ones.

***

### Parameters

N/A

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "tokens",[],
    []
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "wh8MBnRva2VucwwUGonUjYn4waZtPT0O9IMs686pLxVBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "228888",
        "exception": null,
        "stack": [
            {
                "type": "InteropInterface",
                "iterator": [
                    {
                        "type": "ByteString",
                        "value": "Y3Jvc3NjaGFpbi5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "ZGlkLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "d2FuZy5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "dDMubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "ZnVuLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "YXZlLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "ZmxhbWluZ28ubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "a2trLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "cmV0Lm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "ZHlsYW4ubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "ZGVkZWJ1Zy5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "b2tyLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "Y2xvdWQubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "b2tqLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "aGhoLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "d3FlZWFzd3d3d3d4eHh3d2FzZGFzZGFzYXNkYXNkc2Fkc2Fhc3NhZHNhZHNhc2FzYWFzYXNkc2FkYXMubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "bm5zLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "bmVvLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "ZWRnZS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "dDQubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "dGVzbGEubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "dGVzdDIubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "b25lZ2F0ZS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "c3cubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "YXBwLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "MTIubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "YXByaWwubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "bXkubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "YS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "d210Lm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "MTIzNC5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "amQubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "amFuZS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "c3d4Lm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "cXdlLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "YWFuZy5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "YXNkc2RhZC5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "b2thLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "YWxpYmFiYS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "c2FtLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "b2submVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "ZmxhbWluY29tZS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "dDUubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "dnVlLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "dDIubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "ZXJyci5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "dDEubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "bm55by5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "d293Lm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "ZGVhZHBvb2wubmVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "cHJpY2VzLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "bmdkLm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "amVzc2ljYS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "bm50Lm5lbw=="
                    },
                    {
                        "type": "ByteString",
                        "value": "bWF5Lm5lbw=="
                    }
                ],
                "truncated": false
            }
        ]
    }
}
```


# tokensOf

Gets all second-level domains owned by the given address including expired ones.

***

### Parameters

| Name  | Type    | Description          | Required |
| ----- | ------- | -------------------- | -------- |
| owner | Address | The owner of domains | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "tokensOf",
                         [
                             {
                                 "type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"
                             }
                         ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DBQwGo9RjypKE89yNZP2C3HJZlY8cRHAHwwIdG9rZW5zT2YMFBqJ1I2J+MGmbT09DvSDLOvOqS8VQWJ9W1I=",
        "state": "HALT",
        "gasconsumed": "241395",
        "exception": null,
        "stack": [
            {
                "type": "InteropInterface",
                "iterator": [
                    {
                        "type": "ByteString",
                        "value": "MTIzNC5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "amFuZS5uZW8="
                    },
                    {
                        "type": "ByteString",
                        "value": "b2submVv"
                    },
                    {
                        "type": "ByteString",
                        "value": "dDEubmVv"
                    }
                ],
                "truncated": false
            }
        ]
    }
}
```


# transfer

Transfers a domain from the owner's address to another address. The signature of the owner is required. The expired domains cannot be transferred.

After transfered, all subdomains and records are reserved, and the admin is re-set as null.

***

### Parameters

| Name   | Type    | Description                              | Required |
| ------ | ------- | ---------------------------------------- | -------- |
| to     | Address | The target address to transfer to        | Required |
| domain | String  | The domain to be transferred             | Required |
| data   | objec   | The data information used after transfer | Required |

### Example

Request body

```json5
curl --request POST \
  --url http://seed1t4.neo.org:20332/ \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [ "0x152fa9ceeb2c83f40e3d3d6da6c1f8898dd4891a", "transfer",
                         [ {"type":"Hash160","value":"0x713c5666c9710bf6933572cf134a2a8f518f1a30"},
                             {
                                 "type":"String","value":"t1.neo"
                             },
                            {"type":"String","value":"test"}
                         ],
    [
      {
        "account": "NQJKSNdTgNX3wno9QPYpwNhfUTg4DnEs6P",
        "scopes": "CalledByEntry"
      }
    ]
],
  "id": 1
}
'
```

Response body

```json5
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "script": "DAR0ZXN0DAZ0MS5uZW8MFDAaj1GPKkoTz3I1k/YLcclmVjxxE8AfDAh0cmFuc2ZlcgwUGonUjYn4waZtPT0O9IMs686pLxVBYn1bUg==",
        "state": "HALT",
        "gasconsumed": "1075683",
        "exception": null,
        "stack": [
            {
                "type": "Boolean",
                "value": true
            }
        ]
    }
}
```


