As a prerequisite, the node has components that must be started together: Api-zkSync, Api-Proxy, MongoDB, and IPFS.
The Quarkid identity network is based on Sidetree, an innovative second-layer protocol scalability layer that improves the efficiency and versatility of Decentralized Identifiers (DIDs). Sidetree allows us to perform operations on DIDs, such as creation, updating, and revocation, with efficiency that far exceeds the limits of first-layer implementations. The QuarkID network is anchored in zkSync, a secure and scalable second-layer protocol for Ethereum. We leverage zkSync's capabilities to enable low-cost and high-speed transactions, thus providing an efficient utility infrastructure for our network and its adoption.
The Quarkid network is built on the foundation of the zkSync blockchain, with the aim of providing stability and efficiency. It also supports other types of networks, such as RSK and any ETH-compatible network. This network architecture is designed to support a high volume of DID operations with fast transaction confirmation times and minimal transaction costs. To enable interaction on the network, we have deployed two smart contracts on the zkSync blockchain, one for the main network (Mainnet) and another for the test network (Testnet). These smart contracts facilitate the creation, updating, and revocation of DIDs on the network, in addition to providing the necessary functionality to anchor and resolve DIDs using Sidetree.
For the mainnet network, the smart contract can be found at the following address:
- ZKSync: 0xe0055B74422Bec15cB1625792C4aA0beDcC61AA7
- Block: 2424399
- DID Method: did:quarkid
- Main network information:
- Network name: zkSync Era Mainnet
- RPC URL: https://mainnet.era.zksync.io
- Chain ID: 324
- Currency symbol: ETH
- Block explorer URL: https://explorer.zksync.io/
For the testnet network, the smart contract can be found at the following address: ZKSync: 0x2535412fA22D9ad83384D7Ab7b636DDA37eFA872 Block: 505069 DID Method: did:quarkid:zksync This data ensures synchronization with the active Quarkid testnet network. Test network information:
- Network name: zkSync Era Testnet
- RPC URL: https://zksync-sepolia.g.alchemy.com/v2/8Q5qHcUMLuvW2FGYfyry13in-eAdJfWp
- Chain ID: 300
- Currency symbol: ETH
- Block explorer URL: https://sepolia.explorer.zksync.io/
To obtain funds on the zkSync network, it is necessary to use a bridge available to transfer Ether from the main network (Mainnet) or a test network (Testnet) such as Sepolia, to the corresponding (ZkSync) network.
API proxy, also known as reverse proxy, is a component designed to function as an entry point to multiple did methods with the aim of facilitating their handling and resolution since each implementation has its own specifications and dynamics. The component works with three endpoints:
GET /mappings
Its response provides us with a list of available nodes to operate with Api Proxy. Example:
{
"list": [
{
"url":"https://URL_TO_api-zksync",
"pattern": "did:quarkid",
"behavior": 1
}
]
}
GET /resolve/:did
It receives a DID as a parameter and gives us the power to resolve a did-document. In this case, the proxy will return the document varying from the consumed method. For example, Api-zksync defines how the response will be, noting that this component only has the proxy function.
POST /create
This endpoint receives the did-method to use and the request as parameters. Like the previous one, its response varies depending on the did-registry.
It is a component that follows SideTree specifications to interact with a blockchain and efficiently manage decentralized records. It uses:
NoSQL database oriented to documents, which stores data in flexible JSON-like structures called BSON (Binary JSON).
IPFS, or the InterPlanetary File System, is a protocol and network designed to create a decentralized and distributed method of file storage and access that seeks to connect all computing devices with the same file system.
As clarified earlier, this Ethereum scalability solution uses Zero-Knowledge Proofs (zkProofs) to enable fast and secure transactions with significantly lower fees than the main network. zkSync's "rollup" technology groups hundreds of off-chain Ethereum transactions into a single batch, and then proves their validity on the main blockchain (on-chain) with a single zero-knowledge proof.
- Have Docker installed on the system that will be used for installation.
- Have Internet access and necessary permissions to download images from the official Docker container registry.
Step 1: Open Docker. Once authenticated, you can proceed to download the necessary images with the docker pull command:
# docker pull quarkid/api-proxy
# docker pull quarkid/api-zksync
# docker pull ipfs/kubo:latest
# docker pull mongo:latest
Step 2: Verify the downloaded images with docker image ls:
REPOSITORY TAG IMAGE ID SIZE
quarkid/api-proxy latest cb8941a6fbe4 16 hours ago 1.26GB
quarkid/api-zksync latest 13e12acfd1c0 5 months ago 3.56GB
ipfs/kubo latest 71f8fff78bb2 3 days ago 94.6MB
mongo
- Variable: NODE_1_URL
- Value: IP:PORT
- Description: IP and Port of the API Proxy component
- Variable: NODE_1_PATTERN
- Value: did:quarkid
- Description: Did method that NODE_1_URL resolves
- Variable: NODE_1_BEHAVIOR
- Value: 1
- Description: Active
The following variables must be configured for this component:
- Variable: DID_METHOD_NAME
- Value: quarkid
- Description: Did method
- Variable: CONTENT_ADDRESSABLE_STORE_SERVICE_URI
- Value: IP:PORT
- Description: IP and Port of the IPFS component
- Variable: DATABASE_NAME
- Value: -zksync-mainnet-v1
- Description: Database name
- Variable: RPC_URL
- Value: https://mainnet.era.zksync.io
- Description: URL of the network where the DID will be anchored
- Variable: MONGO_DB_CONNECTION_STRING
- Value: mongodb://10.1.0.2:27017
- Description: Connection string to the MongoDB component
- Variable: MAX_CONCURRENT_DOWNLOADS
- Value: 20
- Description: Number of operations to download per interval
- Variable: OBSERVING_INTERVAL_IN_SECONDS
- Value: 30
- Description: Blockchain reading time
- Variable: BATCHING_INTERVAL_IN_SECONDS
- Value: 21600
- Description: Blockchain writing time
- Variable: BLOCKCHAIN_VERSION
- Value: latest
- Description: Blockchain Version
- Variable: MODENA_ANCHO_CONTRACT
- Value: 0xe0055B74422Bec15cB1625792C4aA0beDcC61AA7
- Description: Address of the Quarkid smart contract
- WALLET_PRIVATE_KEY:
- Value: XXX
- Description: Private key of address with zkSync network balance
- ACCOUNT_ADDRESS:
- Value: 0x9CAA73a4865fa9dbb125b6C7B2f03b6621234
- Description: Address of the previous private key
- LEDGER_TYPE:
- Value: zksync | rsk | eth
- Description: Blockchain network to use
This component has no additional configurations.
This component has no additional configurations.
To simplify, we will give an example of the process of deploying and managing our container infrastructure using Docker Compose.
The components have been successfully tested on the following orchestrators:
- Azure - AKS
- Google - GKS
- AWS - EKS
- Docker-compose
- Any orchestrator that uses Docker as its containerization technology.
To perform these tests, you must have an address configured in Testnet and you must transfer balance to be able to execute the transactions.
ACCOUNT_ADDRESS==****
WALLET_PRIVATE_KEYS=***
An example of a docker-compose.yml file:
version: '3.7'
services:
api-sksync:
image: quarkid/api-zksync:latest
container_name: api-zksync-cont
ports:
- 8000:3000
restart: always
environment:
- DID_METHOD_NAME=quarkid:zksync
- CONTENT_ADDRESSABLE_STORE_SERVICE_URI=http://ipfs-quarkid:5001/
- DATABASE_NAME=zksync-testnet-v1
- RPC_URL=https://zksync-sepolia.g.alchemy.com/v2/8Q5qHcUMLuvW2FGYfyry13in-eAdJfWp
- MONGO_DB_CONNECTION_STRING=mongodb://mongo-quarkid:27017
- MAX_CONCURRENT_DOWNLOADS=20
- OBSERVING_INTERVAL_IN_SECONDS=30
- BATCHING_INTERVAL_IN_SECONDS=60
- STARTING_BLOCKCHAIN_TIME=505069
- BLOCKCHAIN_VERSION=latest
- MODENA_ANCHOR_CONTRACT=0x2535412fA22D9ad83384D7Ab7b636DDA37eFA872
- WALLET_PRIVATE_KEY=***
- ACCOUNT_ADDRESS=***
- LEDGER_TYPE=zksync
api-proxy:
image: quarkid/api-proxy:latest
container_name: api-proxy-cont
ports:
- 8080:8080 #MODENA API port
environment:
- NODE_1_URL=api-sksync:8000
- NODE_1_PATTERN=did:quarkid:zksync
- NODE_1_BEHAVIOR=1
mongo-quarkid:
image: mongo
restart: always
expose:
- 27017
ports:
- 27017:27017
ipfs:
restart: always
container_name: ipfs-quarkid
image: ipfs/kubo
environment:
- IPFS_PATH=/data/ipfs
volumes:
- ./ipfs:/data/ipfs
ports:
- 4001:4001
- 5001:5001
When reviewing the api-zksync logs, you will notice that the first few minutes show synchronization with other nodes. In some cases, messages of the type {"code":"content_not_found"} can be generated, which means that another node recorded a transaction on the network, but IPFS was not opened to synchronize the information. It does not affect the node, only that those DIDs will not be able to be resolved. That's why it's important that IPFS is correctly synchronized.