⛏ Witness School · MELEK · PRANA pool
SchoolDevLearnAcademyBuildWhitepaperRunPoolFeesServersWalletHathorLibrary

How a Graphene chain is built · the anatomy behind MELEK

MELEK didn't come from nowhere — it's a Graphene chain in the Steem/Blurt lineage, and a Graphene chain is defined by a short list of constants plus a witness that starts the clock. This page walks that anatomy: the values that make a chain itself, how to build the node, and how to stand up your own private test chain with two witnesses. It's the theory under Run a witness.

Credit where it's due

The clearest walk-through of building a private Steem/Graphene chain is "The user guide for a newbie on how to build a private Steem blockchain for corporate projects" by @jga (Julián González / joticajulian), written for the European Commission's EFTG chain. This page adapts it to MELEK and credits it as the source — his original is worth reading in full.

1 · What actually defines a chain

On a Graphene chain the identity lives in a handful of compile-time constants (upstream Steem: config.hpp / asset_symbol.hpp). Change these and you have a different chain:

chain id   907959e559e253f0db275e467363425cc2cf4f20f7721699914d248a5547ad8b   (= sha256 of the genesis inscription)

2 · Build the node

Same code MELEK runs. BUILD_STEEM_TESTNET=ON gives you a private test chain (its own chain id + a test prefix); OFF is mainnet MELEK.

git clone https://github.com/HinduTempleCoins/melek-chain
cd melek-chain
sudo apt install -y build-essential cmake libboost-all-dev libssl-dev \
  libsnappy-dev liblz4-dev libzstd-dev liblzma-dev libreadline-dev libbz2-dev
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=OFF -DBUILD_STEEM_TESTNET=ON ..   # ON = private test chain
make -j$(nproc) steemd cli_wallet

(@jga's original builds upstream steemit/steem; the flags and the flow are the same — we just point at the MELEK source.)

3 · Start the first witness (initminer)

A minimal config.ini that produces blocks as initminer, the first account:

p2p-endpoint = 0.0.0.0:3333
rpc-endpoint = 127.0.0.1:9876
shared-file-size = 1G
enable-stale-production = true
witness = "initminer"
private-key = <initminer WIF>
./steemd -d mychain      # prints the pubkey + chain id, then starts producing

Genesis begins at hardfork 0 and replays hardforks one-by-one as blocks pass — a fresh chain "grows up" to the current version in its first few hundred blocks. MELEK blocks are 4 seconds (the Steem/Blurt family default is 3).

4 · Add a second witness

With steemd running, open cli_wallet, create an account, and register it as a witness:

./cli_wallet -s ws://127.0.0.1:9876
>>> set_password xxx
>>> unlock xxx
>>> import_key <initminer WIF>
>>> suggest_brain_key                       # keys for a new account (alice)
>>> create_account_with_keys_delegated initminer "5.000 MELEK" "50000.000000 VESTS" alice "{}" \
      <owner> <active> <posting> <memo> true
>>> import_key <alice active WIF>
>>> update_witness alice "https://alice.example" <alice signing PUB> \
      {"account_creation_fee":"1.000 MELEK","maximum_block_size":65536,"sbd_interest_rate":0} true
>>> vote_for_witness initminer alice true true

On a second box, build the same code, point its config.ini at the first as a seed-node, set witness = "alice" with her signing key, and start steemd — the two nodes sync and both produce.

5 · Seed nodes, RPC nodes, firewall

Seed node = the same config with no witness / private-key — it just relays blocks and peers. RPC node = enable the API plugins (webserver p2p json_rpc witness account_by_key condenser_api block_api account_history_api …) so wallets and apps can query and broadcast; it needs more resources than a witness. Lock the box down with ufw — deny incoming by default, allow only your p2p / rpc ports.

From a test chain to the real thing

That's the whole shape of a Graphene chain — the same shape as STEEM, HIVE, BLURT and MELEK. Once you've stood up a test net, running a mainnet MELEK witness is the same moves with the live chain id and seed: Run a MELEK Witness →.

Further reading — the Library of Ashurbanipal: The Graphene framework · Running a Graphene Witness Node · Delegated Proof of Stake · What a Witness is. Source: @jga's private-Steem-chain guide.