Luanti mod and bridge for Ğ1 exchange https://juneland.fr
Find a file
2025-06-13 22:04:48 +02:00
g1bridge Initial commit 2025-06-12 20:10:41 +02:00
.gitignore Initial commit 2025-06-12 20:10:41 +02:00
init.lua send command: simplify, description 2025-06-13 22:04:48 +02:00
LICENSE Initial commit 2025-06-12 20:10:41 +02:00
mod.conf Initial commit 2025-06-12 20:10:41 +02:00
README.md send command: simplify, description 2025-06-13 22:04:48 +02:00

Ğ1 <-> Luanti bridge

Luanti mod to exchange in-game currency with libre currency (Ğ1 blockchain).

Luanti server has a dedicated account. Players transfer money on it and the server gives them a corresponding amount of in-game banknotes. They can then do whatever they want with the banknotes (trade, decorate walls, burn...). Players can ask the server to transfer their banknotes to an account of their choice using a chat command.

It works with Ğ1v2 which is still in development/testing phase.

Install

Put this repo in the mods directory.

Add g1_bridge to secure.http_mods.

Have a local Duniter node.

  cargo build --release
  ./target/release/g1bridge -l -d /path/to/database -s ../sk
  • sk contains the server's secret key
    • Without -l, use Substrate formats.
    • With -l, use legacy Ğ1 format on 2 lines (one password per line).
  • database is the directory where the bridge will save its database. It is used to store debts in case of failure of a transfer.

ToDo

  • Blockchain-to-game transfers
  • Ensure all transfers are failproof (any communication, storage medium, server or whatever should be able to fail or rollback to a previous state, without causing double spend or money loss)
  • Force reception account to exist
  • Nice ATM-like interface
  • Accept mixed values (other banknotes values than 1)

Workflow

game -> blockchain

  1. Player issues command /g1_send <amount> <address>
  2. Mod takes currency from inventory and saves the debt in storage.
  3. Mod sends /send/<address>/<amount> to bridge.
  • If bridge responds immediately, clean the debt.
  • Else, retry later.

blockchain -> game

  1. bridge listens to events
  2. on reception event, bridge stores debt
  3. Player issues command /g1_claim
  4. Mod sends /claim/<player> to bridge
  5. Bridge answers an amount and clears debt
  6. Mod stores debt
  7. Mod tries to give player MG
  8. What does not fit is kept in debt. What does fit is removed from debt.

License

Support me via LiberaPay

GNU AGPL v3, CopyLeft 2025 Pascal Engélibert (why copyleft?)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.