https://github.com/blockexchange/blockexchange_server
minetest blockexchange server software
https://github.com/blockexchange/blockexchange_server
minetest
Last synced: 2 months ago
JSON representation
minetest blockexchange server software
- Host: GitHub
- URL: https://github.com/blockexchange/blockexchange_server
- Owner: blockexchange
- Created: 2020-03-30T18:04:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-28T00:05:50.000Z (3 months ago)
- Last Synced: 2025-01-30T20:12:30.372Z (3 months ago)
- Topics: minetest
- Language: Go
- Size: 8.94 MB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 33
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
minetest blockexchange server software



[](https://coveralls.io/github/blockexchange/blockexchange_server)

Discord-server: https://discord.gg/BEf8hGEQz9
# Overview
Corresponding mod and more information: https://github.com/blockexchange/blockexchange
# Running
## Requirements
* Running postgres database
## Environment variables
Required:
* **PGUSER**
* **PGPASSWORD**
* **PGHOST**
* **PGPORT**
* **PGDATABASE**
* **BLOCKEXCHANGE_KEY** private key to sign the json web tokens withOptional:
* **DISCORD_SCHEMA_FEED_URL** discord webhook for the "new schema" feed
* **BASE_URL** Application base url, used for redirects (without trailing slash)
* **GITHUB_APP_SECRET** Github app secret key
* **GITHUB_APP_ID** Github app ID
* **DISCORD_APP_SECRET** Discord app secret key
* **DISCORD_APP_ID** Discord app ID
* **MESEHUB_APP_SECRET** Mesehub app secret key
* **MESEHUB_APP_ID** Mesehub app ID## docker-compose usage
A `docker-compose` example:
```yml
version: "2"services:
blockexchange:
image: blockexchange/blockexchange
restart: always
depends_on:
- postgres
environment:
- PGUSER=postgres
- PGPASSWORD=enter
- PGHOST=postgres
- PGDATABASE=postgres
- PGPORT=5432
- BLOCKEXCHANGE_NAME=My-Blockexchange
- BLOCKEXCHANGE_OWNER=yourname
ports:
- "8080:8080"postgres:
image: postgres:12
restart: always
environment:
POSTGRES_PASSWORD: enter
volumes:
- "./data/postgres:/var/lib/postgresql/data"
```# Development
Web- and backend development
**NOTE**: make sure you checked out the submodules too
Prerequisites:
* docker
* docker-compose
* nodejs```
# install the frontend deps
cd public && npm ci && cd ..# start the postgres server in the background
docker-compose up -d postgres# start the blockexchange server
docker-compose up -d blockexchange# start the minetest server
docker-compose up -d minetest
```The blockexchange UI is at http://127.0.0.1:8080 and the minetest server is reachable via 127.0.0.1:30000
## Serialized mapblock format
The on-disk format
```lua
-- exemplary metadata
metadata = {
size = {x=16,y=16,z=16},
node_mapping = {
["air"] = 126,
["default:stone"] = 127
},
-- block metadata
metadata = {
meta = {
["(0,0,0)"] = {
inventory = {},
fields = {}
}
},
timers = {
["(0,0,0)"] = {
timeout = 2.0,
elapsed = 1.4
}
}
}
}-- node_id's (2 bytes) / param1 (1 byte) / param2 (1 byte)
data = {
0,0,0,0
-- etc
}-- database format
serialized_metadata = minetest.compress(minetest.write_json(metadata), "deflate")
serialized_data = minetest.compress(data, "deflate")
```Serialized example as json, byte-array is encoded as base64 over the wire:
```json
{
"data":"eJztwQENAAAMAqAHekijm8MNyEdVVVVVVVVVHX8AAAAAAAAAwLwCfjrAlw",
"metadata":"eJw1ylsKgCAQRuG9/M8RBdLDbCYGnUJQk9Lognsvid4+OOeGl8SGE4NuJOtl3UAhO1cahMXI6DlGG+aajUycXSLNu4xWC0iptnvHzV5ShwPUD23X4PxxfSjlAYnOIYs",
"offset_x":0.0,
"offset_y":0.0,
"offset_z":0.0,
"order_id":0.0,
"schema_id":"3a11f5d5-972c-43b9-a11f-1680af3148d1"
}
```# License
Code: MIT
## Other assets
* `public/pics/default_mese_crystal.png` CC BY-SA 3.0 https://github.com/minetest/minetest_game
* `public/pics/contentdb.png` GPL v3 https://github.com/minetest/contentdb