Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoW Faucet #16

Merged
merged 67 commits into from
Aug 25, 2023
Merged

PoW Faucet #16

merged 67 commits into from
Aug 25, 2023

Conversation

harryttd
Copy link
Contributor

@harryttd harryttd commented Aug 4, 2023

Backend changes for PoW faucet: oxheadalpha/tezos-faucet-backend#2

This pull request includes a significant update to the Tezos Faucet Frontend. The primary changes include:

  1. Proof of Work (PoW) Challenge: The faucet now includes a PoW challenge(s) to ensure secure and fair Tez distribution. This mechanism discourages bots and other malicious actors from exploiting the faucet. The application flow has been updated to include the PoW challenge. The frontend communicates with the backend to receive and solve challenges before Tez is sent to the user's account.
  2. A webworker file was added that runs the PoW code to find a challenge solution.
  3. Programmatic Faucet Usage: A getTez.js script has been added for programmatic faucet usage. This script can be run from a JavaScript program or directly from a shell.
  4. Switched from slow CRACO to Vite.
  5. Removal of Unused Files: Several unnecessary files have been removed from the repository
  6. Application rebuilding no longer happens every time the app restarts. It's built once when the image is built.
  7. config.json has been moved to the /public folder and instead of using import to use it, we use fetch. This allows us to switch up values in the config and not need to re-build the app on every start.
  8. index.html Update: The index.html file has been updated with new meta tags and a script tag to load the main application file.
  9. Dockerfile Update: The Dockerfile has been updated to use node:20-alpine and includes changes to the order of operations for better layer caching.
  10. package.json Update: The package.json file has been updated to reflect the new version of the application and the updated description. Also unused packages have been removed and outdated packages updated. Some new packages have been added.
  11. Refactoring of FaucetRequestButton Component: The FaucetRequestButton component has been refactored to include new functions for starting and stopping loading, executing captcha, solving PoW, getting Tez, getting challenge, and verifying solution. The component now uses the useRef hook for the recaptchaRef and the useState hook for isLocalLoading. The useEffect hook is used to ensure that isLocalLoading is false if the user cancels the PoW worker.
  12. FaucetToInputRequest Component Update: The FaucetToInputRequest component has been updated to validate the input address using the validateKeyHash function from the @taquito/utils package. The component now also disables the input field when the status is loading. It now gives the user feedback if the address inputed is invalid.
  13. FaucetToWalletRequest Component Update: The FaucetToWalletRequest component has been updated to disable the request button when the user address is not available or the status is loading.
  14. SplittedFaucet Component Update: The SplittedFaucet component has been updated to include a new state for the PoW worker and a new state for showing the PoW progress. The component now also includes a button for hiding the alert.
  15. Footer Component Update: The Footer component has been updated to include links to Oxhead Alpha's website, GitHub, Medium, and Twitter. The footer is fixed to the bottom of the page. The APP_DESCRIPTION and APP_VERSION are now imported from the environment variables. The package.json is no longer part of the application's build.
  16. Header Component Update: The Header component has been updated to include the Oxhead Alpha logo and a link to the Oxhead Alpha website. The Navbar is now fixed to the top.
  17. CSS Update: The CSS has been updated to include padding for the header and footer, a z-index for the grecaptcha badge, and other minor changes.
  18. index.tsx Update: The index.tsx file has been updated to include a polyfill for the Buffer object and a workaround for console.log in development mode.

Copy link
Collaborator

@nicolasochem nicolasochem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm especially thrilled about no longer having to build the app at runtime. Please ship ⛵

@harryttd harryttd merged commit 4512cb5 into main Aug 25, 2023
2 checks passed
@harryttd harryttd deleted the pow branch August 25, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants