Skip to main content

Your First Transaction

This guide walks you through sending PRIM, deploying a simple contract, and viewing it on the explorer.

Prerequisitesโ€‹


Step 1: Send PRIMโ€‹

Using MetaMaskโ€‹

  1. Click Send in MetaMask.
  2. Enter the recipient address.
  3. Enter the amount in PRIM.
  4. Confirm the transaction.

Using ethers.jsโ€‹

import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('http://46.225.30.187:8545');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);

const tx = await wallet.sendTransaction({
to: '0xRecipientAddress',
value: ethers.parseEther('0.1'),
gasLimit: 21000,
});

console.log('Tx hash:', tx.hash);
await tx.wait();
console.log('Confirmed!');

Security Warning: Never use real private keys in code. Use environment variables or a key management solution. Never commit private keys to version control.


Step 2: Deploy a Simple Contractโ€‹

Deploy a minimal Solidity contract using ethers.js. First, compile your contract with Hardhat or Foundry, then deploy:

import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('http://46.225.30.187:8545');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);

// Load compiled artifact (from Hardhat: artifacts/contracts/Counter.sol/Counter.json)
const artifact = require('./artifacts/contracts/Counter.sol/Counter.json');
const factory = new ethers.ContractFactory(artifact.abi, artifact.bytecode, wallet);

const contract = await factory.deploy();
await contract.waitForDeployment();

console.log('Deployed at:', await contract.getAddress());

Security Warning: Never use real private keys in code. Use environment variables or a key management solution. Never commit private keys to version control.

Minimal Solidity example (Counter.sol):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Counter {
uint256 public count;

function increment() external {
count++;
}
}
tip

For production deployments, use Hardhat or Foundry to compile, test, and deploy. They handle compilation, gas estimation, and verification.


Step 3: View on the Explorerโ€‹

  1. Copy the transaction hash from your wallet or script output.
  2. Open the block explorer.
  3. Paste the hash into the search bar.
  4. View the transaction details, block number, gas used, and status.

For contract deployments, the explorer shows the contract address. You can click it to see the contract page and interact with it (if verified).


Summaryโ€‹

ActionTool
Send PRIMMetaMask or wallet.sendTransaction()
Deploy contractethers.js, Hardhat, Foundry, or Remix
View txhttp://46.225.30.187

Next, explore the developer guides to deploy production contracts with Hardhat or Foundry.