Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Zilliqa
https://github.com/zilliqa/dev-portal
Admin
Documentation for Zilliqa developer
Tokens:
43,311
Snippets:
127
Trust Score:
9.5
Update:
1 year ago
Context
Chat
Benchmark
22
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Install Zilliqa Node Dependencies Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Installs necessary software packages for building and running Zilliqa nodes, including Solidity compiler, build tools, and OpenSSL development libraries. ```bash sudo add-apt-repository ppa:ethereum/ethereum && sudo apt update && \ sudo apt install -y solc build-essential pkg-config libssl-dev cmake \ protobuf-compiler ``` -------------------------------- ### Start Zilliqa Node from Checkpoint Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Starts a Zilliqa node from a specified checkpoint file. Requires execute permissions for the script and the private key. The checkpoint file is used for initial synchronization. ```bash chmod +x start_node.sh && \ ./start_node.sh -k $PRIVATE_KEY -p <checkpoint_block_num.dat> ``` -------------------------------- ### Start Zilliqa Node from Genesis Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Starts a Zilliqa node from the genesis block. This method requires the private key for authentication. It's used when a node needs to sync from the very beginning. ```bash chmod +x start_node.sh && \ ./start_node.sh -k $PRIVATE_KEY ``` -------------------------------- ### Start Zilliqa 2.0 Validator Node Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Starts the Zilliqa 2.0 validator node by making the generated startup script executable and running it with the provided private key. This command initiates the node's synchronization with the network. ```bash chmod +x start_validator.sh && ./start_validator.sh $PRIVATE_KEY ``` -------------------------------- ### Install Zilliqa 2.0 Prerequisites Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Installs necessary software packages for Zilliqa 2.0 development, including the Solidity compiler, build tools, and OpenSSL development libraries. This is a prerequisite for building and running Zilliqa nodes. ```bash sudo add-apt-repository ppa:ethereum/ethereum && sudo apt update && sudo apt install -y solc build-essential pkg-config libssl-dev cmake protobuf-compiler ``` -------------------------------- ### Installing Dependencies with Pip Source: https://github.com/zilliqa/dev-portal/blob/main/README.md After activating the virtual environment, this command installs the necessary Python packages listed in the requirements.txt file, which are essential for running mkdocs and building the documentation. ```shell pip3 install -r requirements.txt ``` -------------------------------- ### Source Zilliqa Environment Variables Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Sources the environment setup script provided by the Zilliqa codebase to make the `z2` utility accessible in the current shell session. ```shell source /my/dir/zq2/scripts/setenv ``` -------------------------------- ### Join Zilliqa Network Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Connects a node to a specific Zilliqa network, such as the mainnet. This command is used during initial setup or when rejoining the network after configuration changes. ```bash z2 join --chain zq2-mainnet ``` -------------------------------- ### Start OpenTelemetry Local Testing Environment Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/monitoring/opentelemetry.md This command uses Docker Compose to deploy a local Zilliqa environment pre-configured with OpenTelemetry tools. This setup allows for local testing and visualization of Zilliqa node metrics. ```bash docker-compose -f infra/opentelemetry/compose.yaml up -d ``` -------------------------------- ### Get Zilliqa Node Version Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Retrieves the version information of a running Zilliqa node by calling the `GetVersion` API method. This is useful for verifying successful upgrades. ```bash curl --request POST --url http://localhost:4202 --header 'content-type: application/json' --data '{"method":"GetVersion","id":1,"jsonrpc":"2.0"}' ``` -------------------------------- ### Setting up Python Virtual Environment Source: https://github.com/zilliqa/dev-portal/blob/main/README.md This snippet shows how to set up a Python virtual environment for developing the Zilliqa developer documentation. It ensures that mkdocs and its dependencies are installed in an isolated environment. ```shell python -m venv ~/mydir source ~/mydir/bin/activate ``` -------------------------------- ### Join Zilliqa Network Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Uses the `z2` utility to join a Zilliqa network. Users can specify the network type (mainnet, testnet, devnet) to connect to. ```bash z2 join --chain zq2-mainnet ``` -------------------------------- ### Join Zilliqa Network with OpenTelemetry Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Joins a Zilliqa network and configures the node to export performance and operational metrics to a specified OpenTelemetry collector endpoint. ```bash z2 join --chain zq2-mainnet --otlp-endpoint=http://localhost:4317 ``` -------------------------------- ### Example Zilliqa Stats Agent Configuration (Docker) Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/monitoring/statsagent.md An example Docker run command for deploying the Zilliqa Stats Agent, pre-filled with typical values for a mainnet connection. This includes specific instance names, peer IDs, contact details, and the WebSocket secret. ```bash docker run -td --restart=unless-stopped \ --platform=linux/amd64 \ --net=host \ -e RPC_HOST="127.0.0.1" \ -e RPC_PORT="4202" \ -e LISTENING_PORT="3333" \ -e INSTANCE_NAME="operator-name-validator" \ -e PEER_ID="12D3KooWC7W24XNeeKsoxCVsrKo4i3wbWxvBvuGoSyB26ua4eeA4" \ -e CONTACT_DETAILS="operator@example.com" \ -e WS_PORT="4202" \ -e WS_SERVER="ws://stats.zq2-mainnet.zilliqa.com" \ -e WS_SECRET="your-provided-secret" \ -e VERBOSITY="2" \ asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/zilstats-agent:v0.1.0 ``` -------------------------------- ### Install OpenZeppelin Contracts with Forge Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/staking/delegatedstaking.md Installs the necessary OpenZeppelin contracts for upgradeable and standard contracts using the Forge package manager. This is a prerequisite for deploying and interacting with staking contracts. ```bash forge install OpenZeppelin/openzeppelin-contracts-upgradeable forge install OpenZeppelin/openzeppelin-contracts ``` -------------------------------- ### Pull Zilliqa Node Docker Image Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Downloads the latest Zilliqa 2.0 Docker image from the specified registry. It uses a version tag, which can be found in the `start_node.sh` script. ```bash docker pull asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/zq2:${ZQ_VERSION} ``` -------------------------------- ### Example Forge Remappings Entry Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/staking/delegatedstaking.md An example of how to configure the `remappings.txt` file to correctly map local paths to Zilliqa's ZQ2 repository contracts. This is crucial for Forge to locate and compile contracts during the build process. ```plaintext @zilliqa/zq2/=/home/your-user/zq2/zilliqa/src/contracts/ ``` -------------------------------- ### Download Checkpoint File using Wget Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/checkpoints/index.md This command downloads a Zilliqa checkpoint file from a specified URL. Replace `<network>` with 'mainnet', 'testnet', or 'devnet', and `<block_num.dat>` with the actual checkpoint file name. ```bash wget https://checkpoints.zq2-<network>.zilliqa.com/<block_num.dat> ``` -------------------------------- ### Apply Kubernetes Manifests Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Applies Kubernetes manifests using the 'z' tool. This command is typically used to ensure the installation of essential components like the ingress-nginx controller for local development environments. ```sh z k-apply ``` -------------------------------- ### Generate Zilliqa 2.0 Validator Node Configuration Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Generates the startup script and configuration file for a Zilliqa 2.0 validator node by running the 'z2 join' command with the specified chain. This prepares the node for joining the network. ```bash z2 join --chain zq2-mainnet ``` -------------------------------- ### Scilla Crowdfunding Contract - Part 1 Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/zilliqa/introduction-videos.md This video explores the components of a crowdfunding smart contract written in Scilla. It provides a link to a detailed explanation and example of the contract. ```Scilla https://scilla.readthedocs.io/en/latest/scilla-by-example.html#a-second-example-crowdfunding ``` -------------------------------- ### Running Documentation in a Container Source: https://github.com/zilliqa/dev-portal/blob/main/README.md This command builds and runs the Zilliqa developer documentation within a Docker container. It's useful for testing the production-like environment and ensures consistency across different development setups. ```shell make run-image ``` -------------------------------- ### Generate Zilliqa Node Private Key Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/node.md Generates a random 32-byte hexadecimal string to be used as the node's private key and exports it as an environment variable. ```bash openssl rand -hex 32 > node-private-key.txt export PRIVATE_KEY=$(cat node-private-key.txt) ``` -------------------------------- ### Deploy Hello World Scilla Contract on Zilliqa Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/zilliqa/introduction-videos.md This video demonstrates how to deploy a 'Hello World' smart contract on the Zilliqa blockchain using their online IDE. It also provides a link to the contract code and an explanation of its components. ```Scilla https://scilla.readthedocs.io/en/latest/scilla-by-example.html#helloworld ``` -------------------------------- ### Developing Zilliqa Developer Documentation Source: https://github.com/zilliqa/dev-portal/blob/main/README.md This command initiates the development server for the Zilliqa developer documentation. It utilizes mkdocs to serve the documentation locally, allowing for real-time previewing of changes. ```shell make dev2 ``` -------------------------------- ### Upgrade Zilliqa Node with Docker Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Commands to upgrade your Zilliqa node. This includes pulling the latest Docker image, stopping the current container, and starting the new version using a script. ```bash docker pull asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/zq2:${NEW_ZQ_VERSION} ``` ```bash docker container ls ``` ```bash docker stop <container id> ``` ```bash ./start_node.sh ``` -------------------------------- ### Get Zilliqa 2.0 Node Block Number Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Queries the Zilliqa 2.0 node for the current block number using the JSON-RPC API. This is useful for checking the node's synchronization status and network activity. ```json curl --request POST \ --url http://localhost:4201/ \ --header 'Content-Type: application/json' \ --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' ``` -------------------------------- ### Generate Zilliqa 2.0 Validator Private Key Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes.md Generates a 32-byte random hexadecimal private key for the Zilliqa 2.0 validator node and exports it as an environment variable. This key is essential for starting and managing the validator. ```bash openssl rand -hex 32 > validator-private-key.txt export PRIVATE_KEY=$(cat validator-private-key.txt) ``` -------------------------------- ### Plan and Apply Changes Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Executes Zilliqa CLI commands to plan and apply the staged configuration changes to the production environment. `z plan` previews the changes, and `z apply` implements them. ```sh z plan z apply ``` -------------------------------- ### Example JSON Response for ZIL Transactions Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/zil-all-transactions.md This JSON object represents a successful response from a GraphQL query for Zilliqa native transactions. It contains a list of transaction objects, each detailing essential information like block ID, transaction ID, addresses, amount, and gas details. ```json { "data": { "getTransactionDetails": { "list": [ { "blockID": "913150", "TxId": "0x774b90ec3590d888a9b71f49bb067ada517942243f2171d0d95c7d705111fdd7", "toAddress": "0x72fcaf6815a5b9c29f0457651c501da25560b0c0", "fromAddress": "0x31b844db1fb3c97d5a2597730cca7eb8d5281a6c", "tokenAddress": "0x0000000000000000000000000000000000000000", "amount": "61758659441516", "gasAmount": "1", "gasPrice": "2000000000" }, { "blockID": "913378", "TxId": "0x2a7e91328420416869c42a67c057402565e1b9c33ab3643408789a6784cad8f1", "toAddress": "0x873201b7eaddd65f32174a56fa7309fdc2eae411", "fromAddress": "0x6e31e6ecede40299058a4a8444956c59159ba55a", "tokenAddress": "0x0000000000000000000000000000000000000000", "amount": "11067072104794", "gasAmount": "1", "gasPrice": "2000000000" }, { "blockID": "913230", "TxId": "0x4a130c1191c47f3c3aad4b89483352f1ae06207536127200540a0482dec6ef74", "toAddress": "0x72fcaf6815a5b9c29f0457651c501da25560b0c0", "fromAddress": "0xb9d6f37426a3dc48b1b7bc834df9efa2b168a187", "tokenAddress": "0x0000000000000000000000000000000000000000", "amount": "73653231337520", "gasAmount": "1", "gasPrice": "2000000000" } ] } } } ``` -------------------------------- ### Example ZRC2 Token List Response Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/zrc2-contract-list.md An example JSON response detailing a list of ZRC-2 tokens, including their contract addresses, names, symbols, supply information, standard, decimals, owner addresses, and contract types. ```json { "data": { "getTokenDetails": { "cursor": "6", "list": [ { "contractAddress": "0xd130598a0c19f07e411de9571b249e163ca650d8", "tokenName": "ABCtoken", "tokenSymbol": "ABC", "init_supply": null, "totalSupply": "10000000", "standard": "ZRC2", "decimals": "0", "ownerAddress": "0x1fA770d35ac575Cff808540E084C2907d71Ef763", "type": "ASSET_CONTRACT" }, { "contractAddress": "0x17c81253b9de207c98381c0ca3c84f2d151928c7", "tokenName": "XCAD Network Test Token", "tokenSymbol": "XCAD", "init_supply": null, "totalSupply": "2000000000000", "standard": "ZRC2", "decimals": "6", "ownerAddress": "0xa3f8c8bE2e3AD62c6fe7729Ef0aC402d3da8F9D9", "type": "ASSET_CONTRACT" } ] } } } ``` -------------------------------- ### Zilliqa 2.0 SDKs and Tools Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/sdk.md Provides access to native Software Development Kits (SDKs) for various programming languages and essential development tools for Zilliqa 2.0. This includes libraries for Rust, Golang, Java, Javascript/Typescript, and Python, as well as plugins and forks that enhance contract deployment, testing, and transaction handling. ```Rust crates.io/crates/zilliqa-rs ``` ```Golang github.com/Zilliqa/gozilliqa-sdk ``` ```Java github.com/Zilliqa/zilliqa-developer/tree/main/products/laksaj ``` ```Javascript/Typescript www.npmjs.com/package/@zilliqa-js/zilliqa ``` ```Python github.com/zilliqa/pyzil ``` ```Solidity github.com/Zilliqa/hardhat-scilla-plugin ``` ```Javascript github.com/Zilliqa/ethers.js ``` ```Javascript github.com/Zilliqa/otterscan ``` -------------------------------- ### Example ZRC2 Transaction History Response Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/zrc2-transaction-history.md This is an example JSON response from the Zilliqa API detailing a list of ZRC2 transactions. Each transaction object includes its block ID, transaction ID, sender, receiver, token address, and amount. ```json { "data": { "getTransactionDetails": { "list": [ { "blockID": "4738791", "TxId": "450c0936f9fee544ae646da30c6321e0d00dbeb3ebdb72662a99550b39a9e0f9", "sender": "0x86f0875da311ee5332d5d4a8485c8d3db0f7f57b", "toAddress": "0x22b251cc155ac0a181a156aaec74e964a82011c1", "fromAddress": null, "isTransferFrom": false, "tokenAddress": "0xc5c5f8786574522e83242e5981482d63c9ac7101", "amount": "10000000000" }, { "blockID": "4738797", "TxId": "d14d02e620f9c0e0d8d9f8109237689c8da5ec8b8694df3e45fcdc8c1af85e95", "sender": "0x86f0875da311ee5332d5d4a8485c8d3db0f7f57b", "toAddress": "0x22b251cc155ac0a181a156aaec74e964a82011c1", "fromAddress": null, "isTransferFrom": false, "tokenAddress": "0xc5c5f8786574522e83242e5981482d63c9ac7101", "amount": "10000000000" } ] } } } ``` -------------------------------- ### ZIL Balance Response Example Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/zil-balance.md This is an example JSON response when querying for a wallet's native ZIL balance. It includes details such as the token address (native ZIL), the queried wallet address, the last block ID processed, and the balance amount. ```json { "data": { "getUserBalanceByToken": { "tokenAddress": "0x0000000000000000000000000000000000000000", "walletAddress": "0x22b251cc155ac0a181a156aaec74e964a82011c1", "lastBlockID": "2513226", "amount": "2226027441580000" } } } ``` -------------------------------- ### Navigate to Developer Portal Directory Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Changes the current directory to the zilliqa-developer repository's developer-portal product folder. This is a prerequisite for configuring local development environments. ```sh cd ./products/developer-portal ``` -------------------------------- ### Plan and Apply Staging Deployment Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Executes 'z plan' to preview the changes and 'z apply' to apply the planned changes for the staging deployment. These commands ensure that the configuration updates are processed correctly. ```sh z plan z apply ``` -------------------------------- ### Example Response for ZRC2 Token Details Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/zrc2-contract-details.md This is an example JSON response detailing a ZRC-2 token. It includes the contract address, token name ('Wrapped ZIL Token'), symbol ('wZIL'), initial supply, total supply, standard ('ZRC2'), decimals (12), owner's address, and the contract type ('ASSET_CONTRACT'). ```json { "data": { "getTokenDetail": { "contractAddress": "0x98a71b463a33bbff650d123bf04f1f32d1c8b508", "tokenName": "Wrapped ZIL Token", "tokenSymbol": "wZIL", "init_supply": "0", "totalSupply": "41166677135704200", "standard": "ZRC2", "decimals": "12", "ownerAddress": "0x7E30D1c942282784630EBfedba1FFbDE3647f472", "type": "ASSET_CONTRACT" } } } ``` -------------------------------- ### Clone Devops Repository Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Clones the Zilliqa devops repository from GitHub. This repository contains the necessary configurations and scripts for deploying applications to staging and production environments. ```sh git clone https://github.com/Zilliqa/devops.git ``` -------------------------------- ### Get Brand Collectible Details (GraphQL) Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/marketplace-brand-collectible-details.md Fetches the details of a specific brand collectible NFT by its contract address and token ID. Requires an authorization token. ```graphql query BrandsAssetById($input: AssetInput) { getBrandCollectibleByAssetId(input: $input) { collectionId createdAt collectionContract tokenId tokenAddress status } } ``` ```graphql { "input": { "contractAddress": "0x084acc6bbbaeb09a6e276a426508765e53bf2459", "tokenId": "8" } } ``` ```graphql { "Authorization": "Bearer <insert token>" } ``` -------------------------------- ### Deploy ZRC-2 Fungible Token Contract on Zilliqa Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/zilliqa/introduction-videos.md This tutorial guides users through deploying a ZRC-2 compliant fungible token contract on the Zilliqa blockchain using the Zilliqa IDE, requiring no prior programming knowledge. It includes links to the ZRC-2 standard and reference contract code. ```Scilla https://github.com/Zilliqa/ZRC/blob/main/reference-contracts/FungibleToken.scilla ``` -------------------------------- ### Login to Google Cloud Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Logs into the Google Cloud platform using the 'z' tool. This is a necessary step before deploying applications to cloud-based environments managed by Google Cloud. ```sh z login ``` -------------------------------- ### Example English Auction Response (JSON) Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/ecosystem/indexer/marketplace-english-auction.md A sample JSON response detailing an English Auction listing, including bid information, maker addresses, and marketplace contract address. ```JSON { "data": { "asset": { "listingData": [ { "sourceId": "zilliqamarketplace", "data": { "ZILLIQA_ENGLISH_AUCTION": { "startingBid": { "unit": "QA", "amount": 100000000000000, "currency": "ZIL" }, "winnerBid": null, "bids": [ { "maker": "0x7be89f308ea48148d4f3539afe2dddaa03b807ae", "unit": "QA", "amount": 200000000000000, "dest": "0x7be89f308ea48148d4f3539afe2dddaa03b807ae" } ], "maker": "0x22b251cc155ac0a181a156aaec74e964a82011c1", "marketplaceContractAddress": "0x35694bf3eeb91274ec54651c035a027c616f3b77" }, "fulfilled": [] } } ] } } } ``` -------------------------------- ### Configure Checkpoints in TOML File Source: https://github.com/zilliqa/dev-portal/blob/main/zq2/docs/nodes/checkpoints/index.md These TOML configuration lines enable checkpoint loading for Zilliqa nodes. The 'file' parameter should be the checkpoint file name, and 'hash' should be the corresponding block hash. ```toml [nodes.load_checkpoint] file = "xxxxx..." # File name of the checkpoint block. for eg: 3000.dat hash = "xxxxx..." # Block hash corresponding to the file block (Remove '0x' prefix from hash if present) ``` -------------------------------- ### Build and Push Docker Image Source: https://github.com/zilliqa/dev-portal/blob/main/DEPLOY.md Builds and pushes the Docker image for the application. This command is part of the deployment pipeline, preparing the application image for deployment. ```sh make image/build-and-push ```