Incorporating a collaboration feature necessitates providing users with the means to connect, search, and share their content effectively. To enable efficient content search and referencing, a global naming system must be implemented. This naming system would allow users to refer to one another using names such as stacy or denote their space as stacy_workspace1_public.
Given that our project involves the creation of a distributed system, the naming system becomes one of the key modules. Consequently, the design of this naming system should be permissionlessness (i.e.: “unstoppable” or “politically decentralized”), preventing Anytype from censoring users' content and names.
In our pursuit of establishing a permissionless naming system, we have opted to leverage smart contracts built on the EVM chain, compatible with the Ethereum Name Service (ENS). This compatibility facilitates seamless integration with various existing tools and services. It can help others to talk to us.
However, interacting with smart contracts places a notable burden on end users. They are required to (1) create wallets, (2) fund them, (3) authorize each transaction with their signature, and (4) pay for gas.
Fortunately, a concept known as "Account Abstraction" presents a solution. Through this approach, Anytype can cover the gas fees on behalf of the user. Notably, users retain full control over all operations and maintain direct communication with the smart contracts. Anytype's inability to censor or block user actions is a fundamental aspect of this design. Furthermore, users have the flexibility to use their Any names outside the Any ecosystem if they choose. They can interact directly with the smart contract and cover gas costs independently or utilize other Account Abstraction services that provide similar functionality.
Key outcomes:
- References and links to users' data are immune to censorship
- Users can leverage Anytype's user-friendly Account Abstraction service
- In the event that Anytype discontinues this service or tries to censor, users can seamlessly transition to an alternative Account Abstraction service or engage directly with smart contracts.
This repository contains 2 projects:
- AnyNS smart contracts (this top-level folder)
- AnyNS frontend (anyns-frontend sub-folder)
Please see original ENS README file!
AnyNS, which stands for Any Naming System, is an experimental decentralized domain name system based on ENS (Ethereum Name Service) and compatible with ENS.
The current repository features "anytype" folders containing custom Anytype contracts and code. The original ENS contracts and deployment files remain intact. However, some of the Anytype contracts rely on and use the original ENS contracts. For example, the original ENSRegistry is used without being copied. Therefore, please exercise caution when merging or updating these contracts and interfaces from the master branch, as changes to the original ENS contracts may affect them.
To view all custom Anytype contracts, please refer to the contracts/anytype folder. For a comprehensive understanding of all dependencies, please consult the deploy/anytype folder. To explore updated use cases and logic, please review the contents of the test/anytype folder.
- .any TLD is used instead of .eth
- AnytypeRegistrarController - allows ERC20 (USDT, USDC, DAI, etc) stablecoins as payment. Ether is UNsupported as a payment option here
- AnytypeRegistrarControllerPrivate - owner of this contract can register any name without a payment on behalf/for other users
- AnytypeResolver - some unnecessary interfaces were removed, ISpaceResolver is added
- AnytypePriceOracle - very simple price oracle, with basic functionality
- anytype-frontend - AnyNS NextJS/React frontend.
- hello.a.any - can be only registered by a.any owner or Anytype
- INVALID: aa.any - domains with less than 3 letters can not be registered
- INVALID: aa - Top-Level-Domain (TLD) can not be registered, the only valid is .any
# to test all contracts
npm run test
# to test particular contract
npm run test -- --grep "AnytypeRegistrarControllerPrivate"
- Define a .env file with 3 variables:
DEPLOYER_KEY=XXX
INFURA_API_KEY=YYY
ADMIN_SCW=ZZZ
MINTER_SCW=KKK
-
(optional) Remove deployments/sepolia folder to reset all migrations:
rm -rf deployments/sepolia
-
Run migrations:
npx hardhat --network sepolia deploy --tags "anytype"
.
As a result, folder deployments/sepolia should be updated with new contract addresses.
Please see custom gas setting in the hardhat.config.ts file. This should increase the speed of the migration.
In some cases deployment txs will fail because of low gas limit. There is a "gas" parameter in the hardhat.config.ts file, but unfortunately it is not passed when running migrations using ethers. For details see this explanation.
In such case we recomend you to set gasLimit values directly for EACH transaction in the deployment scripts. Example:
const deployArgs = {
from: deployer,
args: [registry.address, registrar.address, metadata.address],
log: true,
gasLimit: 3000000
}
const nameWrapper = await deploy('AnytypeNameWrapper', deployArgs)
See anyns-frontend folder for more details.
- Gas optimizations:
- ? Remove the StaticMetadataService
- ? Remove ERC721 NFTs???
- ? Remove NameWrapper
- ? Remove StaticMetadataService
See table here - https://docs.google.com/spreadsheets/d/1eH4nuLWMvLMakTkcsc6lq6nj_1cR7fc1-L05XWxg0fI/edit?usp=sharing
AnytypeRegistrarControllerPrivate::commit - 46358 AnytypeRegistrarControllerPrivate::register - 305395
Approve USDT/USDC - 46663 AnytypeRegistrarController::commit - 44194 AnytypeRegistrarController::register - 355580
Thank you for your desire to develop Anytype together!
❤️ This project and everyone involved in it is governed by the Code of Conduct.
🧑💻 Check out our contributing guide to learn about asking questions, creating issues, or submitting pull requests.
🫢 For security findings, please email security@anytype.io and refer to our security guide for more information.
🤝 Follow us on Github and join the Contributors Community.
Original files from ENS are licensed under MIT.
Additions, made by Any — a Swiss association 🇨🇭, are licensed under MIT (see LICENSE.md
in anyns-frontend
and anytype
sub-folders).