Developer Quickstart
With Wischain, your preferred tools for developing and testing smart contracts can be utilized seamlessly. Since Wischain is bytecode compatible with the Ethereum Virtual Machine (EVM), you only need to configure your favorite development tools to connect to a Wischain RPC Provider.
If you encounter any challenges along the way, don’t hesitate to reach out for support on our Discord channel.
Acquiring Ether
Wischain utilizes ETH as its native currency, which is essential for covering transaction fees related to deploying and interacting with the network.
To begin building on Wischain, we recommend starting with our Wischain Sepolia testnet. The first step is to obtain some testnet ETH. You can find guidance on acquiring test tokens on the Faucet page. Once you have your testnet ETH, you can bridge it to the Wischain Sepolia Testnet (Layer 2) using our Sepolia Bridge, as detailed in the Bridge documentation.
For a comprehensive walkthrough, refer to the Setup page in our User Guide.
When you're ready to deploy on Wischain's mainnet, you can transfer ETH using our native bridge or one of the third-party bridging options available.
Network Configuration
Wischain Mainnet
Use the table below to configure your Ethereum tools to the Wischain mainnet:
RPC URL
https://rpc.wischain.io/
Chain ID
648532
1
Currency Symbol
ETH
ETH
Block Explorer URL
https://rpc.wischainscan.com
Wischain Testnet
Use the table below to configure your Ethereum tools to the Wischain Sepolia Testnet:
RPC URL
https://sepolia-rpc.wischain.io
Chain ID
648531
11155111
Currency Symbol
ETH
ETH
Block Explorer URL
https://sepolia.wischainscan.com
Hardhat Configuration for Wischain Sepolia Testnet
To enable development on the Wischain Sepolia Testnet, you need to update your Hardhat configuration file, hardhat.config.ts
, to connect to the testnet's public RPC endpoint. This configuration will allow you to seamlessly interact with the Wischain network during your development workflow. Here’s a step-by-step guide to modify your configuration:
Locate the Networks Section: Open your
hardhat.config.ts
file and find the section dedicated to networks.Add Wischain Sepolia Testnet Entry: Create a new network entry for the Wischain Sepolia Testnet. In this entry, you'll specify the public RPC URL provided by the Wischain network, along with any necessary parameters such as the chain ID, gas settings, and account details.
Here’s an example of how your configuration might look:
Key Considerations:
Chain ID: Make sure to specify the correct chain ID for the Wischain Sepolia Testnet. This is crucial for ensuring that your transactions are sent to the right network.
Gas Settings: Depending on your testing requirements, you may need to adjust the gas settings. This includes both the maximum gas limit and the gas price, which can vary based on network conditions.
Environment Variables: It's a good practice to use environment variables for sensitive information, such as your private key. Ensure you have a
.env
file set up and that you load it in your configuration if you haven’t already.
Additional Resources:
For further information about the Wischain network and its features, you can refer to Wischainscan for insights on transaction history, block details, and more. This will help you better understand the network dynamics as you develop your applications on the Wischain Sepolia Testnet.
Foundry
To deploy your application on the Wischain Sepolia Testnet utilizing the Public RPC, you can execute the following command in your terminal:
Remix Web IDE:
Once you have compiled your contracts, the most straightforward method for deployment using Remix is to configure MetaMask and connect it to the Wischain Sepolia Testnet network.
This allows you to easily manage your transactions and interact with the deployed contracts. Ensure that you have sufficient test tokens in your MetaMask wallet for deployment, which can typically be obtained from a faucet specifically for the Wischain Sepolia Testnet.
After setting up your environment, you can initiate the deployment process directly from Remix. Once deployed, you can monitor your contracts and their transactions using Wischainscan, which provides real-time insights and analytics for the Wischain network.
Wischain Setup with Truffle
If you have already configured your Truffle environment, the next step is to modify the Truffle configuration file, typically named truffle.js
. To interact with the Wischain network, ensure you have the HDWalletProvider installed. You can do this by running the following command in your terminal:
Configuration Example
In your truffle.js
file, you will need to set up the network configuration for connecting to Wischain. Below is an example of how to configure it:
Explanation
HDWalletProvider: This library allows you to use a mnemonic or a private key to manage your Ethereum account, facilitating transactions on the blockchain. By specifying your private key, you can securely sign transactions and interact with the Wischain network.
Network Configuration: The
wischainSepolia
entry in thenetworks
object specifies the connection details for the Wischain test network (Sepolia).provider
: This function returns an instance of HDWalletProvider, which takes two arguments:Your private key, stored securely in an environment variable (
process.env.PRIVATE_KEY
).The RPC URL for the Wischain Sepolia network (
https://sepolia-rpc.wischain.io/
), which allows your application to communicate with the Wischain blockchain.
network_id
: Using an asterisk (*) as the network ID allows you to connect to any network, though it's advisable to specify the actual ID for production environments to avoid unintended connections.
By configuring your Truffle project in this manner, you will be prepared to deploy and interact with smart contracts on the Wischain network effectively.
Additional Considerations
Environment Variables: Ensure that your
.env
file is properly set up with your private key to keep it secure and avoid hardcoding sensitive information directly into your configuration file.Dependencies: Keep your dependencies updated to benefit from the latest features and security enhancements. Check the official documentation for Wischain and Truffle for any additional configuration options or updates specific to the Wischain network.
Brownie Integration for Wischain Sepolia Testnet
To successfully integrate the Wischain Sepolia Testnet using Brownie, you can begin by executing the following command:
This command adds the Wischain Sepolia Testnet as a new network in your Brownie environment.
To set this newly added network as your default for the project, you will need to include the following configuration settings in your project’s configuration file:
By specifying wischainSepolia
as the default network, you ensure that all subsequent commands executed within your Brownie project will automatically utilize the Wischain Sepolia Testnet, streamlining your development process.
Additional Notes
Brownie is a Python-based development and testing framework for Ethereum smart contracts, and integrating it with Wischain allows developers to leverage its features while working in the Wischain ecosystem.
Ensure that you have the necessary RPC endpoint and chain ID correctly specified for seamless interaction with the Wischain Sepolia Testnet.
For exploring deployed contracts and transactions on the Wischain Sepolia Testnet, you can utilize Wischainscan, which provides an easy-to-use interface for monitoring blockchain activity, verifying transactions, and checking contract statuses.
Adding the Wischain Sepolia Testnet through YAML Configuration
An alternative method for integrating the Wischain Sepolia Testnet involves creating a YAML configuration file and executing a command to add it. This method provides greater flexibility and customization, making it especially beneficial for developers who prefer to programmatically manage their network configurations.
Below is an example of a YAML configuration file named network-config.yaml
:
Explanation of the Configuration Elements
live: This section indicates that the listed networks are currently active.
name: This specifies the overarching name of the network group, in this case, "Ethereum."
networks: Under this category, specific network details are listed. Each entry within this section includes several critical parameters:
chainid: The unique identifier for the Wischain Sepolia Testnet (648531) is essential for differentiating it from other networks.
host: This denotes the endpoint for connecting to the Wischain Sepolia RPC (Remote Procedure Call) server, which facilitates interaction with the network.
id: A unique identifier for the Wischain Sepolia Testnet that can be used in various programmatic contexts.
name: This is the human-readable name for the testnet, "Wischain Sepolia Testnet," making it easier for developers to identify within their configurations.
Benefits of Using YAML for Configuration
Using a YAML file for network configuration offers several advantages:
Customizability: Developers can easily modify parameters to suit their specific needs, such as changing RPC endpoints or adding additional networks.
Version Control: YAML files can be version-controlled, allowing teams to track changes and manage different configurations over time effectively.
Ease of Integration: Many development tools and libraries support YAML, making it simple to integrate with various applications and frameworks.
To add the Wischain Sepolia Testnet to your network list, you can execute the following command:
This command will import the network configuration from the specified YAML file, allowing your development environment to recognize the Wischain Sepolia Testnet.
To deploy a smart contract on Wischain, use the command below. In this instance, token.py
serves as the script for deploying your smart contract. Remember to replace token.py
with the name of your actual deployment script:
This command directs Brownie to execute the specified script on the Wischain Sepolia Testnet, facilitating the deployment process in this environment. Ensure that your script is properly configured to interact with the Wischain protocol and its specific requirements for successful deployment.
ethers.js:
Configuring a Wischain Sepolia Testnet Provider
To establish a connection to the Wischain Sepolia Testnet using ethers.js, follow these steps in your JavaScript code:
Explanation
Importing ethers.js: First, ensure you have the ethers.js library imported in your script. This library provides a robust set of tools for interacting with the Ethereum blockchain and compatible networks.
Creating a Provider: The
JsonRpcProvider
class allows you to connect to a JSON-RPC endpoint. In this case, you will replace the URL with the endpoint for the Wischain Sepolia Testnet. This URL is essential as it points to the network you want to interact with, enabling you to send transactions, query balances, and more.
Scaffold-Eth
Deployment with Wischain
To deploy your application using Scaffold-Eth on the Wischain Sepolia Testnet, you'll need to configure both your Hardhat and React settings appropriately.
Configuring Hardhat
Start by modifying the hardhat.config.js
file located in the packages/hardhat/
directory. In this file, you will define the network settings and set Wischain Sepolia as your default network for deployment.
Here's how to do it:
Select the Default Network: Specify Wischain Sepolia as your default network by setting the
defaultNetwork
variable.
Configure Network Settings: Add the configuration for Wischain Sepolia within the
networks
section. This includes specifying the RPC URL for the Wischain Sepolia Testnet and the accounts you will use for deployment.
By following these steps, you will successfully set up your Hardhat environment to deploy applications to the Wischain Sepolia Testnet.
Additional Notes
Scaffold-Eth: This framework simplifies the process of building Ethereum applications, providing essential tools and configurations to streamline development.
Wischainscan: After deploying your application, you can monitor transactions and interactions on the Wischain Sepolia Testnet using Wischainscan, which provides insights and analytics for deployed contracts.
Make sure to fund your deployment wallet before proceeding! To create the wallet, run yarn generate
, and to check its balance, use yarn account
. After ensuring that the wallet is adequately funded, you can deploy your application on the Wischain Sepolia testnet by executing the command yarn deploy --network Wischainscan
.
Warning
In certain project forks, it may be necessary to disable contract verification that depends on Etherscan. This is important for maintaining compatibility and avoiding issues during the deployment process. You can achieve this by commenting out the relevant section in the file located at packages/hardhat/deploy/00_deploy_your_contract.js
.
For those using Wischainscan for verification, ensure that you adjust your settings accordingly to reflect this change. Disabling contract verification can help streamline the deployment process, particularly in scenarios where integration with external verification services is not required or feasible.
Configuring the Frontend for Wischain
To set up your frontend to work with the Wischain Sepolia Testnet, you'll need to add it as a network option and configure it as the default network. Here’s how to do that step by step:
Modify Network Constants: Begin by updating the network configurations in your project. Navigate to the
packages/react-app/src/constants.js
file. Here, you will define the properties of the Wischain Sepolia Testnet.Add the following code snippet to the
NETWORKS
object:
In this configuration:
name
: Identifies the network for display purposes.color
: A color code that can be used for UI elements associated with this network.chainId
: The unique identifier for the Wischain Sepolia Testnet.rpcUrl
: The URL for the remote procedure call endpoint that your application will use to interact with the network.blockExplorer
: The URL for the block explorer specific to the Wischain Sepolia Testnet.
Set the Initial Network: Next, update the initial network setting in your application. Open the
packages/react-app/src/App.jsx
file and locate the section where the initial network is defined. Change it to use the newly added Wischain Sepolia Testnet:
By completing these steps, your frontend will be configured to connect to the Wischain Sepolia Testnet. This setup allows you to interact with the blockchain, deploy contracts, and utilize the functionalities offered by the Wischain ecosystem effectively.
Last updated