37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
|
# Nicename Resolving with NNS
|
||
|
|
||
|
Steps to start using name resolving:
|
||
|
|
||
|
1. Enable NNS resolving in config (`rpc_endpoint` must be a valid neo rpc node, see [configs](./config) for other examples):
|
||
|
|
||
|
```yaml
|
||
|
rpc_endpoint: http://morph-chain.frostfs.devenv:30333
|
||
|
resolve_order:
|
||
|
- nns
|
||
|
```
|
||
|
|
||
|
2. Make sure your container is registered in NNS contract. If you use [frostfs-dev-env](https://git.frostfs.info/TrueCloudLab/frostfs-dev-env)
|
||
|
you can check if your container (e.g. with `container-name` name) is registered in NNS:
|
||
|
|
||
|
```shell
|
||
|
$ curl -s --data '{"id":1,"jsonrpc":"2.0","method":"getcontractstate","params":[1]}' \
|
||
|
http://morph-chain.frostfs.devenv:30333 | jq -r '.result.hash'
|
||
|
|
||
|
0x8e6c3cd4b976b28e84a3788f6ea9e2676c15d667
|
||
|
|
||
|
$ docker exec -it morph_chain neo-go \
|
||
|
contract testinvokefunction \
|
||
|
-r http://morph-chain.frostfs.devenv:30333 0x8e6c3cd4b976b28e84a3788f6ea9e2676c15d667 \
|
||
|
resolve string:container-name.container int:16 \
|
||
|
| jq -r '.stack[0].value | if type=="array" then .[0].value else . end' \
|
||
|
| base64 -d && echo
|
||
|
|
||
|
7f3vvkw4iTiS5ZZbu5BQXEmJtETWbi3uUjLNaSs29xrL
|
||
|
```
|
||
|
|
||
|
3. Use container name instead of its `$CID`. For example:
|
||
|
|
||
|
```shell
|
||
|
$ curl http://localhost:8082/get_by_attribute/container-name/FileName/object-name
|
||
|
```
|