A tiny REST API for Electrum-LTC which lets you create wallets, check balances, send Litecoin. Written in Rust :).
Make sure you have:
- Rust 1.85+
- Electrum-LTC (the
daemoncommand is required)
commands to run:
cargo build --release
cp .env.example .env # rename to .env
cargo run --release #run itServer listens on 0.0.0.0:8080.
The API talks to the electrum daemon via its Unix socket at ~/.electrum-ltc/daemon_rpc_socket. Make sure its up and running
electrum-ltc daemon -dIf it needs user and pass, put them in ~/.electrum-ltc/config and restart the daemon
{
"rpcuser": "user",
"rpcpassword": "your-password"
}Copy config.example.toml to config.toml if you want to change anything.
Everything needs the x-api-key header.
POST /wallet/create/:name— make a new wallet, returns address and WIF keyGET /wallet/balance/:nameGET /wallet/address/:nameGET /wallet/transactions/:name— checks incoming txs onlyPOST /wallet/send/:name— takes JSON{"to": "ltc_address", "amount": "0.1"}POST /wallet/restore/:any— takes JSON{"name": "name", "wif": "wif_key"}POST /wallet/delete/:namePOST /wallet/reload— reloads the daemon and all wallets (it can be a lil heavy)
curl -k -X POST https://localhost:8080/wallet/create/test \
-H "x-api-key: your-key"And that's all!
MIT