Plasma is fully EVM compatible, allowing you to use standard Ethereum tooling while benefiting from features optimized for stablecoin-native applications. To learn more about Plasma’s architecture details, see the Architecture Overview section.
Verify RPC Connectivity
A public RPC endpoint is available at testnet-rpc.plasma.to
:
curl --location --header 'Content-Type: application/json' --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
This should output something like:
{"jsonrpc":"2.0","id":1,"result":"0x9f61b"}
This endpoint is rate-limited. For production use or high-frequency requests, consider using a partner RPC provider.
Below are examples for Hardhat and Truffle:
Hardhat
Create or modify your hardhat.config.js
file to include Plasma testnet settings:
module.exports = {
networks: {
// Plasma testnet
plasmaTestnet: {
url: "https://testnet-rpc.plasma.to",
chainId: 9746,
accounts: [<YOUR_PRIVATE_KEYS>]
}
},
solidity: {
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
};
Truffle Configuration
If you’re using Truffle, update your truffle-config.js
:
const HDWalletProvider = require('@truffle/hdwallet-provider');
module.exports = {
networks: {
plasmaTestnet: {
provider: () => new HDWalletProvider(
"<YOUR_MNEMONIC_HERE>",
"https://testnet-rpc.plasma.to",
),
network_id: 9746,
gas: 5500000,
}
},
compilers: {
solc: {
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
}
};
Wallet Integration
Web3.js Integration
const Web3 = require('web3');
const web3 = new Web3('https://testnet-rpc.plasma.to');
// Check connection
web3.eth.getBlockNumber()
.then(blockNumber => console.log('Connected to Plasma node. Current block:', blockNumber))
.catch(error => console.error('Connection error:', error));
Ethers.js Integration
const { ethers } = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://testnet-rpc.plasma.to');
// Check connection
provider.getBlockNumber()
.then(blockNumber => console.log('Connected to Plasma node. Current block:', blockNumber))
.catch(error => console.error('Connection error:', error));
Validate Setup
Create a simple script to verify your development environment is correctly set up:
const { ethers } = require('ethers');
async function testSetup() {
// Connect to the Plasma node.
const provider = new ethers.providers.JsonRpcProvider('https://testnet-rpc.plasma.to');
// Get network information.
const network = await provider.getNetwork();
console.log('Connected to network:', network);
// Get current block number.
const blockNumber = await provider.getBlockNumber();
console.log('Current block number:', blockNumber);
// Get account balances.
const signer = provider.getSigner();
const address = await signer.getAddress();
const balance = await provider.getBalance(address);
console.log('Account address:', address);
console.log('Balance:', ethers.utils.formatEther(balance), 'ETH');
}
testSetup()
.then(() => console.log('Setup test completed successfully'))
.catch(error => console.error('Setup test failed:', error));
Troubleshooting
Issue | Action |
---|
Connection refused | Confirm RPC endpoint is correct and accessible |
Gas estimation failed | Ensure wallet has sufficient XPL |
Solidity version error | Update config to match compiler version supported by Plasma |
Transaction fails | Verify RPC URL and correct chain ID: 9746 for testnet, 9747 for local devnet |