Shared Cores: running some chains, borrowing the rest
docs/shared-cores.md
Jump to: The rule · Setting it up · What sharing lets other arcades do · What a borrowing arcade checks · Every arcade's index, compared · A tenth to the arcade that shares · Mining test coins
An arcade does not have to run a Core node for every chain it offers. Any operator can share a Core that runs on their machine with every other arcade, and any arcade can borrow a chain from arcades that share it. Two arcades that each run two Cores can both offer every chain.
The rule
- Pepecoin testnet always runs on your own machine. The Messenger, the @names and the mesh's own checks live there.
- Run at least one more Core yourself. Every arcade brings a Core to the network as well as borrowing.
- Every other chain is your choice: run it here, borrow it from an arcade that shares it, or (for a chain the arcade can do without, such as Dogecoin) leave it off.
For example, one operator runs Pepecoin testnet, Pepecoin mainnet and Dogecoin, and shares the two mainnet Cores. Another runs Pepecoin testnet and Litecoin, and shares Litecoin. Both arcades then offer every chain.
Setting it up
Open Admin → Chains. Each chain has:
- Core: Runs here, Borrow a shared Core, or Off. Changing this takes effect when the arcade restarts; at the node machine the panel offers Restart now when a service manager runs the arcade.
- Share: let other arcades use this chain's Core. On by default: every Core that runs here is shared unless you untick it. Only a Core that runs here can be shared. A change takes effect within a minute, with no restart.
The same choices are kept in settings.json as core:<chain> (here, borrow or off) and share:<chain> (true or false; true when it is not set).
What sharing lets other arcades do
A shared Core answers a short list of requests and nothing else:
- reading blocks, transactions, block headers and the chain tip;
- reading the mempool and whether a coin is still unspent;
- fee estimates;
- broadcasting a transaction that somebody already signed.
It never answers a wallet request. Sharing can never spend, sign or reveal your node's coins. Your Core works on at most two borrowed requests at a time, so your own pages never wait behind other arcades, and each borrowing arcade is limited in how fast it can ask.
A sharing arcade also sends each new mempool transaction, as it arrives, to the arcades borrowing that chain, so their wallets see incoming payments as quickly as yours does.
What a borrowing arcade checks
A borrowed chain's answers come from somebody else's node, so the borrowing arcade proves what it can from the bytes:
- Transactions are fetched raw. A transaction whose bytes hash to the id that was asked for is that transaction; nothing in it can have been changed.
- Blocks are fetched raw. The block's hash must be the hash of its header, its transactions must hash up to the header's merkle root, and the header must carry the proof of work its difficulty asks for: scrypt, or for a merge-mined chain (Dogecoin, Pepecoin mainnet) a parent block that commits to it. A block whose difficulty falls more than fourfold from the block under it is refused.
- Mempool transactions pushed by a sharer are checked the same way as any other transaction.
What cannot be proved from bytes is taken on the sharer's word: which block is at a given height, whether a coin is still unspent, and what the mempool holds. When two sharing arcades are linked, their chain tips are compared, and the admin panel says so if they disagree.
An answer that fails a check is refused. The sharer that sent it goes to the back of the line, and the next sharing arcade is asked instead.
A borrowed chain has no node wallet. Accounts work as usual, because people sign in their own browsers. What needs the node's own coins on that chain does not: the faucet, the node's own trading, and the node paying for inscriptions.
Every arcade's index, compared
Every arcade builds its index of tokens, inscriptions, names and trades from the chain alone, so honest arcades on the same rules hold the same index. Linked arcades check that they do:
- Every minute, each arcade sends a fingerprint of its index up to a checkpoint (a multiple of 100 blocks, at least 6 blocks under the tip, so a reorganisation cannot move it), and the consensus hash of its balances.
- Two arcades whose fingerprints differ halve the range of blocks, again and again, until they find the first block they read differently, and both arcades' rows for that block are shown in Admin → Chains.
This applies to borrowed chains too: an index built from a borrowed Core's blocks is compared with the indexes other arcades built from their own Cores.
A tenth to the arcade that shares
An arcade that borrows a chain pays the arcade whose Core it uses a tenth of what it earns on that chain:
- Operator fees. The operator's fee on a borrowed chain is split in the same transaction: nine tenths to this arcade and one tenth to the sharer. A tenth too small for the network to carry (under the dust limit) is not paid; the whole fee then stays with this arcade.
- Mined blocks. A block mined with a borrowed Core's work pays the sharer a tenth of its reward in its own coinbase.
Each sharing arcade names the address it is paid at for every chain it shares, and a borrowing arcade is paid its fees and mined coins in the same way. It's the operator account's own address on that chain when one is named, so the coins show up in that account's Wallet. Otherwise it's the Core wallet's address, or, on a chain with no Core wallet here (a borrowed one, or Litecoin), the arcade's own key's address there. Admin → The node's coins shows and spends those coins, signed by the arcade itself with its identity key. Nothing has to be imported into another wallet.
Mining test coins
Admin → Chains → Mine test coins mines blocks on a test-coin chain with this machine's CPU, using work from that chain's Core, whether it runs here or is borrowed. Chains of real coins and merge-mined chains are never mined this way. A testnet lets anyone mine its next block at the lowest difficulty once none has been found for a while. That is when a CPU wins a block.
A sharing arcade answers mining calls (getblocktemplate, submitblock) for test-coin chains only, and no more often than once every couple of seconds per borrower.
To mine on another machine, run the miner there against this arcade's /rpc/work/<chain>, with the arcade's RPC cookie (~/.dogecoinarcade/rpc.cookie):
`` python -m arcade.blockminer --url http://127.0.0.1:8420/rpc/work/ltctest \ --cookie ~/.dogecoinarcade/rpc.cookie --chain ltctest --address <yours> --workers 16 ``
The arcade listens on its own machine only, so reach it from another one through an SSH tunnel (ssh -L 8420:localhost:8420 <arcade machine>).