https://github.com/linhntaim/ethereum-simple-faucet-endpoint
Endpoint for Simple Faucet dApp
https://github.com/linhntaim/ethereum-simple-faucet-endpoint
dapp endpoint ethereum express faucet-crypto nodejs web3
Last synced: 2 months ago
JSON representation
Endpoint for Simple Faucet dApp
- Host: GitHub
- URL: https://github.com/linhntaim/ethereum-simple-faucet-endpoint
- Owner: linhntaim
- License: mit
- Created: 2023-07-03T08:04:28.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-08T08:18:02.000Z (about 2 years ago)
- Last Synced: 2025-03-16T20:45:19.228Z (7 months ago)
- Topics: dapp, endpoint, ethereum, express, faucet-crypto, nodejs, web3
- Language: JavaScript
- Homepage: https://freefaucet.dapp.io.vn/
- Size: 166 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ethereum-simple-faucet-endpoint
The endpoint provides an API for client to request to get fund from [the faucet contract](https://github.com/linhntaim/ethereum-simple-faucet-contract).
## Project setup
```
npm install
```### Build
```
npm run build
```### Serve
```
npm run serve
```### Build & Serve (for Development)
```
npm run dev
```## Configuration
_Note: The faucet contract is supported to be deployed to multiple chains._
### Contract address
The contract address which manages the fund on the EVM-compatible blockchain is an environment variable created in the following format:
```
FAUCET_CONTRACT_ADDRESS_{chain_id}={address}
```- `chain_id`: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.
- `address`: The address of the contract on the chain.It could be defined in the `.env` file.
### Contract owner's address
The contract owner's address is an environment variable created in the following format:
```
FAUCET_CONTRACT_OWNER_PRIVATE_KEY_{chain_id}={address}
```- `chain_id`: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.
- `address`: The address of the owner of the contract on the chain.It could be defined in the `.env` file.
### Contract ABI
The contract ABI is stored in `src/app/data/contract-abi.json`.
### Chain RPCs
The list of supported chain RPCs is stored in `src/app/data/supported-chains.json` with the following format:
```
{
"{chain_id}": {
"rpc": "{rpc_url}"
},
...
}
```## API
There is only an API provided:
### Claim API
```
POST /claim
```Body params:
- `chainId`: The ID of the chain in decimal (eg. Ethereum ID = 1, ..). See https://chainlist.org/.
- `address`: The address where the faucet should send the fund to.## How it works
```
|
\ /
+----------+
Client ---(request Claim API)---> | Endpoint |---(make a transaction from owner to contract)--+
/ \ +----------+ |
\ / |
\ / |
User <---(send fund, fee paid by owner)--- Smartcontract <---(call function)--- Chain RPC <--+```