├── Bitcoin
└── README.md
├── Celo
└── README.md
├── Chainlink
└── README.md
├── DigitalBits
└── README.md
├── Ethereum
├── BANK
│ ├── Bank.sol
│ └── README.md
├── README.md
└── TextBasedNFT
│ ├── README.md
│ ├── SSOC.sol
│ └── images
│ ├── functions.png
│ ├── mintNft.png
│ └── tokenURI.png
├── Filecoin
└── README.md
├── HyperledgerFabric
└── README.md
├── HyperledgerIroha
└── README.md
├── IPFS
└── README.md
├── Near
└── README.md
├── Neo
└── README.md
├── Pinata
├── README.md
└── UnpinScript
│ ├── ReadMe.md
│ └── unpin.js
├── Project_Details_Template.md
├── README.md
├── Ripple
└── README.md
├── Solana
└── README.md
├── Stack
└── README.md
├── Stellar
└── README.md
├── Tezos
└── README.md
├── Theta
└── README.md
└── pull_request_template.md
/Bitcoin/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Celo/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Chainlink/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/DigitalBits/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Ethereum/BANK/Bank.sol:
--------------------------------------------------------------------------------
1 | pragma solidity ^0.5.16;
2 |
3 | contract Bank{
4 | address payable owner;
5 | address payable receiver;
6 | address payable bank;
7 |
8 | uint No_of_Users = 0;
9 | uint No_of_Transactions = 0;
10 | uint No_of_WithdrawlRequest = 0;
11 |
12 |
13 | constructor() public{
14 | bank = msg.sender;
15 | }
16 |
17 | struct User{
18 | uint user_id;
19 | string fname;
20 | string lname;
21 | string pan_number;
22 | address payable user_address;
23 | uint created_on;
24 | uint available_balance;
25 | uint pending_balance;
26 | uint last_transaction_no;
27 | }
28 |
29 | mapping(address => User) User_list;
30 | mapping(address => bool) Bool_User_Exists;
31 |
32 | struct Transaction{
33 | uint transaction_id;
34 | uint amount;
35 | string sender;
36 | string receiver;
37 | address payable sender_address;
38 | address payable receiver_address;
39 | uint timestamp;
40 | string Type;
41 | bool pending;
42 | }
43 |
44 | mapping(uint => Transaction) public Transaction_list;
45 |
46 | struct Withdrawal{
47 | uint withdraw_id;
48 | uint transaction_id;
49 | address payable requesteduser;
50 | uint amount;
51 | uint timestamp;
52 | bool pending;
53 | }
54 |
55 | mapping(uint => Withdrawal) public Withdrawl_List;
56 |
57 | modifier User_Not_Exist(){
58 | require(Bool_User_Exists[msg.sender] == false, "You already have an account with same address.");
59 | _;
60 | }
61 |
62 | modifier User_Exist(){
63 | require(Bool_User_Exists[msg.sender] == true, "You don`t have an account with us.");
64 | _;
65 | }
66 |
67 | modifier Not_NULL()
68 | {
69 | require(msg.sender != address(0), "Null Address");
70 | _;
71 | }
72 |
73 | modifier Enough_Ether(uint amount) {
74 | require(msg.value >= amount, "You dont have enough ether in your wallet");
75 | _;
76 | }
77 |
78 | modifier Enough_Balance(uint amount) {
79 | require(amount < User_list[msg.sender].available_balance, "Insufficeint Balance");
80 | _;
81 | }
82 |
83 | modifier onlyBank() {
84 | require(msg.sender == bank, "Only Bank have authority to access this transaction");
85 | _;
86 | }
87 |
88 | modifier pending(uint id) {
89 | require(Withdrawl_List[id].pending == true, "Transaction already completed");
90 | _;
91 | }
92 |
93 | modifier Receiver_Exist(address payable Receiver){
94 | require(Bool_User_Exists[Receiver] == true, "Receiver don't have an account with us.");
95 | _;
96 | }
97 |
98 | // Create Account
99 | function Create_Account(string memory First_Name, string memory Last_Name, string memory PAN_Number) public payable User_Not_Exist() Not_NULL(){
100 | require(bytes(First_Name).length >= 0, "First Name can't be Empty");
101 | require(bytes(Last_Name).length >= 0, "Last Name can't be Empty");
102 | require(bytes(PAN_Number).length == 10, "Invalid PAN Number");
103 |
104 | No_of_Users++;
105 | User_list[msg.sender] = User(No_of_Users, First_Name, Last_Name, PAN_Number, msg.sender, now, 0,0, 0);
106 | Bool_User_Exists[msg.sender] = true;
107 | }
108 |
109 | // Deposit Balance
110 | function Deposit(uint amount) public payable Enough_Ether(amount) User_Exist() Not_NULL(){
111 | uint balance = User_list[msg.sender].available_balance;
112 | string memory firstname = User_list[msg.sender].fname;
113 |
114 |
115 | User_list[msg.sender].available_balance = balance + amount;
116 | User_list[msg.sender].pending_balance = User_list[msg.sender].available_balance;
117 | bank.transfer(amount);
118 | No_of_Transactions++;
119 | Transaction_list[No_of_Transactions] = Transaction(No_of_Transactions,amount,firstname,"Bank", msg.sender,bank,now,"Deposit",false);
120 | User_list[msg.sender].last_transaction_no = No_of_Transactions;
121 | }
122 |
123 | // Withdraw Balance
124 | function Withdraw(uint amount) public payable Enough_Balance(amount) User_Exist Not_NULL{
125 | uint balance = User_list[msg.sender].available_balance;
126 | string memory firstname = User_list[msg.sender].fname;
127 |
128 | // bank.transfer(amount);
129 | User_list[msg.sender].available_balance = balance - amount;
130 |
131 | No_of_Transactions++;
132 | Transaction_list[No_of_Transactions] = Transaction(No_of_Transactions,amount,"Bank",firstname,bank, msg.sender,now,"Withdraw", true);
133 | No_of_WithdrawlRequest++;
134 | Withdrawl_List[No_of_WithdrawlRequest] = Withdrawal(No_of_WithdrawlRequest, No_of_Transactions, msg.sender, amount, now, true);
135 | User_list[msg.sender].last_transaction_no = No_of_Transactions;
136 | }
137 |
138 | // Transfer Fund
139 | function Transfer(uint amount, address payable Receiver) public payable Enough_Balance(amount) User_Exist Receiver_Exist(Receiver) Not_NULL{
140 | uint sender_balance = User_list[msg.sender].available_balance;
141 | uint receiver_balance = User_list[Receiver].available_balance;
142 | string memory sender_firstname = User_list[msg.sender].fname;
143 | string memory receiver_firstname = User_list[Receiver].fname;
144 |
145 | // bank.transfer(amount);
146 | User_list[msg.sender].available_balance = sender_balance - amount;
147 | User_list[Receiver].available_balance = receiver_balance + amount;
148 |
149 | No_of_Transactions++;
150 | Transaction_list[No_of_Transactions] = Transaction(No_of_Transactions,amount,sender_firstname,receiver_firstname,msg.sender,Receiver, now,"Transfer", false);
151 | User_list[msg.sender].last_transaction_no = No_of_Transactions;
152 | }
153 |
154 | // Current Balance
155 | function Account_Details() public Not_NULL User_Exist returns (uint Account_Number, string memory First_Name, string memory Last_Name, string memory PAN_Number, uint Current_Balance, uint Pending_Balance, uint Last_Transaction_No){
156 | uint account_number = User_list[msg.sender].user_id;
157 | string memory first_name = User_list[msg.sender].fname;
158 | string memory last_name = User_list[msg.sender].lname;
159 | string memory pan = User_list[msg.sender].pan_number;
160 | address user = User_list[msg.sender].user_address;
161 | uint account_created_on = User_list[msg.sender].created_on;
162 | uint current_bal = User_list[msg.sender].available_balance;
163 | uint pending_bal = User_list[msg.sender].pending_balance;
164 | uint last_transaction_no = User_list[msg.sender].last_transaction_no;
165 |
166 | return (account_number,first_name,last_name,pan,current_bal,pending_bal,last_transaction_no);
167 | }
168 |
169 | // For Bank Only
170 | function Last_Pending_request() public onlyBank Not_NULL returns (uint Last_Pending_Withdrawl_Request_No){
171 | uint total_withdrawl_request = No_of_WithdrawlRequest;
172 | for (uint i = total_withdrawl_request; i >= 0; i--) {
173 | if(Withdrawl_List[i].pending == true)
174 | {
175 | return i;
176 | }
177 | }
178 | }
179 |
180 | // Accept Withdrawl request
181 | function Pending_Withdrawl_Request(uint id) public payable onlyBank Not_NULL pending(id) returns (string memory Message){
182 | address payable user = Withdrawl_List[id].requesteduser;
183 | uint amount = Withdrawl_List[id].amount;
184 | uint transaction_no = Withdrawl_List[id].transaction_id;
185 |
186 | if (msg.value >= amount)
187 | {
188 | user.transfer(amount);
189 | User_list[user].pending_balance = User_list[user].pending_balance - amount;
190 | Withdrawl_List[id].pending = false;
191 | Transaction_list[transaction_no].pending = false;
192 | return ("Transaction Successful");
193 | }
194 | else
195 | {
196 | User_list[user].available_balance = User_list[user].available_balance + amount;
197 | Withdrawl_List[id].pending = false;
198 | Transaction_list[transaction_no].pending = false;
199 | return ("Not Enough Ether To Accept This Request.");
200 | }
201 | }
202 | }
--------------------------------------------------------------------------------
/Ethereum/BANK/README.md:
--------------------------------------------------------------------------------
1 | # Bank : Smart Contract
2 |
3 | Here is a simple bank smart contract where you can
4 | 1. Create Account
5 | 2. Deposit Ether & convert it into account balance
6 | 3. Withdraw from account balance
7 | 4. Transfer balance (Within Bank)
8 | 5. Check account balance & details.
9 |
10 | After You request for amount withdrawl, your `available balance` will be reduced by the amount you requested & `pending balance` will be the previous `available balance` you requested until the transaction is approved by the bank else it will be reverted back to your account. (Just Like : NEFT, RTGS)
11 |
12 | `Note:` All deposit ethers are stored & withdrawl are done through the `Bank's` ether address. (Just like real banks collects your physical currency & in return they give you the same currency in digital form as account balance.)
13 |
14 | ---
15 | ## Tech Stack:
16 | 1. Ethereum
17 | 2. Solidity
18 | 3. Remix IDE
19 | ---
20 | ## Compile & Deploy:
21 |
22 | 1. Open **`Remix` IDE** from [here](https://remix.ethereum.org/).
23 | 2. Click on `Sure` and then `Done`.
24 | 3. Under `default_workshop`, click on `create new file`.
25 | 4. Rename it as `Bank.sol`.
26 |
27 | Now, click on the `Solidity Compile` option in the left sidebar.
28 |
29 | 5. Select compiler version `0.5.16+`
30 | 6. Then click on `Bank.sol`
31 |
32 | Click on the `Deploy & Run Transactions` option in the left sidebar.
33 |
34 | 7. Choose `Environment` > `JavaScript VM (London)`
35 | 8. Now click on `Deploy`
36 |
37 | ---
38 |
39 | ## Screenshots:
40 | ### 1. Account Created :
41 |
42 |
43 | ### 2. Deposit Ether :
44 |
45 |
46 | ### 3. Account Balance & Details :
47 |
48 |
49 | ### 4. Withdraw Request :
50 |
51 |
52 | >#### After Withdrawl Request Account Balance :
53 | >
54 |
55 | ### Approve Withdraw Request by Bank :
56 |
57 |
58 | >#### After approval Account Balance :
59 | >
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/Ethereum/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Ethereum/TextBasedNFT/README.md:
--------------------------------------------------------------------------------
1 | # NFT-ERC721
2 |
3 | ## Description
4 |
5 | It is a simple ERC721 token.
6 | It have a common TokenURI for all minted tokens.
7 | It uses text based svg as token image.
8 | Name of token is SSOC and it's symbol is SOC.
9 |
10 | ## How this is build
11 |
12 | I have build this smart contract using the [Foundry](https://github.com/foundry-rs/foundry) and the library openzeppelin contracts.
13 |
14 | ## Tech Stack Used
15 |
16 | I have used following tech stacks:-
17 |
18 | - Solidity
19 | - Foundry
20 | - Remix
21 | - OpenZeppelin
22 |
23 | ## Steps to Run
24 |
25 | To run it, we just have to copy the smart contract into [Remix ide](https://remix.ethereum.org/), remix automatically compiles the contract. Then we to just deploy, smart contract's constructor doesn't take any arguments. After deployment we can mint nft using mintNft function. That's all.
26 |
27 | ## Output Screenshots
28 |
29 | 
30 |
31 | 
32 |
33 | 
34 |
--------------------------------------------------------------------------------
/Ethereum/TextBasedNFT/SSOC.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL3
2 |
3 | pragma solidity ^0.8.7;
4 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5 |
6 | contract SSOC is ERC721 {
7 | uint256 private s_tokenIdCounter;
8 |
9 | // Event to be emitted when nft minted
10 | event CreatedNFT(uint256 indexed tokenId);
11 |
12 | // ERC721 is like the super class which we inherit to use all its properties and methods
13 | constructor() ERC721("SSOC", "SOC") {
14 | s_tokenIdCounter = 0;
15 | }
16 |
17 | function mintNft() public {
18 | // Mint a new token with s_tokenIdCounter as id
19 | _safeMint(msg.sender, s_tokenIdCounter);
20 |
21 | // Increment the counter
22 | s_tokenIdCounter = s_tokenIdCounter + 1;
23 |
24 | // Emitting the event of event creation with tokenId
25 | emit CreatedNFT(s_tokenIdCounter);
26 | }
27 |
28 | function _baseURI() internal pure override returns (string memory) {
29 | // Common URI for all token Ids
30 | return
31 | "data:application/json;base64,ewogICJuYW1lIjogIk5GVCBmb3IgU1NPQyIsCiAgImRlc2NyaXB0aW9uIjogIkEgc2ltcGxlIHRleHQgYmFzZWQgbmZ0IG1hZGUgZm9yIFNTT0MgYW5kIHVkZXIgdGhlIHByb2plY3Qgd2ViMy1odWIiLAogICJhdHRyaWJ1dGVzIjogW3sgInRyYWl0X3R5cGUiOiAic2ltcGxlIiwgInZhbHVlIjogMSB9XSwKICAiaW1hZ2UiOiAiZGF0YTppbWFnZS9zdmcreG1sO2Jhc2U2NCxQSE4yWnlCMmFXVjNRbTk0UFNJd0lEQWdNakF3SURJd01DSWdkMmxrZEdnOUlqUXdNQ0lnSUdobGFXZG9kRDBpTkRBd0lpQjRiV3h1Y3owaWFIUjBjRG92TDNkM2R5NTNNeTV2Y21jdk1qQXdNQzl6ZG1jaVBnb2dJRHhqYVhKamJHVWdZM2c5SWpFd01DSWdZM2s5SWpFd01DSWdabWxzYkQwaWVXVnNiRzkzSWlCeVBTSTNPQ0lnYzNSeWIydGxQU0ppYkdGamF5SWdjM1J5YjJ0bExYZHBaSFJvUFNJeklpOCtDaUFnUEdjZ1kyeGhjM005SW1WNVpYTWlQZ29nSUNBZ1BHTnBjbU5zWlNCamVEMGlOakVpSUdONVBTSTRNaUlnY2owaU1USWlMejRLSUNBZ0lEeGphWEpqYkdVZ1kzZzlJakV5TnlJZ1kzazlJamd5SWlCeVBTSXhNaUl2UGdvZ0lEd3ZaejRLSUNBOGNHRjBhQ0JrUFNKdE1UTTJMamd4SURFeE5pNDFNMk11TmprZ01qWXVNVGN0TmpRdU1URWdOREl0T0RFdU5USXRMamN6SWlCemRIbHNaVDBpWm1sc2JEcHViMjVsT3lCemRISnZhMlU2SUdKc1lXTnJPeUJ6ZEhKdmEyVXRkMmxrZEdnNklETTdJaTgrQ2p3dmMzWm5QZz09Igp9";
32 | }
33 |
34 | // URI of token includes text svg as image
35 | function tokenURI(
36 | uint256 /* tokenId */
37 | ) public pure override returns (string memory) {
38 | string memory TOKEN_URI = _baseURI();
39 | return TOKEN_URI;
40 | }
41 |
42 | // total number of tokens minted
43 | function getTokenCounter() public view returns (uint256) {
44 | return s_tokenIdCounter;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Ethereum/TextBasedNFT/images/functions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samodev/web3-hub/e5956d370b2c25c1300b62be30fe47daf07b5248/Ethereum/TextBasedNFT/images/functions.png
--------------------------------------------------------------------------------
/Ethereum/TextBasedNFT/images/mintNft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samodev/web3-hub/e5956d370b2c25c1300b62be30fe47daf07b5248/Ethereum/TextBasedNFT/images/mintNft.png
--------------------------------------------------------------------------------
/Ethereum/TextBasedNFT/images/tokenURI.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samodev/web3-hub/e5956d370b2c25c1300b62be30fe47daf07b5248/Ethereum/TextBasedNFT/images/tokenURI.png
--------------------------------------------------------------------------------
/Filecoin/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/HyperledgerFabric/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/HyperledgerIroha/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/IPFS/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Near/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Neo/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Pinata/README.md:
--------------------------------------------------------------------------------
1 | # web3-hub
--------------------------------------------------------------------------------
/Pinata/UnpinScript/ReadMe.md:
--------------------------------------------------------------------------------
1 | # JS script to unpin all files from pinata ipfs
2 |
3 | Added a JS script file (unpin.js) that can be used to unpin all the files from Pinata IPFS using a function where the user needs to pass on their Pinata API Key and Pinata API secret Key.
4 |
5 | ## How this is built
6 |
7 | - To interact with Pinata API through JavaScript, axios npm library is being used
8 | - The function **userPinList** fetches all the records for the content currently pinned by passing the pinataApiKey and pinataSecretApiKey, stores the ipfs_pin_hash for each pinned file
9 | in a list (pinnedFiles) and calls the function **unPinFiles** to unpin all the files.
10 | - In the function **removePinFromIPFS**, we pass in the pin we wish to remove from Pinata and set it as the value for the "hashToUnpin" key in our request URL. This function is used to unpin a single file.
11 | - The function **unPinFiles** iterates overs the list of the CID's of pinned files and unpins each file using removePinFromIPFS function.
12 |
13 | ## Tech Stack Used
14 |
15 | - JavaScript
16 | - axios npm library
17 |
18 | ## Steps to Run
19 |
20 | Just call the function **userPinList** from the script by passing the user's pinataApiKey and pinataSecretApiKey as arguments.
21 |
22 | ## Output Screenshots(Required)
23 |
24 | 
25 |
26 |
--------------------------------------------------------------------------------
/Pinata/UnpinScript/unpin.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | var pinnedFiles = [];
3 |
4 | // function to unpin a single file with provided hash
5 | const removePinFromIPFS = (pinataApiKey, pinataSecretApiKey, hashToUnpin) => {
6 | const url = `https://api.pinata.cloud/pinning/unpin/${hashToUnpin}`;
7 | return axios
8 | .delete(url, {
9 | headers: {
10 | pinata_api_key: pinataApiKey,
11 | pinata_secret_api_key: pinataSecretApiKey
12 | }
13 | })
14 | .then(function (response) {
15 | console.log("Unpinned Successfully!")
16 | })
17 | .catch(function (error) {
18 | console.log(error);
19 | });
20 | };
21 |
22 | // Iterating through all the pins and unpinning them
23 | const unPinFiles = (pinataApiKey, pinataSecretApiKey, pinnedFiles) => {
24 | for(var i=0; i {
32 |
33 | const url = `https://api.pinata.cloud/data/pinList?status=pinned`;
34 | return axios
35 | .get(url, {
36 | headers: {
37 | pinata_api_key: pinataApiKey,
38 | pinata_secret_api_key: pinataSecretApiKey
39 | }
40 | })
41 | .then(function (response) {
42 | for(var i=0; i