Fees


EXAMPLE

A business has around 15 customers per day

Fees per day (Banks & credit cards)

Fees per year (Banks & credit cards) We can change this enormous number with some simple lines of code:

HetoPay(Beta)
// Import Web3 library
const Web3 = require('web3');

// Set up connection to Ethereum node
const web3 = new Web3('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID'); // Replace YOUR_INFURA_PROJECT_ID with your Infura project ID or use your local node URL

// Set up sender and receiver addresses
const senderAddress = '0xYourSenderAddress';
const receiverAddress = '0xYourReceiverAddress';

// Set up sender's private key (required for signing transactions)
const senderPrivateKey = 'YOUR_SENDER_PRIVATE_KEY'; // Replace with your sender's private key

// Set up payment amount (in ether)
const paymentAmount = web3.utils.toWei('0.1', 'ether'); // 0.1 ether

// Function to send payment
async function sendPayment() {
    try {
        // Sign transaction
        const signedTx = await web3.eth.accounts.signTransaction({
            to: receiverAddress,
            value: paymentAmount,
            gas: 21000, // Gas limit
            gasPrice: await web3.eth.getGasPrice(), // Get current gas price
            nonce: await web3.eth.getTransactionCount(senderAddress, 'pending'), // Get nonce (transaction count) for the sender address
        }, senderPrivateKey);

        // Send signed transaction
        const txReceipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
        console.log('Transaction hash:', txReceipt.transactionHash);
    } catch (error) {
        console.error('Error sending payment:', error);
    }
}

// Function to check balance of receiver
async function checkBalance() {
    try {
        // Get balance of receiver
        const balance = await web3.eth.getBalance(receiverAddress);
        console.log('Receiver balance:', web3.utils.fromWei(balance, 'ether'), 'ether');
    } catch (error) {
        console.error('Error checking balance:', error);
    }
}

// Call functions
sendPayment();
checkBalance();

With these simple lines of code, we can reduce the fees by 85% and increase sustainability by 90%!

Last updated