Skip to content

Instantly share code, notes, and snippets.

@adrianhajdin
Last active February 24, 2025 09:29
Show Gist options
  • Save adrianhajdin/5f6cc61fa04de7b8fa250eb295db62fd to your computer and use it in GitHub Desktop.
Save adrianhajdin/5f6cc61fa04de7b8fa250eb295db62fd to your computer and use it in GitHub Desktop.
Build and Deploy a Modern Web 3.0 Blockchain App | Solidity, Smart Contracts
npm install --save-dev hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers
const commonStyles = "min-h-[70px] sm:px-0 px-2 sm:min-w-[120px] flex justify-center items-center border-[0.5px] border-gray-400 text-sm font-light text-white";
const main = async () => {
const transactionsFactory = await hre.ethers.getContractFactory("Transactions");
const transactionsContract = await transactionsFactory.deploy({ value: hre.ethers.utils.parseEther("0.001") });
await transactionsContract.deployed();
console.log("Transactions address: ", transactionsContract.address);
};
const runMain = async () => {
try {
await main();
process.exit(0);
} catch (error) {
console.error(error);
process.exit(1);
}
};
runMain();
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap");
* html {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
margin: 0;
font-family: "Open Sans", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gradient-bg-welcome {
background-color:#0f0e13;
background-image:
radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%),
radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
}
.gradient-bg-services {
background-color:#0f0e13;
background-image:
radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
radial-gradient(at 50% 100%, hsla(225,39%,25%,1) 0, transparent 50%);
}
.gradient-bg-transactions {
background-color: #0f0e13;
background-image:
radial-gradient(at 0% 100%, hsla(253,16%,7%,1) 0, transparent 50%),
radial-gradient(at 50% 0%, hsla(225,39%,25%,1) 0, transparent 50%);
}
.gradient-bg-footer {
background-color: #0f0e13;
background-image:
radial-gradient(at 0% 100%, hsla(253,16%,7%,1) 0, transparent 53%),
radial-gradient(at 50% 150%, hsla(339,49%,30%,1) 0, transparent 50%);
}
.blue-glassmorphism {
background: rgb(39, 51, 89, 0.4);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border: 1px solid rgba(0, 0, 0, 0.3);
}
/* white glassmorphism */
.white-glassmorphism {
background: rgba(255, 255, 255, 0.05);
border-radius: 16px;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border: 1px solid rgba(255, 255, 255, 0.3);
}
.eth-card {
background-color:#a099ff;
background-image:
radial-gradient(at 83% 67%, rgb(152, 231, 156) 0, transparent 58%),
radial-gradient(at 67% 20%, hsla(357,94%,71%,1) 0, transparent 59%),
radial-gradient(at 88% 35%, hsla(222,81%,65%,1) 0, transparent 50%),
radial-gradient(at 31% 91%, hsla(9,61%,61%,1) 0, transparent 52%),
radial-gradient(at 27% 71%, hsla(336,91%,65%,1) 0, transparent 49%),
radial-gradient(at 74% 89%, hsla(30,98%,65%,1) 0, transparent 51%),
radial-gradient(at 53% 75%, hsla(174,94%,68%,1) 0, transparent 45%);
}
.text-gradient {
background-color: #fff;
background-image: radial-gradient(at 4% 36%, hsla(0,0%,100%,1) 0, transparent 53%), radial-gradient(at 100% 60%, rgb(0, 0, 0) 0, transparent 50%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
@tailwind base;
@tailwind components;
@tailwind utilities;
module.exports = {
purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"],
mode: "jit",
darkMode: false, // or 'media' or 'class'
theme: {
fontFamily: {
display: ["Open Sans", "sans-serif"],
body: ["Open Sans", "sans-serif"],
},
extend: {
screens: {
mf: "990px",
},
keyframes: {
"slide-in": {
"0%": {
"-webkit-transform": "translateX(120%)",
transform: "translateX(120%)",
},
"100%": {
"-webkit-transform": "translateX(0%)",
transform: "translateX(0%)",
},
},
},
animation: {
"slide-in": "slide-in 0.5s ease-out",
},
},
},
variants: {
extend: {},
},
plugins: [require("@tailwindcss/forms")],
};
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract Transactions {
uint256 transactionCount;
event Transfer(address from, address receiver, uint amount, string message, uint256 timestamp, string account, string keyword);
struct TransferStruct {
address sender;
address receiver;
uint amount;
string message;
uint256 timestamp;
string account;
string keyword;
}
TransferStruct[] transactions;
function transfer(address payable receiver, uint amount, string memory message, string memory account, string memory keyword) public {
transactionCount += 1;
transactions.push(TransferStruct(msg.sender, receiver, amount, message, block.timestamp, account, keyword));
emit Transfer(msg.sender, receiver, amount, message, block.timestamp, account, keyword);
receiver.transfer(amount);
}
function getAllTransactions() public view returns (TransferStruct[] memory) {
return transactions;
}
function getTransactionCount() public view returns (uint256) {
return transactionCount;
}
}
@sakshi-engg
Copy link

@arpit3210 please help me out with above error!

@sakshi-engg
Copy link

Screenshot 2023-05-12 at 7 11 26 PM I have the exact same one, any solutions?

waiting for someone to answer. if you found the solution first please do share here

I couldn't find a solution, so I went with Web3.js instead of ethers.js, which works fine.

Hey @coder-elvish ...!! I'm getting the same error in my console so can you please guide me to convert ethers.js to Web3.js Or any another kind of solution. Your prompt response will be highly appreciated

@RishaMK
Copy link

RishaMK commented Oct 11, 2024

Screenshot 2023-05-12 at 7 11 26 PM I have the exact same one, any solutions?

waiting for someone to answer. if you found the solution first please do share here

I couldn't find a solution, so I went with Web3.js instead of ethers.js, which works fine.

Hey @coder-elvish ...!! I'm getting the same error in my console so can you please guide me to convert ethers.js to Web3.js Or any another kind of solution. Your prompt response will be highly appreciated

I was getting the same error... I did this and it seemed to work

const signer = await provider.getSigner(0);

@keshariamudit24
Copy link

when i click on send button this is what i am encountering can someone help?
btw i am using [email protected] which should work fine

Screenshot 2024-10-23 at 10 50 10 AM

@arpit3210

@Anu27n
Copy link

Anu27n commented Dec 18, 2024

I am getting this error whenever I am trying to run this command can someone help me out with this
~/Desktop/Projects/Web 3.0/smart_contract$ npx hardhat 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888 888 888 "88b 888P" d88" 888 888 "88b "88b 888 888 888 .d888888 888 888 888 888 888 .d888888 888 888 888 888 888 888 Y88b 888 888 888 888 888 Y88b. 888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888
Welcome to Hardhat v2.19.4
✔ What do you want to do? · Create a JavaScript project ✔ Hardhat project root: · /home/shounak/Desktop/Projects/Web 3.0/smart_contract ✔ Do you want to add a .gitignore? (Y/n) · y ✔ Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox)? (Y/n) · y
npm install --save-dev @nomicfoundation/hardhat-toolbox@^4.0.0 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/ethers npm ERR! dev ethers@"^5.7.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer ethers@"^6.1.0" from @nomicfoundation/[email protected] npm ERR! node_modules/@nomicfoundation/hardhat-ethers npm ERR! peer @nomicfoundation/hardhat-ethers@"^3.0.0" from @nomicfoundation/[email protected] npm ERR! node_modules/@nomicfoundation/hardhat-toolbox npm ERR! dev @nomicfoundation/hardhat-toolbox@"^4.0.0" from the root project npm ERR! peer @nomicfoundation/hardhat-ethers@"^3.0.0" from @nomicfoundation/[email protected] npm ERR! node_modules/@nomicfoundation/hardhat-chai-matchers npm ERR! peer @nomicfoundation/hardhat-chai-matchers@"^2.0.0" from @nomicfoundation/[email protected] npm ERR! node_modules/@nomicfoundation/hardhat-toolbox npm ERR! dev @nomicfoundation/hardhat-toolbox@"^4.0.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! /home/shounak/.npm/_logs/2024-01-10T16_25_39_454Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /home/shounak/.npm/_logs/2024-01-10T16_25_39_454Z-debug-0.log An unexpected error occurred.
false

Hi, did you find any solution to this?? I am having the same issue

Facing same issue any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment