Interaction tools
Geth
Interact with your Oasis Sapphire node using Geth.- Install Geth.
- Use
geth attach
command with the node endpoint. - Invoke any methods from Web3 JavaScript API.
MetaMask
On node access details, click Add to MetaMask.Development tools
Hardhat
Configure Hardhat to deploy contracts and interact through your Oasis Sapphire nodes.- Install Hardhat and create a project.
- Install the sapphire-hardhat plugin.
- Install the dotenv package to securely load your sensitive variables from a
.env
file. - Create a new environment in
hardhat.config.js
:
- YOUR_CHAINSTACK_ENDPOINT — your node HTTPS or WSS endpoint protected either with the key or password. See node access details.
- YOUR_PRIVATE_KEY — the private key of the account that you use to deploy the contract
- Run
npx hardhat run --network sapphire_testnet scripts/deploy.js
, and Hardhat will deploy using Chainstack.
web3.js
Build DApps using web3.js and Oasis Sapphire nodes deployed with Chainstack.- Install web3.js.
- Connect over HTTP or WebSocket.
HTTPS
Use theHttpProvider
object to connect to your node HTTPS endpoint and get the latest block number:
WSS
Use theWebsocketProvider
object to connect to your node WSS endpoint and get the latest block number:
node.js
You can build a web app to query data using node.js and axios:- YOUR_CHAINSTACK_ENDPOINT — your Chainstack node endpoint protected either with the key or password. See node access details.
query
— your JSON-RPC query. In this case, to get the latest block number.
ethers.js
Build DApps using ethers.js and Oasis Sapphire nodes deployed with Chainstack.- Install ethers.js.
- Connect over HTTPS or WebSocket. See also EVM node connection: HTTP vs WebSocket.
HTTPS
Use theJsonRpcProvider
object to connect to your node endpoint and get the balance of any address:
- YOUR_CHAINSTACK_ENDPOINT — your node HTTPS endpoint protected either with the key or password
-
NETWORK_ID — Oasis Sapphire network ID:
- Mainnet:
23294
- Testnet:
23295
- Mainnet:
- ACCOUNT_ADDRESS — the Oasis Sapphire account address
WebSocket
Use theWebSocketProvider
object to connect to your node WSS endpoint and get the latest block number:
- YOUR_CHAINSTACK_ENDPOINT — your node WSS endpoint endpoint protected either with the key or password
-
NETWORK_ID — Oasis Sapphire network ID:
- Mainnet:
23294
- Testnet:
23295
- Mainnet:
- ACCOUNT_ADDRESS — the Oasis Sapphire account address
Remix IDE
To make Remix IDE interact with the network through a zkEVM node deployed with Chainstack:- Get MetaMask and set it to interact through a Chainstack node. See Oasis Sapphire tooling: MetaMask.
- In Remix IDE, navigate to the Deploy tab. Select Injected Provider - MetaMask in Environment.