{"id":22766650,"url":"https://github.com/vinhyenvodoi98/two-factor-authentication-ethereum","last_synced_at":"2026-05-01T15:33:28.602Z","repository":{"id":101608899,"uuid":"195201081","full_name":"vinhyenvodoi98/Two-Factor-Authentication-Ethereum","owner":"vinhyenvodoi98","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-06T10:23:58.000Z","size":49,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-05T12:34:04.496Z","etag":null,"topics":["2fa","2fa-client","2fa-ethereum","ethereum"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinhyenvodoi98.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-04T08:28:33.000Z","updated_at":"2019-08-25T09:28:23.000Z","dependencies_parsed_at":"2023-06-06T10:00:08.977Z","dependency_job_id":null,"html_url":"https://github.com/vinhyenvodoi98/Two-Factor-Authentication-Ethereum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinhyenvodoi98%2FTwo-Factor-Authentication-Ethereum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinhyenvodoi98%2FTwo-Factor-Authentication-Ethereum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinhyenvodoi98%2FTwo-Factor-Authentication-Ethereum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinhyenvodoi98%2FTwo-Factor-Authentication-Ethereum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinhyenvodoi98","download_url":"https://codeload.github.com/vinhyenvodoi98/Two-Factor-Authentication-Ethereum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246307932,"owners_count":20756478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","2fa-client","2fa-ethereum","ethereum"],"created_at":"2024-12-11T13:13:32.812Z","updated_at":"2026-05-01T15:33:23.571Z","avatar_url":"https://github.com/vinhyenvodoi98.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ethereum Two Factor Authentication\n\n## Basic Functionality Story\n\n1. Users register with information such as username, password, name and **wallet address** .\n2. Information is stored in the database .\n3. User login as usually and backend migrate a new contract and send contract address to user\n4. User sends a transaction (does not send ETH, only calls the contract function and pays the gas fee) to the 2FA contract.\n5. Backend check that contract have authenticated or not\n6. User is authenticated.\n\n## Getting Started\n\nDependencies:\n\n### Backend\n\n- Node v7.6+ (NodeJs)\n\n### Frontend\n\n- ReactJs\n\n### Blockchain\n\n- Truffle\n- Rinkeby network\n- Metamask\n\n# Setup .env\n\nCreate .env file\n\n```js\nMNEMONIC = 'YOUR MNEMONIC',\nINFURA_KEY = \u003cYOUR INFURA KEY\u003e\n```\n\nCreate .enc in /backend\n\n```js\nMONGODB_URI = 'LINK TO MONGODB', //like : MONGODB_URI = 'mongodb://dohoang123:dohoang123@ds347467.mlab.com:47467/2fa-ethereum',\nMNEMONIC = \u003cYOUR MNEMONIC\u003e\nINFURA_KEY = \u003cYOUR INFURA KEY\u003e\n```\n\n# Install local dependencies\n\nIn **_./_** and **_./backend_** and **_./frontend_**\n\n```sh\nnpm install\n```\n\nor\n\n```sh\nyarn install\n```\n\n# Run testnet\n\n## If run on local network\n\nset up HDWalletProvider in contractWithBlockchain.js to any network you want\n\n```js\nlet provider = new HDWalletProvider(\n  process.env.MNEMONIC,\n  `https://rinkeby.infura.io/v3/${process.env.INFURA_KEY}`\n);\n```\n\nand then\n\n```sh\nyarn truffle develop --network truffleTestnet\n```\n\nThen run the console\n\n```sh\nyarn truffle console --network truffleTestnet\n```\n\n# If you run in testnet make sure your accout have eth\n\nRun script in truffle develop\n\n```js\n// send 1 eth\nweb3.eth.sendTransaction({\n  from: accounts[0],\n  to: 'YOUR ACCOUNT ADDRESS',\n  value: web3.utils.toWei('1', 'ether')\n});\n```\n\n# Deploy contract\n\n## If you run on local network\n\nAfter fauct eth from account(0) , now you have enough eth to deploy\n\n```sh\nyarn truffle migrate --reset --network truffleTestnet\n```\n\n## If you run on Rinkeby network\n\n```sh\nyarn truffle migrate --network rinkeby\n```\n\n# Start server\n\n```sh\ncd backend/\nyarn\nyarn start\n```\n\n# Start client\n\n```sh\ncd frontend/\nyarn\nyarn start\n```\n\n```bash\n\n# In a new terminal window, run the truffle tests\n\ntruffle test\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinhyenvodoi98%2Ftwo-factor-authentication-ethereum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinhyenvodoi98%2Ftwo-factor-authentication-ethereum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinhyenvodoi98%2Ftwo-factor-authentication-ethereum/lists"}