Smart Contract Wallet is a wallet as a deployed smart contract that can hold Ethereum and any ERC20 token. It can also send and receive Ethereum and ERC20 tokens.
contracts
: Smart contracts source codepublic
: Create React App public foldersrc
: The frontend source codesrc/web3
: Custom web3modal login logic
scripts
: Scripts for deploymenttest
: Unit testing
git clone https://github.com/chrisalexadams/blockchain-developer-bootcamp-final-project
cd blockchain-developer-bootcamp-final-project
code .
-
make a copy of
.env.example
and rename it to.env
-
fill in your credentials in
.env
-
npm i
-
npx hardhat compile
npx hardhat node
- You should see the following output:
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Accounts
========
WARNING: These accounts, and their private keys, are publicly known.
Any funds sent to them on Mainnet or any other live network WILL BE LOST.
- Then a list of 20 accounts will be displayed with 10000 ETH each.
npx hardhat run scripts/deploy.js --network localhost
- localhost is defined as port 8545 in
hardhat.config.js
- You should see the following output:
Deploying contracts with the account: 0x...
Account balance: 10000000000000000000000
Wallet address: 0x...
npx hardhat test --logs
In order to use the contract as your wallet, you (as the owner) need to deploy it to the testnet.
-
To deploy to your choice of Testnet Network, you can use the following command:
npx hardhat run scripts/deploy.js --network <testnet of choice>
-
To verify the source code, run this in the terminal:
npx hardhat verify --network <testnet of choice> DEPLOYED_CONTRACT_ADDRESS
The contract is deployed by me (the owner) on the Rinkeby Testnet with the contract source code verified engaging in all functions:
receiveERC20
sendERC20
sendEther
receive()
npm start
- Metamask Wallet
- Hardhat - Development framework and local blockchain
- React - Frontend framework
- Solidity - Ethereum smart contract language development
- Ethers - Library to interact with Ethereum nodes
- JavaScript - Front end and unit testing
- Infura - Connection to Ethereum
- Open Zeppelin - Smart contract libraries and interfaces