Bitirium is a dApp integrated with Ethereum blockchain.
In Bitirium, users can deposit, withdraw and transfer Ethereum through the application.
Bitirium has its own ERC20 token, RIUM. Users can buy and sell $RIUM inside the app.
git clone https://github.com/sinanyamaan/bitirium.git
cd bitirium
npm install
Install Truffle by running
npm install truffle -g
https://trufflesuite.com/ganache/
- Open Ganache and click
New Workspace
. - In workspace tab, click
Add Project
button and select thetruffle-config.js
file. - Go to server tab and select the hostname as your local IP address (selection three) and set the network ID as 1337.
- Click on the
Save Workspace
button to get the workspace running. - Set the host as your local IP address in
truffle-config.js
// truffle-config.js
...
development: {
host: "192.168.0.0", // Your local IP address.
port: 7545,
network_id: "*",
},
...
For using an address as admin on the app, paste the address to the admin variable on 36th line in
Bitirium.sol
.//Bitirium.sol ... constructor() { address admin = 0x40EC82dfd76f17Ca42c8744AB9aA70787fA97234; // Your address. users[admin].isAdmin = users[admin].isUser = true; } ...
- First deploy the Bitirium.sol by running
truffle migrate --f 1 --to 1
- Copy the contract address and paste it in
src/Credentials.js
, and paste as first parameter of approve function on 56th line ofcontracts/RIUM.sol
- Then deploy the RIUM.sol by running
truffle migrate --f 2 --to 2
- Copy the contract address and paste it in
src/Credentials.js
- Set localhost variable in
src/Credentials.js
to your local IP address.
-
Open your browser and MetaMask Wallet.
-
Go to Settings > Networks > Add Network.
-
Enter:
Network Name: Ganache
New RPC URL: http://192.168.0.0:7545 // Your local IP address.
Chain ID: 1337
Currency Symbol: ETH -
Click
Save
.RPC URL and Chain ID must be same as Ganache.
- Go to Ganache > Accounts.
- Click the key icon on the right and copy the private key of the account that you want to import.
- Go to MetaMask > Import Account, paste the private key and click
Import
.
If you want to use your own accounts, you can send ETH by running
truffle consoleweb3.eth.sendTransaction({from: "0x00...00", to: "0x00...00", value: web3.utils.toWei("10")})with addresses you want to send, receive and amount of the Ether that will be sent as parameters.
Make sure you are on the master
branch with:
git checkout master
Start the application with:
npm start
MetaMask will ask you to connect your account.
Select the account you want to use and click Connect
.
After that you can use the application in the way you like!
You can deposit ETH in your account. |
You can withdraw ETH to your wallet. |
You can send Ether to your friends. |
You can buy and sell $RIUM. |
If you are an admin, you can do more! |
For testing the contracts, checkout to test
branch with:
git checkout test
then run:
npx hardhat test
Test result. |