{"id":18857672,"url":"https://github.com/portalnetwork/nns","last_synced_at":"2025-04-14T11:31:59.397Z","repository":{"id":112797813,"uuid":"142278737","full_name":"PortalNetwork/nns","owner":"PortalNetwork","description":"📗🌐Implementations for registrars and resolvers for the NEO Name Service","archived":false,"fork":false,"pushed_at":"2018-11-19T10:11:53.000Z","size":1471,"stargazers_count":3,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T00:51:14.015Z","etag":null,"topics":["blockchain","neo","nns"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PortalNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-25T09:32:45.000Z","updated_at":"2018-11-19T10:11:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"93c44077-3b82-4d98-aae2-25b85394976e","html_url":"https://github.com/PortalNetwork/nns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PortalNetwork%2Fnns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PortalNetwork%2Fnns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PortalNetwork%2Fnns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PortalNetwork%2Fnns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PortalNetwork","download_url":"https://codeload.github.com/PortalNetwork/nns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248871901,"owners_count":21175314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","neo","nns"],"created_at":"2024-11-08T04:07:35.395Z","updated_at":"2025-04-14T11:31:58.271Z","avatar_url":"https://github.com/PortalNetwork.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![NEO Name Service](./assets/title.jpg)\n\n[![Join the chat at https://gitter.im/PortalNetwork/nns](https://badges.gitter.im/PortalNetwork/nns.svg)](https://gitter.im/PortalNetwork/nns?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n\u003e 📗🌐 Documents and implementations for the NEO Name Service.\n\n# Overview\n\n## What is NEO?\nNEO is a non-profit community-driven blockchain project. It utilizes blockchain technology and digital identity to digitize assets and automate the management of digital assets using smart contracts. Using a distributed network, it aims to create a \"Smart Economy\".\n\n## What is BNS?\nBNS – or blockchain name system – is the protocol on the internet that turns human-comprehensible decentralized website names such as ‘website.perl’ or ‘mywebsite.eth’ into addresses understandable by decentralized network machines.\n\n## 📝 Description\n\nNNS is the NEO Name Service, a distributed, open, and extensible naming system based on the NEO blockchain.\n\n## 📚 Documents\n\n#### Table of Contents\n-  [Introduction](./docs/INTRODUCTION.md)\n-  [Implementation](./docs/IMPLEMENTATION.md)\n    - [Registry](./docs/REGISTRY.md)\n    - [Registrar](./docs/REGISTRAR.md)\n    - [Resolver](./docs/RESOLVER.md)\n-  [Developer Guide](./nns/README.md)\n-  [Integration](./docs/INTEGRATION.md)\n\n## Smart Contract Language\n- Python\n- C#\n- Java\n\n## 📍 NNS in Web3.0\nNNS plays an connecting and entry layer in Web3.0 services. It connects with NEO wallet, blockchain server, decentralized content resources, and decentralized database.\n![NEO web3](./assets/NEO-web3.png)\n\n## NEO Technical Stack\nNEO Name Service (NNS) is governs by three smart contract components, registrar, registry, and resolver. The three smart contracts contain the core logic for the whole NEO Name System implementation, from the ownership managment for a domain, to the NNS global resolving layer that can connect different tech stacks and enhances the usability for different infrastructures.\n![Technical Stack](./assets/1.png)\n\n### State Layer\nState layer is where user’s “state”, or user’s information and behavior, is stored. NEO is where these data are stored, and gives users the ability to control their own state.\n![State Layer](./assets/1-02.png)\n\n### Computation Layer\nNEO is aiming to support all of the high-level programming language and NeoVM is the virtual machine that executes these NEO smart contract codes. The NEO-VM is composed with the `Execution Engine`, `Evaluation Stack`, and `Interoperable Service Layer`. The `Execution Engine` is in charge of executing common instructions and interacting with the `Interoperable Service Layer`. The `Evaluation Stack` is equivalent to the memory, and `Interoperable Service Layer` is equivalent to the peripherals, which provides some APIs for accessing the chain-chain data (block info, transaction info, contract info and so on) of the smart contract.\n![Computation Layer](./assets/1-03.png)\n\n### Component Layer\nWith the combination of state layer and computation layer, many things could be implemented in the component layer. NNS, for instance, consists 3 major components — `registrar`, `registry` and `resolver`. These components make sure that NNS is operable and could meet the specific needs of each individual.\n\nA `registry` can operate the set of logics to record the mapping between the NEO domains and its owners. \nA `registrar` can govern how to own a domain through the customized auction or trading rules. \nA `resolver` can retrieve the corresponding resources from wallet address to decentralized application or website on top of NEO.\n![Component Layer](./assets/1-04.png)\n\n### Transfer Layer\nJust as Lightning Network offers solution to scale for Bitcoin, and Raiden Network (RDN) for Ethereum, Trinity Network (TNC) offers the `state channel` (identical to `payment channel`)for NEO to scale off-chain. It acts as a ledger between two parties, where only the end result of a transaction is recorded on the blockchain.\n![Transfer Layer](./assets/1-05.png)\n\n### Protocol Layer\nOn the Protocol Layer, we will be presenting our BNS (Blockchain Name Service) standards that can make the NNS more efficient and applicable. With the state, computation and component layers behind the scene, protocol layer serve as a gateway for users and developers to interact with our NNS standard.\n![Protocol Layer](./assets/1-06.png)\n\n### User Control Layer\nThis layer is in charge of managing a user’s private keys and the interaction with the State Layer. This enables more use cases around NNS at the application layer. For example, our Web Builder let users to create their own decentralized websites (DWebs) binded with an NNS, and a further enhancement on our extension could be used to access these DWebs with ease at “yourwebsite.neo”.\n![User Control Layer](./assets/1-07.png)\n\n### Application Layer\nNNS can be implemented into many other applications on NEO, such as wallet that can resolve NNS, dApp that utilize NNS for users identity and many more. Together with the off-chain scaling solution provided by Trinity Network, we believe that it is an essential components to provide a better environment for both technical and non-technical users.\n![Application Layer](./assets/1-08.png)\n\n# Introduction\n\n## NEO Smart Contract Development\n\n#### Smart Contract of NNS\n- [C#](./nns/dotnet/)\n- [Python](./nns/python/)\n\n### Prerequisites\n- `Docker` installed, download [HERE](https://download.docker.com/mac/stable/Docker.dmg).\n\n### Build using docker\n1. Execute command to start docker.\n```\ndocker run -d --name neo-privnet-with-gas -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp -v \"$(pwd)\":/opt/neo-python/smartContracts metachris/neo-privnet-with-gas\n```\n\n2. Start NEO private net through docker\n```\ndocker exec -it neo-privnet-with-gas /bin/bash\n```  \n![privnet](https://i.imgur.com/mHDlagb.png)\n\n3. Run NEO private net\n```\npython3 /opt/neo-python/prompt.py -c protocol.privnet.json\n``` \n![run](https://i.imgur.com/opDfFfU.png)\n\n4. Create wallet (i.e. portalnetwork.wallet)\n```\nneo\u003e create wallet portalnetwork.wallet\n```\n![wallet](https://i.imgur.com/Kaherpk.png)\n\n5. At this moment, `portalnetwork.wallet` has no NEO and GAS.   \nBut you can also run this command to import NEO and GAS.  \n```\nneo\u003e import wif KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr\nneo\u003e wallet rebuild\nneo\u003e wallet\n```\n![import](https://i.imgur.com/HEgOsWF.png)\n\n6. Exit NEO private net and go to your NEO smart contract project folder.   \nCopy your smart contract files to NEO's private net container.\n```\ndocker cp domain.py [container id]:/opt/neo-python/contract/domain.py\n```\n\n7. Back into docker, use `neo-boa` build python to avm. run `python3` and execute two command\n```\nfrom boa.compiler import Compiler\nCompiler.load_and_save('one.py')\n``` \n![command](https://i.imgur.com/q5pPrWN.png)\n\n8. Execute NEO private net \n```\npython3 /opt/neo-python/prompt.py -c protocol.privnet.json\n```\n\n9. Before deploy contract, you should open the wallet. \n```\nopen wallet portalnetwork.wallet\n```\n\n10. Now you can deploy contract \n```\nneo\u003e import contract ./contract/domain.avm \"\" 01 False False\n```\n![deploy](https://i.imgur.com/a0XQOJO.png)\n\n11. Search the contract\n```\nneo\u003e contract search [your contract name]\n```\n\n12. Test and invoke contract via the command below\n```\nneo\u003e testinvoke 68ebfc4fefbe24c9cff0f7e3c0d27ed396d07f9f\n```\n![invoke](https://i.imgur.com/psWIeVe.png)\n\n## 🔗 Resources\n- [Official website](https://neo.org/)\n- [NEO Documentation](http://docs.neo.org/en-us/index.html)\n\n## 📣 Contributing\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for how to help out.\n\n## 🗒 Licence\nSee [LICENSE](./LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportalnetwork%2Fnns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportalnetwork%2Fnns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportalnetwork%2Fnns/lists"}