Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jasper Documentation V1 #22

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Binary file added zq2/docs/assets/plunderswap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 33 additions & 27 deletions zq2/docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
---

id: changes
title: Changelog and transition plan
title: What's new in Zilliqa 2.0
---

# Zilliqa 2.0 changes and transition plan
# What's new in Zilliqa 2.0

Zilliqa 2.0 is designed as an entirely new protocol which will be backwards-compatible with Zilliqa 1.0, the original version of Zilliqa currently in production. When ready, the state and all accounts on the current production mainnet will seamlessly be migrated to Zilliqa 2.0.
</br> </br>
__There are a number of differences between Zilliqa 1.0 and Zilliqa 2.0:__

- Zilliqa 2.0 uses Proof-of-Stake based on Pipelined Fast-Hotstuff as a consensus algorithm. Mining is no longer necessary.

- There are no DS epochs, no long delay at TX block 99, and the transaction pool is no longer cleared at the start of an epoch.

- Zilliqa 2.0 has much fewer nodes and is thus far cheaper to run than Zilliqa 1.0 - a typical Zilliqa 2.0 mainnet can be operated efficiently and securely by 32 validator nodes.

- Zilliqa 2.0 has a much faster block time; dApps will need to make sure that where they use block number as a proxy for a timestamp, they allow sufficient blocks for users to react.

- In Zilliqa 1.0, account balances are stored in Qa and scaled up by 1,000,000 to report Wei; in Zilliqa 2.0, they are stored in Wei and scaled down by 1,000,000 to report Qa in non-EVM APIs.

- Zilliqa 2.0 upgrades are seamless and deployed relatively quickly without the requirement to redownload persistence. This will help eliminate upgrade downtime and accommodate more frequent bug fixes.
</br> </br>


## Changes
__There are also things that have not changed:__

There are a number of differences between Zilliqa 1.0 and Zilliqa 2.0 that you should be aware of:
- Zilliqa 2.0 will be compatible with all the same dApps, tokens and sites as Zilliqa 1.0 (EVM -> Scilla contract interoperability is currently unavailable on proto-testnet but will be reintroduced in an upgrade soon).

- Zilliqa 2.0 uses proof of stake based Fast-Hotstuff as a consensus algorithm. Mining is no longer necessary.
- Zilliqa 2.0 has many fewer nodes, and is thus far cheaper to run, than Zilliqa 1.0 - a typical Zilliqa 2.0 mainnet can run comfortably in 32 nodes.
- Zilliqa 2.0 has a much faster block time (there is typically a hardwired minimum of 1s/block); dApp operators will need to make sure that where they use block number as a proxy for a timestamp, they allow sufficient blocks for users to react.
- Zilliqa 2 upgrades are seamless and relatively quick; you don't need to redownload persistence and there is an auto-upgrader you can run if you wish which will run the newer version of zq2 and cut over when ready. We hope this will enable us to eliminate upgrade downtime and to make more frequent bug fixes.
- A non-EVM native token transfer uses 50 gas; an EVM transfer uses 21000 gas. To make both cost the same amount of ZIL we divide EVM gas costs by 420 (== 21000/50). That is why EVM transactions require a minimum gas price of 4761.9048 Gwei.

## API differences
- Non-EVM addresses are derived from the SHA256 of the public key, giving a base16 hex string, e.g. 0x70b16b656fc1759193366dab9a56bee486feffda, which is then conventionally expressed in bech32 form zil1wzckket0c96eryekdk4e5447ujr0al76fd6ax4

- There are no DS epochs any longer (though some are faked to allow
existing applications that retrieve the current DS epoch to work),
so the transaction pool is no longer cleared wat the start of a DS
epoch.
- `GetTransactionStatus` no longer depends on an off-chain transaction
store, and therefore now works for any transaction.
- EVM addresses are derived from the Keccak256 of the public key, giving a base16 hex string, possibly with a checksum embedded in the capitalisation, e.g. 0xB85fF091342e2e7a7461238796d5224fA81ca556.

## Continuity
- Though both EVM and non-EVM transactions use the secp256k1 curve, non-EVM transactions use Schnorr signatures, whilst EVM transactions use ECDSA.

There are also a number of things that have not changed:
### Converting address formats and transferring between wallets

- Zilliqa 2.0 is (or should be!) compatible with all the same dApps, tokens and sites as Zilliqa 1.
EVM DEX Plunderswap offers a free tool that allows you to easily transfer ZIL from a non-EVM Zilliqa wallet to an EVM wallet, and vice versa.

## Transition plan
Plunderswap's EVM Token Transfer tool is [available here](https://plunderswap.com/transfer).</br>

Zilliqa 2.0 will being by running a prototype devnet. This is an empty developer test network that you can use to try out your code.
You can also use the tool below to swap addresses between base16 and bech32 formats. </br>
*Note this does not produce an EVM address.*

There will then be:
<input length=40 id="address" class="disp-input" /> [:octicons-arrow-switch-24:](#){.hexconverter} [:octicons-copy-24:](#){.hexcopy}

- A `prototestnet` network - this periodically (once every few days) imports existing Zilliqa 1 testnet persistence and starts a network on it; this allows you to test against existing testnet persistence.
- A `protomainnet` network - which does the same with mainnet persistence.
- Existing SSNs will be invited to become validators on the Zilliqa 2 network (bringing their delegated stake with them). We'll contact you individually about this.
- We will then cut `testnet` over to Zilliqa 2
- Then `mainnet`

Note that the `proto` networks will have different chain IDs to the networks they import their state from; this is necessary to avoid replay attacks, but means that you will find the chain ids of old transactions are not the same as the chain ids for new ones.
10 changes: 0 additions & 10 deletions zq2/docs/ecosystem/nodes.md

This file was deleted.

42 changes: 27 additions & 15 deletions zq2/docs/endpoints.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
---
id: endpoints
title: API endpoints
hide:
- toc
title: Endpoints, Block Explorer and Faucet
keywords:
- api
- introduction
- endpoints
description: Zilliqa API Endpoints
description: Endpoints, Block Explorer and Faucet
---

# Endpoints
# Endpoints, Block Explorer and Faucet

Chain ids can be found at [chainlist](https://chainlist.org/?search=zilliqa&testnets=true).
As we introduce additional test networks for Zilliqa 2.0, their public RPC node URLs and chain IDs will be published on [ChainList](https://chainlist.org/?search=zilliqa&testnets=true) alongside existing chain information for Zilliqa 1.0.

Uptime can be found at [status.zilliqa.com](https://status.zilliqa.com) and you can get API examples from the [api](/api) pages.
## Networks
Details for the current network versions of Zilliqa 2.0 are listed below.

We have several blockchains running.
<div class="table" markdown>
| Name | Version | ChainId | API | Otterscan | Faucet |
| ------ | ------- | ------- | --- | --------- | ------ |
| proto-testnet | xx | xx | xx | xx | xx | xx | xx |
</div>

## devnet
*__Note__ that this is currently a proto-testnet version of Zilliqa 2.0 designed primarily for testing purposes, and therefore its state and uptime are not guaranteed*

Devnet is a general purpose developer network, synchronised to the latest (or nearly the latest) commit from [https://github.com/zilliqa/zq2](https://github.com/zilliqa/zq2) . Its state and uptime are not guaranteed, but it is useful for checking your contracts against the latest and greatest software versions.
## Block Explorer

<div class="center-table" markdown>
| Name | Version | ChainId | API | Otterscan | Faucet | Connect | Notes |
| ------ | ------- | ------- | --- | --------- | ------ | ------- | ----- |
| devnet | <span id="devnet_vsn" class="zq2_vsn">api.zq2-devnet.zilliqa.com</span> | [33469](https://chainlist.org/chain/33469) | https://api.zq2-devnet.zilliqa.com | https://explorer.zq2-devnet.zilliqa.com | https://faucet.zq2-devnet.zilliqa.com/ | <a href="javascript:connectZilliqaChain('https://api.zq2-devnet.zilliqa.com', '0x82BD', 'Zilliqa 2 EVM Devnet', 'https://explorer.zq2-devnet.zilliqa.com', 'Zilliqa 2 testnet', 'ZIL')">Metamask</a> | <span class="zq2_docs_devnet_vsn" kind="api">&nbsp;</span> |
rrw-zilliqa marked this conversation as resolved.
Show resolved Hide resolved
</div>
The current version of Zilliqa 2.0 is compatible with the Otterscan block explorer and does not support Devex.

The block explorer for the Zilliqa 2.0 proto-testnet is [available here](https://explorer.zq2-prototestnet.zilliqa.com/).


## Faucet
The faucet sends an amount of 100 ZIL to the supplied address for use in testing the network.

Enter the hex address of your compatible EVM wallet into the field below to receive 100 ZIL on the Zilliqa 2.0 proto-testnet:
``` py title="Receive 100 ZIL on the Zilliqa 2.0 proto-testnet"
[EMBED Faucet]
```

*If you are unable to use the tool above, you can also [access the faucet here](https://faucet.devnet.zilliqa.com).*
37 changes: 1 addition & 36 deletions zq2/docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,4 @@
hide:
- title
---

# Zilliqa Developer Portal

This is the developer documentation for [Zilliqa](https://www.zilliqa.com/) 2.0, a fast-finality scalable blockchain.

You can read the white paper and get an overview of Zilliqa 2.0 and how it works from TODO.

Zilliqa supports both an EVM compatible execution layer and a custom execution layer based on the [Scilla](https://scilla.readthdocs.io/latest) smart contract language. Standards for the blockchain itself are recorded in [Zilliqa Improvement Proposals](https://github.com/zilliqa/zip) and for Scilla smart contracts, in [Zilliqa Reference Contracts](https://github.com/zilliqa/zrc). Chain governance can be discussed on [the governance forum](https://gov.zilliqa.com) and votes are held on [snapshot](https://governance.zilliqa.com), and staking information can be obtained from [zillion](https://stake.zilliqa.com).

You can find out more about how EVM and Scilla [interoperate](/interop.md).

Zilliqa supports most standard EVM development tools and wallets, including [metamask](https://metamask.io).

**_NB: The current production version of Zilliqa is Zilliqa 1 - you can find documentation on Zilliqa 1 at [https://dev.zilliqa.com](https://dev.zilliqa.com)_**

Here, you will find information about:

- A list of [Endpoints](endpoints.md) and block explorers.
- A [Developer FAQ](faq.md).
- [What's Changed and transition plans](changes.md) since Zilliqa 1.0
- The Zilliqa 2.0 blockchain
- Supported APIs (see the sidebar)
- Information about the [SDKs and software](sdk.md) and [Ecosystem](ecosystem/ecosystem.md) available.
- How to run a [node](running/node.md) and become a [validator](running/validator.md), or run your own [network](running/network.md)

Coming soon:

- Tutorials on how to use Zilliqa 2.0's new features (inter-chain messaging, X-Shards, Account Abstraction, the Native ERC-20)
- Scilla, our smart contract language
- On-chain artefacts and dApps you may find useful
- ZRC-2 Tokens and ERC-20 wrappers for them.
- DEXes and Bridges and examples of how to use them in programs.
- The Ionise money market.
- A (command-line only) Gnosis-derived multisig
- Price Oracles
- The ENS root
-
47 changes: 38 additions & 9 deletions zq2/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
---
hide:
- title
- toc
---

# Zilliqa 2 Developer Portal
# Zilliqa 2.0 Developer Documentation

*Looking for Zilliqa 1 documentation? You can find it at [https://dev.zilliqa.com/zilliqa1/](/zilliqa1/)*
Welcome to the developer documentation for Zilliqa 2.0, a fast-finality, scalable blockchain protocol. Zilliqa 2.0 features a native EVM execution layer, supporting standard EVM development tools and wallets while also retaining a custom execution layer based on the [Scilla](https://scilla.readthdocs.io/latest) smart contract language.

You can find an overview at [home](home) or select a page from the menu at the left of this page.
__For an overview__ of the features and capabilities introduced in Zilliqa 2.0, please visit the [roadmap website](https://roadmap.zilliqa.com/), where you can also find a list of development milestones.

Useful tools:
__To learn more__ about the design of the Zilliqa 2.0 protocol, [read the whitepaper](https://drive.google.com/file/d/1XqSySl0w_OtxyxBZ0ahS06cqIv-vd10M/view).

- Plunderswap's [transfer from Zil to EVM wallet or back](https://plunderswap.com/transfer)
- Swap addresses between hex and bech32 (note: this does _not_ produce an EVM address) <input length=40 id="address" class="disp-input" /> [:octicons-arrow-switch-24:](#){.hexconverter} [:octicons-copy-24:](#){.hexcopy}
__At the current stage__ of Zilliqa 2.0 development, the core protocol is available to test via the Jasper proto-testnet.

## Latest News
__The proto-testnet__ exists as the first implementation of the Zilliqa 2.0 consensus mechanism, which comprises Proof-of-Stake validator selection paired with Pipelined Fast-HotStuff for fast and efficient transaction processing.

### 2024-04-04: New documentation site
Here you will find documentation related to the current implementation of Zilliqa 2.0, including:

<div class="grid cards" markdown>

- __What's new in Zilliqa 2.0__

[:octicons-arrow-right-24: Read More](/zilliqa2/changes/)


- __URLs of RPC endpoint, faucet and block explorer__

[:octicons-arrow-right-24: Read More](/zilliqa2/endpoints/)

- __How to run a node and become a validator__

[:octicons-arrow-right-24: Read More](/zilliqa2/nodes/)

- __Development tools, SDKs, and Git repositories__

[:octicons-arrow-right-24: Read More](/zilliqa2/sdk/)

- __Supported APIs__

[:octicons-arrow-right-24: Read More](/zilliqa2/support/)

</div>

More documentation for Zilliqa 2.0 will become available as new functionality is rolled out to the protocol and its capabilities are expanded.

*__Note:__ This documentation refers to Zilliqa 2.0. Documentation for the current production version of Zilliqa is available at
[https://dev.zilliqa.com/zilliqa1/](/zilliqa1/)*

Hopefully this is a little easier to navigate than the previous developer site.
29 changes: 29 additions & 0 deletions zq2/docs/nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
id: nodes
title: Nodes and Validators
---

# Nodes and Validators

The current proto-testnet version of Zilliqa 2.0 allows users to setup a node and join the network.

### Running a Node

``` py
[INSERT GUIDE HERE]
```


### Becoming a Validator
Under the consensus mechanism introduced in Zilliqa 2.0, validators stake ZIL to secure the network, in return for which they receive a share of block rewards.

While becoming a validator on the Zilliqa 2.0 mainnet will be permissionless, on the current proto-testnet you need to request the minimum required stake of 10 million ZIL in order for you to register as a validator.

To register as a validator on the Jasper proto-testnet, please complete and submit this form.


Below is a guide on how to register a validator node for Zilliqa 2.0:

``` py
[INSERT GUIDE HERE]
```
59 changes: 25 additions & 34 deletions zq2/docs/sdk.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,44 @@
---
id: sdk
title: Zilliqa SDKs
title: Tools and repositories
---

# Zilliqa SDKs, repositories, and tools
# Tools and repositories

Note that a list of useful on-chain facilities (contracts, etc.) can be found via the [ecosystem](ecosystem/ecosystem.md) pages.
Below is a list of useful tools for use with the Zilliqa 2.0 proto-testnet:

## Zilliqa SDKs
### EVM Development Environments
Zilliqa 2.0 features an EVM execution layer and can therefore be used with standard EVM tools and frameworks.</br>
These include popular IDEs such as VSCode, Remix, and many others.

We provide native SDKs for:

- [Rust](https://crates.io/crates/zilliqa-rs)
- [Golang](https://github.com/Zilliqa/gozilliqa-sdk)
- [Java](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/laksaj)
- [Javascript/typescript](https://www.npmjs.com/package/@zilliqa-js/zilliqa)
- [Python](https://github.com/zilliqa/pyzil)

## Scilla tools
### Neo Savant 2.0
The Neo Savant 2.0 IDE is an upgraded version of the original online IDE for creating and deploying Scilla contracts. This version adds a host of new features, including multi-tab text editing and the ability to read contract states.

We provide various tools and information about Scilla:
Neo Savant 2.0 can be accessed at https://ide.zilliqa.com/

- [Scilla documentation](https://scilla.readthedocs.org/latest/) and a [tutorial](https://learnscilla.com).
- [Neo-Savant](https://ide.zilliqa.com/) - a GUI for writing Scilla
- You can deploy and test Scilla contracts via hardhat using the [Scilla hardhat plugin](https://github.com/Zilliqa/hardhat-scilla-plugin)

## EVM libraries
### SDKs and other tools

We provide local forks of:
Zilliqa 2.0 continues providing native SDKs for:

- [ethers.js](https://github.com/Zilliqa/ethers.js) - because ethers has recently started strictly enforcing canonical signatures and, of course, the signatures on native Zilliqa transactions (being Schnorr signatures) cannot be canonical.
- [otterscan](https://github.com/Zilliqa/otterscan) - to add the ability to understand Zilliqa native transactions.

## Sample contracts
- [Rust](https://crates.io/crates/zilliqa-rs)
- [Golang](https://github.com/Zilliqa/gozilliqa-sdk)
- [Java](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/laksaj)
- [Javascript/typescript](https://www.npmjs.com/package/@zilliqa-js/zilliqa)
- [Python](https://github.com/zilliqa/pyzil)

- [ZRC](https://github.com/Zilliqa/zrc) contains reference contracts and standards for Zilliqa native contracts.
- [zilliqa-developer/contracts](https://github.com/Zilliqa/zilliqa-developer/tree/main/contracts) contains more extensive/complex contracts.
We also continue to maintain tools such as:

In particular, `zilliqa-developer` contains contracts for vesting and burning tokens, and for generating contracts that expose native Zilliqa functionality to EVM (eg. for generating an ERC-20 compatible token contract that manipulates an underlying ZRC-2 asset).
- [Scilla hardhat plugin](https://github.com/Zilliqa/hardhat-scilla-plugin) - to support deploying and testing Scilla contracts
- [ethers.js fork](https://github.com/Zilliqa/ethers.js) - to support the non-canonical signatures of non-EVM Zilliqa transactions (Schnorr signatures)
- [otterscan fork](https://github.com/Zilliqa/otterscan) - to add the ability to understand non-EVM (Scilla) transactions

## Zilliqa source

We provide a number of repositories as open source:
### Open-source repositories
We provide a number of open-source repositories relevant to Zilliqa 2.0:

- [zq2](https://github.com/Zilliqa/zq2) - the Zilliqa 2 source code itself.
- [zilliqa-developer](https://github.com/Zilliqa/zilliqa-developer) - this contains source for, among other things
- [eth-spout](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/eth-spout) a simple faucet.
- [xbridge](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/bridge) a cross-chain contract bridge.
- [multisig](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/multisig) - a scilla multisig implementation
- [neo-savant](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/neo-savant) - the Scilla IDE
- [pdt](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/pdt) - a utility which turns the state of the blockchain into a BigQuery dataset or PostgreSQL database.
- [developer-portal-zq2](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/developer-portal-zq2) - this developer portal
- [eth-spout](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/eth-spout) - a simple faucet.
- [neo-savant](https://github.com/Zilliqa/zilliqa-developer/tree/main/products/neo-savant) - the Scilla IDE
- [developer-portal-zq2](#) - this developer portal
rrw-zilliqa marked this conversation as resolved.
Show resolved Hide resolved
Loading