How to connect to MAAL Chain
You can use our public rpc-urls to connect to our blockchain and interact with it.
const Web3 = require('web3');
const rpcUrl = 'https://node1-mainnet.maalscan.io';
const web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl));
// Construct and send a transaction
const senderAddress = '0x...'; // Your sender's address
const privateKey = '0x...'; // Your sender's private key
const receiverAddress = '0x...'; // Receiver's address
const valueToSend = web3.utils.toWei('0.1', 'ether');
const nonce = await web3.eth.getTransactionCount(senderAddress);
const gasPrice = await web3.eth.getGasPrice();
const txObject = {
nonce: nonce,
to: receiverAddress,
value: valueToSend,
gasPrice: gasPrice,
gas: 21000, // Gas limit for standard transactions
};
const signedTx = await web3.eth.accounts.signTransaction(txObject, privateKey);
const txHash = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
console.log('Transaction Hash:', txHash);
// Get transaction receipt
const receipt = await web3.eth.getTransactionReceipt(txHash);
console.log('Transaction Receipt:', receipt);
// Get transaction details by hash
const txDetails = await web3.eth.getTransactionByHash(txHash);
console.log('Transaction Details:', txDetails);
// Get transaction count of an address
const transactionCount = await web3.eth.getTransactionCount(senderAddress);
console.log('Transaction Count:', transactionCount);Last updated