Skip to content

rafiulhc/Name-Registry-Smart-Contract

Repository files navigation


Front-running and malicious node/validator resistant smart contract, written in Solidity to register vanity names/domains on EVM Blockchains

Table of Contents
  1. Inspiration
  2. About The Project
  3. Getting Started
  4. Testing
  5. Usage
  6. Contributing
  7. License
  8. Contact

Smart Contract Deplyed to Ethereum Rinkeby Testnet

Contract Address

0x6b3198d1a1b29156A2a99f01948e298A64bb86a3

deployed_to_rinkeby_testnet

Smart Contract Registered to Oracle testnet for checking expiration of name registration after every 24 hours automatically

Step: 1

Chainlink_upkeep

Step: 2

Chainlink

Step: 3

Active Oracle

Inspiration

Blockchain technology enables decentralized applications (DApps) or smart contracts. Function calls (or transactions) to the DApp are processed by a decentralized network. Transactions are finalized in stages: they (generally) first relay around the network, then are selected by a miner and put into a valid block, and finally, the block is well-enough incorporated in the blockchain that is unlikely to be changed. Front-running is an attack where a malicious node observes a transaction after it is broadcast but before it is finalized, and attempts to have its own transaction confirmed before or instead of the observed transaction.

In this application I followed Consensys provided guideline to prevent frontrun and malicious activities by validator. Suggestion is to store the keccak256 hash of the data in the first transaction, then reveal the data and verify it against the hash in the second transaction.

About The Project

Front-running and malicious node/validator resistant smart contract, written in Solidity to register vanity names/domains on EVM Blockchains. An unregistered name can be registered for a certain amount of time by locking a certain balance of an account. After the registration expires, the account loses ownership of the name and his balance is unlocked. The registration can be renewed by making an on-chain call to keep the name registered and balance locked. The fee to register the name depends directly on the size of the name. Also, a malicious node/validator should not be able to front-run the process by censoring transactions of an honest user and registering its name in its own public address.

(back to top)

Built With

(back to top)

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
    npm install npm@latest -g

Installation

  1. Clone the repo
    git clone https://github.com/rafiul86/Name-Registry-Smart-Contract.git
  2. Install NPM packages
    npm install

(back to top)

Change the secret variables as process.env.SECRET_KEY and process.env.ALCHEMY provided by API provider if deploy to mainnet (Ethereum, Binance, Fantom, Avalanche etc.) or remote testnet(rinkeby, ropsten, goerli etc.)

  npx hardhat compile
  npx hardhat run --network rinkeby scripts/deploy.js

Secret Variables

Testing

npx hardhat compile
npx hardhat run --network localhost scripts/deploy.js
npx hardhat test

After running the commands in terminal should show the tests results....

Tests

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

None

(back to top)

Contact

Rafiul Hasan - Linkedin Twitter - rafiulhasan86@gmail.com

Project Link: https://github.com/rafiul86/Name-Registry-Smart-Contract

(back to top)

About

Front-running and malicious node/validator resistant smart contract, written in Solidity to register vanity names/domains on EVM Blockchains

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published