From 9b87b01fff6cd1a055924f5e20d3295f96b2fd97 Mon Sep 17 00:00:00 2001 From: chan Date: Tue, 18 Jul 2023 20:37:44 +0800 Subject: [PATCH] feat: manta pacific testnet doc --- docs/introduction/Manta-Pacific.md | 4 +- docs/manta-pacific/Block Explorer.md | 9 + docs/manta-pacific/EVM Compatible.md | 6 + docs/manta-pacific/Faucet.md | 3 + docs/manta-pacific/JSON-RPC Nodes.md | 2 + docs/manta-pacific/Testnet Info.md | 7 + .../Circuits/01-ContractInterface.md | 282 ++++++++++++++++++ docs/zkShuffle/Circuits/02-TypescriptSDK.md | 117 ++++++++ docs/zkShuffle/Circuits/03-Tutorial.md | 182 +++++++++++ docs/zkShuffle/Deploy/01-Overview.md | 10 + docs/zkShuffle/Deploy/02-Hardhat.md | 118 ++++++++ docs/zkShuffle/Deploy/03-Foundry.md | 70 +++++ docs/zkShuffle/Deploy/04-Remix.md | 38 +++ docs/zkShuffle/Deploy/05-Ethers.js.md | 44 +++ docs/zkShuffle/Deploy/06-Web3.js.md | 22 ++ .../Deploy/07-ChainSafe Gaming SDK.md | 23 ++ docs/zkShuffle/Deploy/08-wagmi.md | 27 ++ docs/zkShuffle/Overview.md | 28 ++ docs/zkShuffle/Testnet-Quickstart.md | 22 ++ sidebars.js | 127 ++++---- 20 files changed, 1075 insertions(+), 66 deletions(-) create mode 100644 docs/manta-pacific/Block Explorer.md create mode 100644 docs/manta-pacific/EVM Compatible.md create mode 100644 docs/manta-pacific/Faucet.md create mode 100644 docs/manta-pacific/JSON-RPC Nodes.md create mode 100644 docs/manta-pacific/Testnet Info.md create mode 100644 docs/zkShuffle/Circuits/01-ContractInterface.md create mode 100644 docs/zkShuffle/Circuits/02-TypescriptSDK.md create mode 100644 docs/zkShuffle/Circuits/03-Tutorial.md create mode 100644 docs/zkShuffle/Deploy/01-Overview.md create mode 100644 docs/zkShuffle/Deploy/02-Hardhat.md create mode 100644 docs/zkShuffle/Deploy/03-Foundry.md create mode 100644 docs/zkShuffle/Deploy/04-Remix.md create mode 100644 docs/zkShuffle/Deploy/05-Ethers.js.md create mode 100644 docs/zkShuffle/Deploy/06-Web3.js.md create mode 100644 docs/zkShuffle/Deploy/07-ChainSafe Gaming SDK.md create mode 100644 docs/zkShuffle/Deploy/08-wagmi.md create mode 100644 docs/zkShuffle/Overview.md create mode 100644 docs/zkShuffle/Testnet-Quickstart.md diff --git a/docs/introduction/Manta-Pacific.md b/docs/introduction/Manta-Pacific.md index fffcb6b9..15721b90 100644 --- a/docs/introduction/Manta-Pacific.md +++ b/docs/introduction/Manta-Pacific.md @@ -12,7 +12,7 @@ Manta Pacific takes all of the work that the Manta team has already built on ZK, # How Does Manta Pacific Work? -Manta Pacific is launched in the joint vision with Celestia and Optimism. By leveraging the data-availability layer provided by Celestia, the first modular consensus and data network, harnessing the advanced technology developed by p0x labs, and partnering with leading RaaS company Caldera, Manta Pacific build out an accessible ZK development environment in a modular, scalable manner with multiple groundbreaking advantages: +Manta Pacific is launched in the joint vision with Celestia and Optimism. By leveraging the data-availability layer provided by Celestia, the first modular consensus and data network, harnessing the advanced technology developed by p0x labs, and partnering with leading RaaS company Manta Pacific, Manta Pacific build out an accessible ZK development environment in a modular, scalable manner with multiple groundbreaking advantages: ## 1. Significantly lower gas fee than any other ZK layer @@ -20,7 +20,7 @@ Manta Pacific’s modular stack provides unparalleled scalability for future zkA Manta Pacific uses Celestia as the data availability (DA) layer. Celestia uses the state of art data availability sampling - a 2-D Reed-Solomon encoding and Namespaced Merkle Tree (NMTs) - to solve the data availability problem of L2s in a trust-minimized way. Manta Pacific, which uses Celestia as the DA layer, can dramatically reduce the data portion of transaction costs on the network for the end users. -Manta Pacific uses Caldera’s customized OP Stack Rollup solution as the execution layer. OP Stack has already been adopted by top projects for rollup solutions including Coinbase, a16z and Worldcoin. As the de-facto standard of L2 scaling, especially with the recent launch of Bedrock, OP Stack offers the best interoperability, engineering maturity, and long-term ecosystem outlook. In addition to scaling the computation using OP Stack, we leverage Caldera’s stateful precompiles to further reduce the computation cost of zero-knowledge proof verification-related costs. +Manta Pacific uses Manta Pacific’s customized OP Stack Rollup solution as the execution layer. OP Stack has already been adopted by top projects for rollup solutions including Coinbase, a16z and Worldcoin. As the de-facto standard of L2 scaling, especially with the recent launch of Bedrock, OP Stack offers the best interoperability, engineering maturity, and long-term ecosystem outlook. In addition to scaling the computation using OP Stack, we leverage Caldera’s stateful precompiles to further reduce the computation cost of zero-knowledge proof verification-related costs. ## 2. EVM + Manta’s universal circuit rather than new language for wide ZK applications adoption Manta Atlantic deployed the first generation of Universal Circuits for the web3 industry, which offered support for various zkAssets including both fungible tokens and NFTs. Through Universal Circuits on Manta Atlantic, developers only need to use high level APIs to access programmable zkAsset. diff --git a/docs/manta-pacific/Block Explorer.md b/docs/manta-pacific/Block Explorer.md new file mode 100644 index 00000000..d97034f0 --- /dev/null +++ b/docs/manta-pacific/Block Explorer.md @@ -0,0 +1,9 @@ +Manta Pacific Chain comes equipped with a user-friendly block explorer that allows for easy viewing of important information such as: +- Address balances +- Transaction history +- Verified contracts +- Smart contract code and execution +- Network statistics +- Mining information + +It provides a valuable tool for anyone looking to better understand and interact with a blockchain, it provides transparency and accessibility to the inner workings of a blockchain, and it can be used for a variety of purposes such as tracking transactions, monitoring smart contract execution, and analyzing network activity. \ No newline at end of file diff --git a/docs/manta-pacific/EVM Compatible.md b/docs/manta-pacific/EVM Compatible.md new file mode 100644 index 00000000..e7205367 --- /dev/null +++ b/docs/manta-pacific/EVM Compatible.md @@ -0,0 +1,6 @@ +Manta Pacific chain is fully compatible with the Ethereum Virtual Machine, allowing them to run standard Ethereum smart contract code without modification or recompilation. This compatibility means that Manta Pacific work seamlessly with a wide range of existing Ethereum tooling, including: +- General-purpose libraries like Ethers.js and Web3.js +- Developer tools like Hardhat and Foundry +- Popular wallets like Metamask + +This makes it easy for developers to build and deploy smart contracts, using the same tools and techniques they are already familiar with. Additionally, this compatibility ensures that existing Ethereum-based dApps can be easily ported to Manta Pacific with minimal modifications, providing a wide range of use cases and opportunities for developers to create new decentralized applications. diff --git a/docs/manta-pacific/Faucet.md b/docs/manta-pacific/Faucet.md new file mode 100644 index 00000000..299bc13f --- /dev/null +++ b/docs/manta-pacific/Faucet.md @@ -0,0 +1,3 @@ +Manta Pacific chains include a built-in crypto faucet that allows users to easily acquire and test the native cryptocurrency of the chain. This feature is designed to make it easy for developers, testers, and new users to obtain small amounts of cryptocurrency and use it to explore the functionality and features of the blockchain. +The faucet feature is typically configured to dispense small amounts of cryptocurrency to users who request it, allowing them to test the functionality of the chain without having to make a purchase. +The crypto faucet feature is a valuable tool for developers who are building applications on top of the chain, as it allows them to test their applications with real cryptocurrency without incurring any financial risk. Additionally, it is a great way for new users to get started with the blockchain and familiarize themselves with its features and functionality. \ No newline at end of file diff --git a/docs/manta-pacific/JSON-RPC Nodes.md b/docs/manta-pacific/JSON-RPC Nodes.md new file mode 100644 index 00000000..e4182bc8 --- /dev/null +++ b/docs/manta-pacific/JSON-RPC Nodes.md @@ -0,0 +1,2 @@ +Manta Pacific provide a JSON-RPC interface that allows developers and users to interact with the blockchain and perform various actions, such as sending transactions, querying account balances, and more. The nodes in the chain are designed to serve JSON-RPC requests over both HTTP(S) and Websockets, providing a flexible and convenient way to interact with the blockchain. The behavior of the JSON-RPC interface is defined by the Ethereum JSON-RPC specification, providing a standard and familiar interface for developers to work with. +One of the key advantages of this JSON-RPC compatibility is that it provides compatibility with existing client libraries, such as Ethers.js, Web3.js, Web3.py and go's web3 library. These libraries are widely used in the Ethereum ecosystem and provide developers with a convenient way to interact with the blockchain using familiar and well-documented APIs. This compatibility ensures that developers can easily build and deploy decentralized applications on Manta Pacific using the same tools and techniques they are already familiar with. \ No newline at end of file diff --git a/docs/manta-pacific/Testnet Info.md b/docs/manta-pacific/Testnet Info.md new file mode 100644 index 00000000..9b417793 --- /dev/null +++ b/docs/manta-pacific/Testnet Info.md @@ -0,0 +1,7 @@ +You can deploy your application onto a Manta Pacific Chain via the same means as any Ethereum-compatible blockchain. + +- RPC URL : https://manta-testnet.calderachain.xyz/http +- Websocket URL : wss://manta-testnet.calderachain.xyz/ws +- Chain ID : 3441005 + +[More Testnet Information](https://pacific.manta.network/) \ No newline at end of file diff --git a/docs/zkShuffle/Circuits/01-ContractInterface.md b/docs/zkShuffle/Circuits/01-ContractInterface.md new file mode 100644 index 00000000..fb95eb8b --- /dev/null +++ b/docs/zkShuffle/Circuits/01-ContractInterface.md @@ -0,0 +1,282 @@ +--- +title: 'Contract Interface' +description: 'zkShuffle Contract desc' +--- + + +# Overview + +zkShuffle Contracts provide two contract interfaces to help developers build their own card games: +- [IShuffleStateManager](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/IShuffleStateManager.sol): The manager of shuffle state machine, which creates and registers shuffle state, deals and opens cards. +- [IBaseGame](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/IBaseGame.sol): Developers need to inherit this interface when writing their own game contracts. + + +# IShuffleStateManager + +### createShuffleGame + +```function createShuffleGame(uint8 numPlayers) external returns (uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L161-L163) + +Creates a new game and returns the game ID of the newly created game. +This could only be called by game contract. + +**Parameters:** +- ```numPlayers```: The number of players. + +**Return:** +- ```gameId```: The created shuffle game ID. + +**Example:** +```solidity +pragma solidity >=0.8.2 <0.9.0; +import "IBaseGame.sol"; +import "IShuffleStateManager.sol"; +contract Game is IBaseGame { + IShuffleStateManager public shuffle; + constructor(IShuffleStateManager _shuffle) { + shuffle = _shuffle; + } + function createGame() external { + uint256 shuffleId = shuffle.createShuffleGame(2); + ... + } + ... +} +``` + +### register + +```function register(uint256 gameId, bytes calldata next) external```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L210-L217) + +Enters the register state, which can only be called by the game owner. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```next```: The calldata that contains the function signature and parameters, and it will be executed in the next invocation. + +> **Note:** The ```gameId``` parameter in all the interfaces corresponds to the return value of the ```createShuffleGame``` function. + +> **Note:** ```register``` only initiate the registration phase so that players can register, it doesn't actually perform the registration. + +### playerRegister + +```function playerRegister(uint256 gameId, address signingAddr, uint256 pkX, uint256 pkY) external returns (uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L228-L233) + +Performs the registration for a certain player, which can be called by game contract or directly called by user. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```signingAddr```: The signing address of the player, usually it's player's metamask address. +- ```pkX```: The X-coordinate of the public key generated by BabyJub curve. It can be generated by SDK +- ```pkY```: The Y-coordinate of the public key generated by BabyJub curve. It can be generated by SDK + +**Return:** +- ```pid```: The player index in the game. + +> **Note:** If you don't have special needs, it's better to use SDK to do the registering. + +**Example:** +```solidity +pragma solidity >=0.8.2 <0.9.0; +import "IBaseGame.sol"; +import "IShuffleStateManager.sol"; +contract Game is IBaseGame { + IShuffleStateManager public shuffle; + uint256 public shuffleId; + constructor(IShuffleStateManager _shuffle) { + shuffle = _shuffle; + } + function createGame() external { + shuffleId = shuffle.createShuffleGame(2); + } + function registerGame(uint256 pkX, uint256 pkY) external { + bytes memory next = abi.encodeWithSelector( + this.dummy.selector + ); + shuffle.register(shuffleId, next); + uint256 playerIdx = shuffle.playerRegister( + shuffleId, + msg.sender, + pkX, + pkY + ); + ... + } + function dummy() external { + ... + } + ... +} +``` + +### shuffle + +```function shuffle(uint256 gameId, bytes calldata next) external```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L280-L283) + +Initiates the shuffle phase, which can only be called by game contract. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```next```: The calldata that will be executed in the next invocation. + +> **Note:** ```shuffle``` only initiate the shuffle phase so that players can shuffle, it doesn't actually perform the shuffle. + +### dealCardsTo + +```function shuffle(uint256 gameId, BitMaps.BitMap256 memory cards, uint256 playerId, bytes calldata next) external```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L332-L337) + +Specifies a set of cards to be dealed to a players, which can only be called by game contract. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```cards```: The cards to deal. +- ```playerId```: The player index in the shuffle game. +- ```next```: The calldata that will be executed in the next invocation. + +> **Note:** ```dealCardsTo``` only initiate the dealing phase so that players can deal, it doesn't actually perform the dealing. + +> **Note:** ```cards``` is represented in bitMap. For example: if the data of ```cards``` is 28, it corresponds to the binary representation 11100. This means that the cards with indexes [2, 3, 4] need to be dealt. + +### openCards + +```function openCards(uint256 gameId, uint256 playerId, uint8 openningNum, bytes calldata next) external```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L477-L482) + +Specifies a player to open a number of cards, which can only be called by game contract. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```playerId```: The player index in the shuffle game. +- ```openningNum```: The number of cards that the player wants to open. +- ```next```: The calldata that will be executed in the next invocation. + +```register``` ```shuffle``` ```dealCardsTo``` ```openCards```, these four functions all specify ```next``` as the next operation to be executed, but their execution timing is different. +| function | when ```next``` will be called | +|:--------|:--------| +| register | after all the players have registered | +| shuffle | after all the players have shuffled the deck | +| dealCardsTo | after all the players except for the one with the ```playerId``` have dealt cards | +| openCards | after each player has opened cards | + +### endGame + +```function openCards(uint256 gameId) external```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L547-L548) + +Ends the game, which can only be called by game contract. + +**Parameters:** +- ```gameId```: The created shuffle game ID. + +### curPlayerIndex + +```function curPlayerIndex(uint256 gameId) external returns(uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L78-L80) + +Gets the player index of which player needs to take action. + +**Parameters:** +- ```gameId```: The created shuffle game ID. + +**Return:** +- ```currentPlayerIdx```: The currentPlayerIdx indicates which player needs to take action. + +### getPlayerIdx + +```function getPlayerIdx(uint256 gameId, address player) external returns(uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L140-L143) + +Gets the player index of `player` in `gameId` game. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```player```: The player's address. + +**Return:** +- ```playerIdx```: The player index in the shuffle game. + +### INVALID_INDEX + +INVALID_INDEX is a constant with a value of 999999, used to represent an invalid card index and player index. + +**Example:** +```solidity +pragma solidity >=0.8.2 <0.9.0; +import "IBaseGame.sol"; +import "IShuffleStateManager.sol"; +contract Game is IBaseGame { + IShuffleStateManager public shuffle; + uint256 public shuffleId; + ... + function getPlayerIndex() external { + uint256 playerIdx = shuffle.getPlayerIdx(shuffleId, msg.sender); + require(playerIdx != shuffle.INVALID_INDEX()); + ... + } +} +``` + +### getNumCards + +```function getNumCards(uint256 gameId) external returns(uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L64-L66) + +Gets the number of cards. + +**Parameters:** +- ```gameId```: The created shuffle game ID. + +**Return:** +- ```numCards```: The number of cards. + +### queryCardValue + +```function queryCardValue(uint256 gameId, uint256 cardIndex) external returns(uint256)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L580-L583) + +Queries the card value of `cardIndex`-th card in `gameId`. + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```cardIndex```: The index of a card in the deck. + +**Return:** +- ```cardValue```: The actual card value in the deck. + +### getDecryptRecord + +```function getDecryptRecord(uint256 gameId, uint256 cardIdx) external returns(BitMaps.BitMap256 memory)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L86-L89) + +Gets the decryption record (i.e., which players have decrypted this card). + +**Parameters:** +- ```gameId```: The created shuffle game ID. +- ```cardIdx```: The index of a card in the deck. + +**Return:** +- ```record```: It indicates which players have already dealt this card. For example, if the ```record``` value is 5, it corresponds to the binary representation 101. This means that the player with indexes [0, 2] has dealt the card. + +### queryAggregatedPk + +```function queryAggregatedPk(uint256 gameId) external returns(uint px, uint py)```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/shuffle/ShuffleManager.sol#L96-L98) + +Queries the aggregated public key for card shuffling/dealing in `gameId`-th game. The public key is a elliptic curve point on BN254 G1 curve. + +**Parameters:** +- ```gameId```: The created shuffle game ID. + +**Return:** +- ```pkX```: The X-coordinate of the aggregated public key. +- ```pkY```: The Y-coordinate of the aggregated public key. + +## IBaseGame + +### cardConfig +Developers need to implement the cardConfig interface, which represents the number of cards included in the game. + +**Example:** +```solidity +pragma solidity >=0.8.2 <0.9.0; +import "IBaseGame.sol"; +contract Game is IBaseGame { + // This indicates that the game contract is based on a deck of 30 cards. + function cardConfig() external pure override returns (DeckConfig) { + return DeckConfig.Deck30Card; + } + ... +} +``` \ No newline at end of file diff --git a/docs/zkShuffle/Circuits/02-TypescriptSDK.md b/docs/zkShuffle/Circuits/02-TypescriptSDK.md new file mode 100644 index 00000000..421e29ee --- /dev/null +++ b/docs/zkShuffle/Circuits/02-TypescriptSDK.md @@ -0,0 +1,117 @@ +--- +title: 'Typescript SDK' +description: 'zkShuffle SDK Overview' +--- + +# Overview + +zkShuffles SDK provides [IZKShuffle](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L47-L58) as a standard interface to interact with shuffle manager contract. +The goal is to simplify zk proof generation and key management. +With IZKShuffle interface, game developer can build zk game without any experience on cryptography including zero knowledge proof, and thus can focus on the game logic. + +# IZKShuffle + +### joinGame +```async joinGame(gameId: number): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L128) + +Joins the game specified by `gameId`, and returns the player ID per game. + +**Parameters:** + - `gameId` : number + +**Return:** + - `playerId` : number + +### checkTurn +```async checkTurn(gameId: number, startBlock: any = 0): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#LL140C3-L140C74) + +Queries a player's current turn in game `gameId`, specified by `GameTurn:` + + ```typescript + enum GameTurn { + NOP, // Not Your Turn + Shuffle, // Shuffle Turn + Deal, // Deal Decrypt Turn + Open, // Open Card + Error, // Game Error + Complete, // Game End + } + ``` + +**Parameters:** +- `gameId` : number + +**Return:** +- `turn` : `GameTurn` + + +### shuffle +```async shuffle(gameId: number): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#LL240C3-L240C50) + +Shuffles the deck in game `gameId` and submits a proof on-chain. + +**Parameters:** +- `gameId` : number + +**Return:** +- `result` : boolean. `True` is shuffle successs, otherwise `False`. + +### draw +```async draw(gameId: number): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L280) + +Draws a card in game `gameId`, and submits a proof on-chain. + +**Parameters:** +- `gameId` : number + +**Return:** +- `result` : boolean. `True` is draw successs, otherwise `False` + +### open +```async open(gameId: number, cardIds: number[]): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L361) + +Opens cards specified by `cardIds` and submits a proof on-chain. +> `open` automatically sends data to blockchain, such that it is not suitable for opening cards that are only visible to players. Use `openOffchain` instead in this case. + +**Parameters:** +- `gameId` : number +- `cardIds` : number[] + +**Return:** +- `cards` : the index of decrypted cards if open successfully; otherwise -1 + +### openOffchain +```async openOffchain(gameId: number, cardIds: number[]): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L342) + +Opens cards specified by `cardIds`. Returns card's original value if open successs, otherwise returns -1 for the card. +> Different from `open` that sends the decryption onchain, `openOffchain` only shows decrypted card on user machine and does not send to blockchain. + +**Parameters:** +- `gameId` : number +- `cardIds` : number[] + +**Return:** +- `cards` : number[] + +### getPlayerId +```async getPlayerId(gameId: number): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L135) + +Gets player's id from onchain game `gameId`. + +**Parameters:** +- `gameId` : number + +**Return:** +- `playerId` : number + +### queryCards +```async queryCards(gameId: number, cardIds: number[]): Promise```[[src]](https://github.com/manta-network/zkShuffle/blob/main/packages/jssdk/src/shuffle/zkShuffle.ts#L352) + +Gets the card value specified by `cardIds` from on-chain game `gameId`. + +**Parameters:** +- `gameId` : number +- `cardIds` : number[] + +**Return:** +- `cards` : number[] diff --git a/docs/zkShuffle/Circuits/03-Tutorial.md b/docs/zkShuffle/Circuits/03-Tutorial.md new file mode 100644 index 00000000..84cc2743 --- /dev/null +++ b/docs/zkShuffle/Circuits/03-Tutorial.md @@ -0,0 +1,182 @@ +--- +title: 'Tutorial' +description: 'zkShuffle SDK Tutorial Step-by-Step' +--- + + +# Overview + +This tutorial shows a simple game zkHilo. In particular, each of two players draw 1 card and bet, where the player with larger card value wins. The complete logic is: + +```ts + zkHiLo Game Logic : + 1. deal card 0 to player 0 + 2. deal card 1 to player 1 + 3. bet + 4. player 0 open card 0 + 5. player 1 open card 1 + 6. win/lose +``` + +# Game contract + +Developers could write a game contract as follows: + +```solidity +pragma solidity >=0.8.2 <0.9.0; +import "IBaseGame.sol"; +import "IShuffleStateManager.sol"; +contract Hilo is IBaseGame { + IShuffleStateManager public shuffle; + uint256 public shuffleId; + // check whether the caller is the shuffle Manager + modifier onlyShuffleManager() { + require( + address(shuffle) == msg.sender, + "Caller is not shuffle manager." + ); + _; + } + function cardConfig() external pure override returns (DeckConfig) { + return DeckConfig.Deck52Card; + } + constructor(IShuffleStateManager _shuffle) { + shuffle = _shuffle; + } + // create a game with 2 players + function createGame() external { + shuffleId = shuffle.createShuffleGame(2); + bytes memory next = abi.encodeWithSelector( + this.moveToShuffleStage.selector + ); + shuffle.register(shuffleId, next); + } + // will be called after all the 2 players have registered + function moveToShuffleStage() external onlyShuffleManager { + bytes memory next = abi.encodeWithSelector( + this.dealCardsToPlayer.selector + ); + shuffle.shuffle(shuffleId, next); + } + // will be called after all the 2 players have shuffled, specify the deal state so that the other player can deal the first card to player 0 + function dealCard0ToPlayer0() external onlyShuffleManager { + BitMaps.BitMap256 memory cards; + cards._data = 1; // ...0001 + bytes memory next = abi.encodeWithSelector( + this.dealCard1ToPlayer1.selector + ); + shuffle.dealCardsTo(shuffleId, cards, 0, next); + } + // will be called after dealt card to player 0, specify the deal state so that the other player can deal the second card to player 1 + function dealCard1ToPlayer1() external onlyShuffleManager { + BitMaps.BitMap256 memory cards; + cards._data = 2; // ...0010 + bytes memory next = abi.encodeWithSelector( + this.openCard0.selector + ); + shuffle.dealCardsTo(shuffleId, cards, 1, next); + } + // will be called after dealt card to player 1, specify the open state so that the player 0 can open his 1 card + function openCard0() external onlyShuffleManager { + bytes memory next = abi.encodeWithSelector( + this.openCard1.selector + ); + shuffle.openCards(shuffleId, 0, 1, next); + } + // will be called after player 0 opened card, specify the open state so that the player 1 can open his 1 card + function openCard1() external onlyShuffleManager { + bytes memory next = abi.encodeWithSelector( + this.endGame.selector + ); + shuffle.openCards(shuffleId, 1, 1, next); + } + // will be called after player 1 opened card, and end the game. + function endGame() onlyShuffleManager { + shuffle.endGame(shuffleId); + } + ... +} +``` + +For the complete contract code, please see [[hilo]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/contracts/games/hilo/Hilo.sol). + +# Front end with SDK + +Developers can interact with shuffleManager contract using zkShuffle SDK. We provide the following examples. + + + +- **step 1** : Creates a zkShuffle instance, with given shuffleManager contract address, and player signer + + ```ts + const player = await zkShuffle.create(ShuffleManagerContract, signer); + ``` + +- **step 2** : join the game + + ```ts + const playerIdx = await player.joinGame(gameId); + ``` + +- **step 3** : check player's turn in the game + + ```ts + const turn = await player.checkTurn(gameId); + ``` + +- **step 4.1** : if it's player's shuffle turn, shuffle the card + + ```ts + await player.shuffle(gameId); + ``` + +- **step 4.2** : if it's player's deal turn, draw the card + + ```ts + await player.draw(gameId); + ``` + +- **step 4.3** : if it's player's open turn, open the card + + ```ts + const cards[] = await player.open(gameId, cardIds) + ``` + +We provide an end-to-end front-end code as follows: + + ```ts + // create zkShuffle instance + const player = await zkShuffle.create(SM, owner); + + // join game + const playerIdx = await player.joinGame(gameId); + + // play game + let turn; + while (turn != GameTurn.Complete) { + turn = await player.checkTurn(gameId); + + if (turn != NOP) { + switch (turn) { + case GameTurn.Shuffle: + await player.shuffle(gameId); + break; + case GameTurn.Deal: + await player.draw(gameId); + break; + case GameTurn.Open: + const cards = await player.open(gameId, cardIds); + break; + case GameTurn.Complete: + break; + case GameTurn.Error: + break; + default: + console.log('err turn ', turn); + exit(-1); + } + } + } + ``` + +For the complete end-to-end test, please see [[e2e]](https://github.com/manta-network/zkShuffle/blob/main/packages/contracts/tests/e2e.ts). \ No newline at end of file diff --git a/docs/zkShuffle/Deploy/01-Overview.md b/docs/zkShuffle/Deploy/01-Overview.md new file mode 100644 index 00000000..7a9ddac7 --- /dev/null +++ b/docs/zkShuffle/Deploy/01-Overview.md @@ -0,0 +1,10 @@ +# Deploy on Manta Pacific + +You can deploy your application onto Manta Pacific via the same means as any Ethereum-compatible blockchain. For the purpose of example, we'll use the Manta Pacific testnet RPC URL. + +This section is non-exhaustive and serves to give a high-level overview of configuring a project to use Manta Pacific. The exact process to deploy your smart contracts varies depending on the development tooling you're using. As a general rule, the process for deploying on and interacting with Manta Pacific is the same as any EVM-compatible chain (including Ethereum, Polygon, Binance Smart Chain, etc.). + +Updating the client-side to interact with the Manta Pacific is also done quickly: simply change the JSON-RPC Url used to that of the Manta Pacific. Note: ensure that all of your smart contracts are deployed on the Manta Pacific and that you have updated contract addresses on the frontend. + +# Testnet Information +See this page: [Manta Pacific Testnets](https://pacific.manta.network/) \ No newline at end of file diff --git a/docs/zkShuffle/Deploy/02-Hardhat.md b/docs/zkShuffle/Deploy/02-Hardhat.md new file mode 100644 index 00000000..f2480b5f --- /dev/null +++ b/docs/zkShuffle/Deploy/02-Hardhat.md @@ -0,0 +1,118 @@ +# Hardhat +Deploying Smart Contracts using Hardhat + +## What is Hardhat? +Hardhat is a development environment for Ethereum that helps developers manage and automate the common tasks involved in building smart contracts and decentralized applications. It can directly interact with Manta Pacific's Ethereum API, allowing for the deployment of smart contracts into the Manta Pacific network. Additionally, Hardhat is a comprehensive set of tools for creating Ethereum-based software, which includes various components that aid in editing, compiling, debugging, and deploying smart contracts and decentralized applications. All of these components work together to create a complete development environment. + +## Creating a Hardhat Project +1. Create a directory for your project +``` bash +mkdir hardhat && cd hardhat +``` +2. Initialize the project which will create a package.json file +``` bash +npm init -y +``` +3.Install Hardhat +``` bash +npm install hardhat +``` +4.Create a project +``` bash +npx hardhat +``` +5.Create an empty hardhat.config.js and install the Ethers plugin to use the Ethers.js library to interact with the network. +``` bash +npm install @nomiclabs/hardhat-ethers ethers +``` + +## Creating your Smart Contract +1. Create a contracts directory +``` bash +mkdir contracts && cd contracts +``` +2. Create your_contract.sol file in contracts directory +``` bash +touch your_contract.sol +``` + +## Creating your Configuration File +Modify the Hardhat configuration file and create a secure file to store your private key in. +1. Create a secrets.json file to store your private key +``` bash +touch secrets.json +``` +2. Add your private key to secrets.json +``` json +{ + "privateKey": "YOUR-PRIVATE-KEY-HERE" +} +``` +3. Add the file to your project's .gitignore, and never reveal your private key. +4. Modify the hardhat.config.js file +- Import the Ethers plugin +- Import the secrets.json file +- Inside the module.exports add the Manta Pacific network configuration + +``` js +//hardhat.config.js + +require('@nomiclabs/hardhat-ethers'); +const { privateKey } = require('./secrets.json'); + +module.exports = { + solidity: "0.8.1", + defaultNetwork: "rinkeby", + networks: { + rinkeby: { + url: "https://eth-rinkeby.alchemyapi.io/v2/123abc123abc123abc123abc123abcde", + accounts: [privateKey] + }, + manta: { + url: "RPC URL", // Insert your RPC URL Here + chainId: CHAINID, //Insert your ChainID Here + } + }, +} +``` + +## Deploying your Smart Contract +1. Compile the contract +``` bash +npx hardhat compilejs +``` +2. Create a new directory for the script and name it scripts and add a new file to it called deploy.js +``` bash +mkdir scripts && cd scripts +touch deploy.js +``` +3. Create a deployment script, like the one below +``` js +// scripts/deploy.js +async function main() { + // 1. Get the contract to deploy + const Your_Contract = await ethers.getContractFactory('your_contract'); + console.log('Deploying Your_Contract...'); + + // 2. Instantiating a new smart contract + const your_contract = await Your_Contract.deploy(); + + // 3. Waiting for the deployment to resolve + await your_contract.deployed(); + + // 4. Use the contract instance to get the contract address + console.log('Your_Contract deployed to:', your_contract.address); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); +``` + +4. Deploy your_contract.sol using the command below +``` bash +npx hardhat run scripts/deploy.js --network manta +``` \ No newline at end of file diff --git a/docs/zkShuffle/Deploy/03-Foundry.md b/docs/zkShuffle/Deploy/03-Foundry.md new file mode 100644 index 00000000..2447c42a --- /dev/null +++ b/docs/zkShuffle/Deploy/03-Foundry.md @@ -0,0 +1,70 @@ +# Foundry + +Deploying Smart Contracts using Forge in Foundry + +## What is Foundry? + +Foundry is a toolset for Ethereum development written in Rust that assists developers in managing dependencies, compiling projects, running tests, deploying contracts, and interacting with blockchains through the command line interface. Additionally, Foundry can directly communicate with Manta Pacific's Ethereum API, enabling the use of Foundry to deploy smart contracts into the Manta Pacific network. + +## Getting Started with Foundry + +1. Install Foundry + + - Linux or MacOS + + curl -L https://foundry.paradigm.xyz | bash + + foundryup + + - Windows + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh + + cargo install --git https://github.com/foundry-rs/foundry foundry-cli anvil --bins --locked + +2. Create a project + ``` bash + forge init foundry + ``` + +3. Navigate to the **Source** in the project and create your smart contract + ``` bash + cd src + touch MyToken.sol + ``` +4. Input your smart contract or use the sample contract below. + + ``` solidity + // SPDX-License-Identifier: MIT + // compiler version must be greater than or equal to 0.8.17 and less than 0.9.0 + pragma solidity ^0.8.17; + + contract HelloWorld { + string public greet = "Hello World!"; + } + ``` + +5. Install OpenZeppelin contracts as a dependency + ``` bash + forge install OpenZeppelin/openzeppelin-contracts + ``` + +6. Compile contract + ``` bash + forge build + ``` + +## Deploying your Smart Contract + +Deploying a contract with Forge is a simple process that can be done with a single command. However, it requires an RPC endpoint, a private key that has funds, and any arguments for the constructor of the contract. + +For example, the MyToken.sol contract requires an initial supply of tokens to be specified in its constructor, so the command to deploy it on a network will include the argument of 100. + +To deploy the MyToken.sol contract, use the command that corresponds to the Manta Pacific chain's RPC URL while running the forge create command: + +``` bash + forge create --rpc-url "RPC URL" //Insert your RPC URL here + --constructor-args 100 \ + --private-key YOUR_PRIVATE_KEY \ + src/MyToken.sol:MyToken +``` \ No newline at end of file diff --git a/docs/zkShuffle/Deploy/04-Remix.md b/docs/zkShuffle/Deploy/04-Remix.md new file mode 100644 index 00000000..27e1b5e3 --- /dev/null +++ b/docs/zkShuffle/Deploy/04-Remix.md @@ -0,0 +1,38 @@ +# Remix + +Deploying Smart Contracts using Remix + +## What is Remix? + +Remix Project is a robust set of tools that can be used by individuals of any skill level throughout the entire process of developing contracts, and it also serves as an educational platform for learning and experimenting with Ethereum. + +## Getting Started with Remix + +1. Visit [Remix](https://remix.ethereum.org/) to get started. +2. Under **Featured Plugins**, select **Solidity**. +3. Navigate to the **File Explorer** and click **"+"** to create a Smart Contract +4. Input your smart contract or use the sample contract below. + + ``` solidity + // SPDX-License-Identifier: MIT + // compiler version must be greater than or equal to 0.8.17 and less than 0.9.0 + pragma solidity ^0.8.17; + + contract HelloWorld { + string public greet = "Hello World!"; + } + ``` +5. Navigate to the **Compile** sidebar option and click **Compile**. + +## Deploying your Smart Contract + +Once you have written your Smart Contract in Remix, you can navigate to the sidebar option to Compile your contract. + +1. Change the top ENVIRONMENT dropdown from "Javascript" to "Injected Web3" +2. This will take you MetaMask - Press connect in Metamask to allow Remix access. +3. Use the following information to add Manta Pacific Testnet network to Metamask + - Network: Caldera + - New RPC URL: [https://manta-testnet.calderachain.xyz/http](https://manta-testnet.calderachain.xyz/http) + - Chain ID: 3441005 + - Currency Symbol: manta + - Block Explorer URL: [https://manta-testnet.calderaexplorer.xyz/](https://manta-testnet.calderaexplorer.xyz/) diff --git a/docs/zkShuffle/Deploy/05-Ethers.js.md b/docs/zkShuffle/Deploy/05-Ethers.js.md new file mode 100644 index 00000000..3a5f8b88 --- /dev/null +++ b/docs/zkShuffle/Deploy/05-Ethers.js.md @@ -0,0 +1,44 @@ +# Ethers.js + +## What is Ethers.js? + +The Ethers.js library offers a collection of tools to interact with Ethereum nodes using JavaScript, similar to Web3.js. Manta Pacific also has a similar API that is fully compatible with Ethereum's JSON RPC invocations. This means that developers can take advantage of this compatibility and use the Ethers.js library to interact with a Manta Pacific node as if it were an Ethereum node. + +## Getting Started with Ethers.js + +1. Create a JavaScript Project to store all of the files you'll be creating + `mkdir ethers-examples && cd ethers-examples` +2. Install the Ethers.js library and the Solidity compiler + `npm install ethers solc@0.8.0` + +## Setting up Ethers Provider + +1. Import the `ethers` library +2. Define the `providerRPC` object, which can include the network configurations for any of the networks you want to send a transaction on. +3. Create the `provider` using the `ethers.providers.StaticJsonRpcProvider` method. An alternative is to use the `ethers.providers.JsonRpcProvide(providerRPC)` method, which only requires the provider RPC endpoint address. + + ``` solidity + // 1. Import ethers + const ethers = require('ethers'); + + // 2. Define network configurations + const providerRPC = { + manta: { + name: 'Manta', + rpc: 'https://manta-testnet.calderachain.xyz/http', // Insert your RPC URL here + chainId: 3441005, //Insert your ChainID Here + }, + }; + // 3. Create ethers provider + const provider = new ethers.providers.StaticJsonRpcProvider( + providerRPC.constellation.rpc, + { + chainId: providerRPC.constellation.chainId, + name: providerRPC.constellation.name, + } + ); + ``` + +Note: Ensure that all of your smart contracts are deployed on the Manta Pacific chain and that you have updated contract addresses on the front-end. + +## [Ethers.js Documentation](https://docs.ethers.org/v5/) \ No newline at end of file diff --git a/docs/zkShuffle/Deploy/06-Web3.js.md b/docs/zkShuffle/Deploy/06-Web3.js.md new file mode 100644 index 00000000..ada33d84 --- /dev/null +++ b/docs/zkShuffle/Deploy/06-Web3.js.md @@ -0,0 +1,22 @@ +# Web3.js + +## What is Web3.js? + +Web3.js is a collection of tools that enable programmers to communicate with Ethereum nodes through HTTP, IPC, or WebSocket protocols using JavaScript. Manta Pacific has a similar API, which can be used with the same JSON RPC calls as Ethereum, allowing developers to utilize the Web3.js library to interact with a Manta Pacific node as if it were Ethereum. + +## Getting Started with Web3.js + +1. Create a JavaScript Project to store all of the files you'll be creating + `mkdir web3-examples && cd web3-examples` +2. Install the Ethers.js library and the Solidity compiler + `npm install web3 solc@0.8.0` +3. Setup Web3.js with Manta Pacific chain + + ``` js + const Web3 = require('web3'); + + // Create Web3 instance + const web3 = new Web3("RPC URL"); // Insert your RPC URL here + ``` + +### [Web3.js Documentation](https://web3js.readthedocs.io/en/v1.3.4/) diff --git a/docs/zkShuffle/Deploy/07-ChainSafe Gaming SDK.md b/docs/zkShuffle/Deploy/07-ChainSafe Gaming SDK.md new file mode 100644 index 00000000..2868eed7 --- /dev/null +++ b/docs/zkShuffle/Deploy/07-ChainSafe Gaming SDK.md @@ -0,0 +1,23 @@ +# ChainSafe Gaming SDK + +## What is ChainSafe? + +The Chain Gaming SDK is a software development kit that enables game developers to integrate blockchain technology into their games. It allows for creating, managing, and trading in-game assets on the blockchain, providing players with full ownership and control over their virtual items. + +## Quickstart + +Connect to Manta Pacific Chains by providing the Manta Pacific Chain RPC. All ChainSafe Gaming methods have an optional field to add an RPC URL. This returns the native token's balance for the chain. + +``` js + string chain = "Manta Pacific"; + string network = "testnet"; + string account = "token_account_here"; + string rpc = "RPC URL"; //Insert RPC URL here + + string balance = await EVM.BalanceOf(chain, network, account, rpc); + print(balance); +``` + +### More Information: [Custom Interactions | ChainSafe Gaming SDK](https://docs.gaming.chainsafe.io/current/installation/#downloading-the-sdk) + +### [ChainSafe Gaming: Documentation]( https://docs.gaming.chainsafe.io/current/project-id-registration) diff --git a/docs/zkShuffle/Deploy/08-wagmi.md b/docs/zkShuffle/Deploy/08-wagmi.md new file mode 100644 index 00000000..b672beb7 --- /dev/null +++ b/docs/zkShuffle/Deploy/08-wagmi.md @@ -0,0 +1,27 @@ +# wagmi + +## What is wagmi? + +**wagmi** is a collection of React Hooks containing everything you need to start working with Ethereum. wagmi makes it easy to "Connect Wallet," display ENS and balance information, sign messages, interact with contracts, and much more — all with caching, request deduplication, and persistence. + +## Quickstart + +The `jsonRpcProvider` configures the chains with the RPC URLs that you specify and also provides an [ethers.js StaticJsonRpcProvider](https://docs.ethers.io/v5/api/providers/jsonrpc-provider/#StaticJsonRpcProvider). + +``` js + import { chain, configureChains } from 'wagmi' + import { jsonRpcProvider } from 'wagmi/providers/jsonRpc' + + const { chains, provider } = configureChains( + [chain.testnet, chain.manta], + [ + jsonRpcProvider({ + rpc: (chain) => ({ + http: `RPC URL`, // Insert RPC URL here + }), + }), + ], + ) +``` + +More Information: [JSON RPC](https://wagmi.sh/react/providers/jsonRpc) diff --git a/docs/zkShuffle/Overview.md b/docs/zkShuffle/Overview.md new file mode 100644 index 00000000..599121f2 --- /dev/null +++ b/docs/zkShuffle/Overview.md @@ -0,0 +1,28 @@ +# zkShuffle Alpha Documentation + +zkShuffle provides an easy access for Ethereum developers to create "mental poker" games utilizing zero-knowledge proofs. The concept of "mental poker" refers to the implementation of a fair gaming protocol over a communication system that doesn't involve any trusted third-party. The term was initially proposed in 1979 by Adi Shamir, Ron Rivest, and Leonard Adleman in a paper where they discussed the idea of creating a fair poker game in which players could not see each other's cards or shuffle and deal the cards themselves. The challenge of building a “mental poker” game is to ensure that no one can cheat while maintaining the communications reliable, efficient and low-cost. + +zkShuffle is an efficient mental poker emphasizing the reduction of gas cost on Ethereum. zkShuffle can be applied beyond poker to many different types of card or board games where secure and fair card shuffle and deal is required without a trusted third party. + +## State Diagram + +The following state diagram provides an overview of the game process managed by the ShuffleManager contract. To initiate a new game, it must first be created. Upon creation, the manager contract assigns a unique ID to this game and players can join the game with that ID. Once the final player has registered, the game starts. Players can check the current turn within the game. If it's their turn to perform an action (shuffle, deal or open), they carry out the action accordingly. +![](https://hackmd.io/_uploads/By8S6Xg92.png) + +## Main Components + +### Circuits + +This [directory](https://github.com/manta-network/zkShuffle/tree/main/packages/circuits) contains Circom code to implement zkShuffle encryption and decryption circuits. It also contains the corresponding verifier contracts generated by snarkjs. [Read more](https://github.com/Manta-Network/zkShuffle/tree/main/packages) + +### Solidity Contracts + +This [directory](https://github.com/manta-network/zkShuffle/tree/main/packages/contracts/contracts/shuffle) contains contracts that manages shuffled deck and verifies proofs on-chain. It comprises the manager contract, ShuffleManager.sol, as well as supplementary contracts tasked with operations such as encryption and decryption. The manager contract is responsible for creating new games, registering players, checking game states, and performing various operations required for game management. This frees developers from considering technical details such as card shuffling and dealing, such that developers could focuses on game logic contracts. [Read more](/docs/zkShuffle/Circuits/ContractInterface) + +### Typescript SDK (Alpha) + +This [directory](https://github.com/manta-network/zkShuffle/tree/main/packages/jssdk) contains typescript SDK as the standard interface to interact with shuffle manager contract. Developers could use SDK to generate zk proof generation and gaming private and public key management. We have released it as an [npm package](https://www.npmjs.com/search?q=%40poseidon-zkp) for easy import in front-end implementation. [Read more](/docs/zkShuffle/Circuits/TypescriptSDK) + +### Game Contracts + +Developers need to implement game contracts for a complete game, which contains game logic such as the order of players to take action and effects of each card. Please review this tutorial for a simple example: [Tutorial](/docs/zkShuffle/Circuits/Tutorial) diff --git a/docs/zkShuffle/Testnet-Quickstart.md b/docs/zkShuffle/Testnet-Quickstart.md new file mode 100644 index 00000000..b3971cd9 --- /dev/null +++ b/docs/zkShuffle/Testnet-Quickstart.md @@ -0,0 +1,22 @@ +Get started with exploring the Manta Pacific ecosystem and developing/deploying applications on testnet. Go through these resources to onboard quickly. + +# Key Tools + +## Adding Manta Testnet to MetaMask +| Category | Information | +| ---------------- | ------------------------------------------- | +| Network Name | manta-testnet | +| Network URL | https://manta-testnet.calderachain.xyz/http | +| Chain ID |3441005 | +| Currency Symbol | ETH | + +## Other Key Information +| Category | Information | +| ------------- | ------------------------------------------- | +| RPC URL | https://manta-testnet.calderachain.xyz/http | +| Websocket URL | wss://manta-testnet.calderachain.xyz/ws | + +### Obtaining Testnet Assets +Manta Pacific uses ETH as the underlying asset for transaction fees. Request faucet funds for both [Manta and Goerli here](https://manta-testnet.caldera.dev/). + +You can also [bridge your assets from Goerli to Manta Pacific](https://manta-testnet.calderabridge-test.xyz/). \ No newline at end of file diff --git a/sidebars.js b/sidebars.js index 63ec3c3c..7ff11f61 100644 --- a/sidebars.js +++ b/sidebars.js @@ -9,7 +9,7 @@ Create as many sidebars as you want. */ -module.exports = { + module.exports = { docs: [ { type: "category", @@ -177,41 +177,78 @@ module.exports = { }, { type: "category", - label: "Calamari Test Network", + label: "Manta Pacific Testnet", collapsible: false, items: [ { - type: "doc", - label: "What is Calamari?", - id: "calamari/Overview", + type: "category", + label: "Testnet", + items: [ + { + type: "doc", + label: "EVM Compatibility", + id: "manta-pacific/EVM Compatible", + }, + { + type: "doc", + label: "Testnet Info", + id: "manta-pacific/Testnet Info", + }, + { + type: "doc", + label: "Block Explorer", + id: "manta-pacific/Block Explorer", + }, + { + type: "doc", + label: "Faucet", + id: "manta-pacific/Faucet", + }, + { + type: "doc", + label: "JSON-RPC Nodes", + id: "manta-pacific/JSON-RPC Nodes", + }, + ], }, { type: "category", - label: "🐙 Calamari Token (KMA)", + label: "Universal Circuits (Alpha): zkShuffle", + items: [ + { + type: "doc", + label: "Overview", + id: "zkShuffle/Overview", + }, { type: "autogenerated", - dirName: "calamari/KMA", + dirName: "zkShuffle/Circuits", + }, + ], + }, + { + type: "category", + label: "Deploy Your App", + items: [ + { + type: "autogenerated", + dirName: "zkShuffle/Deploy", }, - "calamari/CrowdloanClaim", ], }, - "calamari/Governance", - "calamari/Partnership", ], }, { type: "category", - label: "Developers", + label: "Calamari Network", collapsible: false, items: [ - // NOTE: To be created later - // { - // type: 'category', - // label: 'Develop on Manta', - // items: [ - // ] - // }, + { + type: "doc", + label: "What is Calamari?", + id: "calamari/Overview", + }, { type: "category", label: "Develop on Calamari Testnet", @@ -278,58 +315,20 @@ module.exports = { }, ], }, + "Codebase", { type: "category", - label: "Develop on Dolphin Testnet", + label: "🐙 Calamari Token (KMA)", items: [ { - type: "category", - label: "Integration with Dolphin", - items: [ - { - type: "doc", - label: "Get Started", - id: "calamari/DevelopOnDolphin", - }, - { - type: "category", - label: "Cross-Chain Interactions (XCM)", - items: [ - "guides/XcmOverview", - "guides/XcmTransfers", - "guides/XcmOnboarding", - ], - }, - ], - }, - { - type: "category", - label: "Collation", - items: [ - "calamari/Staking/Collation/Overview", - "calamari/Staking/Collation/Requirements", - { - type: "category", - label: "SetupAndRun", - items: [ - "calamari/Staking/Collation/SetupAndRun/installation", - "calamari/Staking/Collation/SetupAndRun/configuration", - "calamari/Staking/Collation/SetupAndRun/running", - "calamari/Staking/Collation/SetupAndRun/sync", - "calamari/Staking/Collation/SetupAndRun/keys", - "calamari/Staking/Collation/SetupAndRun/bond", - ], - }, - "calamari/Staking/Collation/Maintenance", - "calamari/Staking/Collation/Reduce Bond", - "calamari/Staking/Collation/Unbond", - "calamari/Staking/Collation/CollatorFAQ", - "calamari/Staking/Early Collator Program", - ], + type: "autogenerated", + dirName: "calamari/KMA", }, + "calamari/CrowdloanClaim", ], }, - "Codebase", + "calamari/Governance", + "calamari/Partnership", ], }, { @@ -344,7 +343,7 @@ module.exports = { }, { type: "link", - label: "Manta Network Crowdload", // string - the label that should be displayed. + label: "Manta Network Crowdloan", // string - the label that should be displayed. href: "https://crowdloanstrategy.manta.network/", // string - the target URL. }, ],