
This repository contains a Node.js-based service for selling assets on the Ravencoin and Evrmore blockchains. The service automates the process of monitoring payments and sending tokens in exchange for received payments. You only interact with buyers/customers on the chain. There is no graphical user interface for the end user.
Explaining how to use this service and teaching everything you need to know to get it running is HARDER than writing the code ;)
So you want to sell LEMONADE tokens for the price of 10 RVN.
You install/setup this service and configure "jobs" in a new file called jobs.json that you create.
In that file, you define that you want to sell LEMONADE tokens, 1 at a time for the price of 10 RVN.
And, this is important, you need two wallets (as 12-word mnemonic keys):
Demo video: https://youtu.be/eCeMN5yx11U
This is the end-user-facing wallet. It is the wallet that end users will pay to.
This is also the wallet that will hold the LEMONADE tokens that you want to sell.
When you start the service, it will print out an address for this wallet.
So make sure you fill it up with lovely LEMONADE tokens.
This is where the funds are deposited. After each purchase, the remaining funds will end up here.
- Payment Monitoring: Automatically monitors incoming payments (UTXOs) to a specified wallet.
- Token Sending: Sends tokens back to the payer upon receiving a valid payment.
- Customizable Jobs: Configure asset sales with specific amounts, prices, and wallets.
- Error Handling: Graceful error management to ensure reliability.
- UTXO Tracking: Prevents double-spending or reprocessing of UTXOs by tracking already processed transactions.
- You need to have Git installed.
- You need to have Node.js installed.
-
Clone the Git repository:
git clone https://github.com/ravenrebels/rebel-vending-machine.git -
Install dependencies:
- Change directory: cd rebel-vending-machine
- Install dependencies: npm install
-
Configure the service:
Create a file called jobs.json in the current directory with the following content:
[
{
"amount": 1,
"assetName": "DRUNK",
"price": 10,
"externalWallet": "<12-word mnemonic>",
"internalWallet": "<12-word mnemonic>",
"network": "rvn"
}
]
This configuration specifies that upon receiving 10 RVN on the Ravencoin network, the service will send 1 "DRUNK" asset to the payer.
You need to modify the content according to your requirements.
You must generate two wallets, for example, using https://ravencoin.org/bip44/.
Remember, a wallet is just a 12-word mnemonic.
- Ravencoin testnet is supported; use "network": "rvn-test".
- Evrmore mainnet is supported; use "network": "evr".
-
Start the service:
Run the command: npm start
The service will display its external address.
Send the assets you want to sell to this address.
Example output: External address mp6V9b8Kpufq1WLan6Xe5pfa1S1dzt5zaX -
The service will continuously monitor incoming payments and process jobs as defined in jobs.json.
-
Logs will provide information about:
- Incoming payments
- Sent tokens
- Skipped or failed transactions
- Wallet Mnemonics: Store your wallet mnemonics securely and do not share them publicly.
- Local Access: If you expand this service with a web GUI or API, ensure it only accepts requests from localhost or implement robust authentication to enhance security.
Contributions are welcome! Feel free to fork this repository and submit pull requests for improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have questions, feel free to open an issue in this repository.
For more information and support, visit the Raven Rebels GitHub repository:
https://github.com/ravenrebels
For a visual demonstration of the Rebel Vending Machine in action, you can watch the following video:
Rebel Vending Machine Demonstration: https://www.youtube.com/watch?v=cNyhnypl0Kk