Skip to content

kic0/FCMP--Testnet-Faucet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monero Testnet Faucet

A simple web application with a backend for a Monero testnet faucet. It provides a web UI and an API endpoint to request testnet XMR.

Examples:

Requirements

  • Node.js
  • A running monero-wallet-rpc instance with a funded testnet wallet.

Installation

  1. Clone the repository:
    git clone https://github.com/kic0/FCMP--Testnet-Faucet
    cd FCMP--Testnet-Faucet
  2. Install dependencies:
    npm install

Configuration

1. Run monero-wallet-rpc

You need a testnet wallet with some funds. First, create a directory for your wallets (e.g., /home/user/monero-wallets). Then, start the RPC server, pointing it to that directory:

monero-wallet-rpc \
  --rpc-bind-port 28088 \
  --wallet-dir /home/user/monero-wallets \
  --password your-wallet-password \
  --rpc-login monero:rpcPassword \
  --testnet \
  --log-file logs/monero-wallet-rpc.log \
  --non-interactive

Note: Your faucet wallet file (e.g., faucet-wallet) must be located inside the directory specified by --wallet-dir. You may need to create this wallet first using monero-wallet-cli and move it there.

2. Set Environment Variables

The backend server is configured using environment variables. Before running the server, you must set the following variables.

export RPC_USER="monero"
export RPC_PASSWORD="rpcPassword"
# This must be the FILENAME of the wallet inside the wallet-dir
export WALLET_FILE="faucet-wallet"
export WALLET_PASSWORD="your-wallet-password"

# Optional, defaults are shown:
# export RPC_HOST="127.0.0.1"
# export RPC_PORT="28088"

Usage

  1. Start the server:

    npm start

    The server will start and be accessible at http://<your-server-ip>:3000.

  2. Use the Web Interface: Open your web browser and navigate to http://<your-server-ip>:3000 (or your server's IP address if running remotely). The current faucet balance is displayed at the top. Enter your testnet wallet address and click the "Request 1 XMR" button to receive funds.

API Usage (Optional)

The API provides two endpoints:

  • GET /faucet/balance: Fetches the current balance of the faucet wallet.
  • POST /faucet/send: Sends funds to a specified address.

Example using curl to send funds:

curl -X POST -H "Content-Type: application/json" \
  -d '{"address": "YOUR_TESTNET_WALLET_ADDRESS", "amount": "1"}' \
  http://0.0.0.0:3000/faucet/send

A successful request will return a JSON response like this:

{
  "success": true,
  "message": "Sent 1 XMR to YOUR_TESTNET_WALLET_ADDRESS",
  "txHash": "a_transaction_hash"
}

Disclaimer

This is a proof-of-concept and should be used for testing purposes only. Ensure your monero-wallet-rpc is not exposed to the public internet without proper security measures. This code was generated using an AI.

If for some reason you feel like donating 46hHveE5bAQHv6AE9bbYSJMsJupA2je1BFBUYLmMp899i2yMC8MEn35QiUEZiS2Scd5QGKFrcDk5yZCxL91Rtm9FAz44MMA

About

A Monero Testnet Faucet for the upcoming FCMP++ updates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors