================================================================
 BigCoin Core (Linux x86-64)  v1.7
 Author: Masashi Takamoto
 (A Japanese version of this file is included: README.ja.txt)
================================================================

BigCoin is an independent proof-of-work blockchain forked from
Bitcoin Core v31.1. It is not Bitcoin: different genesis block,
different network magic, different ports, different address format,
and no compatibility with the Bitcoin network in either direction.

No ICO. No premine sale. Nothing is for sale. The founder does not
sell BIG and there is no exchange or custody service behind this
project. Block 1 contains a 1,000,000 BIG founder reward, which is
visible on-chain and can be checked by anyone.


■ QUICK START (3 lines)

    tar xzf bigcoin-linux-x64-v1.7.tar.gz
    cd bigcoin
    ./mine-bigcoin.sh

  That is all. The script starts a node, waits for the chain to sync,
  creates a wallet and mining addresses, and mines until you press
  Ctrl-C. There is nothing to compile and nothing to apt install.


■ REQUIREMENTS

  - Linux x86-64
  - glibc 2.35 or newer
      Ubuntu 22.04 / 24.04 / 26.04, Debian 12 / 13,
      Fedora 36+, openSUSE Leap 15.5+, and anything newer
  - Check yours with:  ldd --version

  Boost, libevent and SQLite are statically linked into the
  binaries, so there are no packages to install. The only dynamic
  dependencies are glibc itself and libm:

      linux-vdso.so.1  libm.so.6  libc.so.6  ld-linux-x86-64.so.2

  From v1.7 mining also wants about 2 MiB of fast memory per worker
  thread, which is the point of the new algorithm (see below). Any
  machine that can run a node has it.

  No GUI wallet is included in this release. bigcoin-qt is currently
  Windows only.


■ RUNNING ON A RENTED SERVER

  Check your provider's terms of service before you start mining.
  Many shared VPS hosts prohibit mining outright, while plans with
  dedicated resources often allow it. Running a node without mining
  is almost always fine. This is your responsibility, not ours.


★★ IMPORTANT (v1.7): THE PROOF-OF-WORK ALGORITHM CHANGES AT 19,500

  From block height 19,500 BigCoin's proof of work is yespower 1.0
  instead of double-SHA256. This is a hard fork. A node that has not
  upgraded rejects every block from that height onwards, and a miner
  that has not upgraded produces blocks nobody will accept.

  Watch the height, not the date:

      ./bigcoin-cli -datadir=$PWD/data getblockcount

  and upgrade before you reach 19,500. The node will also tell you
  where the switch is and whether it has happened:

      ./bigcoin-cli -datadir=$PWD/data getblockchaininfo \
        | grep -E 'pow_algo|yespower_activation_height'

  Why: this chain's difficulty is around 2.3, which is roughly 40 MH/s
  of SHA-256. A single second-hand mining ASIC is about 30,000 times
  that. Its owner could take every block, or rewrite recent history,
  for the price of the electricity, and nothing in a double-SHA256
  chain this small can stop it. yespower needs 2 MiB of memory for
  every single hash, which no SHA-256 ASIC has, so that hardware
  cannot participate at all - its blocks are not uncompetitive, they
  are invalid. This is not a claim that BigCoin is ASIC-proof forever.
  It removes the attack that exists today, for the price of making
  mining slower in raw hashes per second for everybody equally.

  What changes for you as a miner:

  - Hashrate numbers drop from millions per second to a few hundred
    per second per core. That is expected and it is not a slowdown:
    difficulty is recalibrated at the switch, so blocks keep arriving
    at the same rate.
  - mine-bigcoin.sh handles the switch by itself. It asks the node
    which algorithm the next block needs, so it cannot disagree with
    consensus about where the switch happens, and it resizes its own
    nonce budget when the era changes.
  - If you mine by hand with generatetoaddress, the nonce ceiling has
    to shrink by about four orders of magnitude. A yespower hash costs
    roughly 3 ms, so a budget of 20,000,000 would hold one RPC call
    open for days. Use a few thousand (4,000 is about 13 s on a
    current core) and call it in a loop.
  - yespower is limited by memory bandwidth, not clock speed, so more
    worker threads do not always mean more hashes. Try a smaller
    worker count and compare the hashes/s the script prints.

  Block identity does not change. The block hash shown by getblockhash
  and by the explorer is still double-SHA256 in both eras; what changed
  is only the value that gets compared against the target.


★ IMPORTANT (v1.7): STALL PROTECTION IS LIVE FROM HEIGHT 18,000

  The same release changes how ASERT measures elapsed time, from
  height 18,000:

      elapsed = max(parent's timestamp,
                    candidate's timestamp - 6 hours) - parent's timestamp

  Below six hours this is arithmetically identical to the old rule, so
  nothing about normal operation changes. Past six hours of silence the
  target starts easing on its own - halving every two days - so a
  difficulty left stranded by a miner who stopped clears itself instead
  of freezing the chain.

  Why it exists: at height 17,324 this chain sat still for 123 hours.
  Before this change the next block's target was fixed the moment its
  parent existed, and waiting did not make the block any easier to
  find, so the departure of one large miner left the difficulty above
  what the remaining hashrate could ever clear. Recovery took a manual
  hard fork. It should not need one a second time.

  Because the rule is a no-op below the grace period, height 18,000 is
  deliberately a height the chain has already passed: the blocks
  already mined above it validate byte-identically under both rules,
  so nothing is reorganized and no chain splits. That was verified by
  measurement before this release was published - no gap at or above
  height 18,000 comes close to six hours.

  What it costs: a miner who dates a block into the future gains at
  most a 2.9% discount on the target, bounded by the existing two-hour
  limit on future timestamps and available to everyone equally. Unlike
  the draft rule that was never released, there is no one-time step in
  difficulty at the activation height, because below six hours the two
  rules agree exactly.


★ IMPORTANT (v1.4 and later)

  At block height 17,325 the difficulty adjustment algorithm changed
  to ASERT. This is a hard fork and it has been live since
  2026-11-07. Nodes running v1.3 or older reject every block from
  that height onwards, so you must run v1.4 or later.


■ CHAIN PARAMETERS

  Ticker            BIG (smallest unit: sat; max supply ~22,000,000)
  Genesis block     000086c5bc212db5bf8760b3fb3a30dfcd6af76257fd529814bc032c8134424d
  Network magic     "BIGC" (0x42 0x49 0x47 0x43)
  P2P port          8338
  RPC port          8337
  Address format    big1... (bech32) / B... (base58, legacy)
  Block time        ~10 minutes, halving every 210,000 blocks
  Block reward      50 BIG
                    (block 1 only: 1,000,000 BIG founder reward)
  Proof of work     double-SHA256 up to height 19,499;
                    yespower 1.0 from 19,500
                    (N=2048, r=8, personalisation "BigCoin/yespower1.0",
                     over the 80-byte serialised header, 2 MiB per hash)
  Difficulty        ASERT (aserti3-2d), half-life 2 days, active from
                    height 17,325; from height 18,000 elapsed time is
                    measured to max(parent, candidate - 6 h), so the
                    target eases once the chain has been silent for
                    longer than six hours
  Pinned blocks     heights 1, 1000, 2000, 17000, 17750 - a reorg that
                    would change any of them is rejected regardless of
                    the attacker's hashrate
  Seed node         133.242.139.204:8338
  Explorer          http://133.242.139.204/


■ WHAT IS IN THIS ARCHIVE

  bitcoind         the node
  bigcoin-cli      the command line client
  bitcoin          multiprocess wrapper (you will not normally use it)
  mine-bigcoin.sh  easy solo-mining script
  bitcoin.conf     config file template
  README.txt       this file
  README.ja.txt    the same document in Japanese


■ USING THE MINING SCRIPT

    ./mine-bigcoin.sh        mine with (CPU cores - 1) workers
    ./mine-bigcoin.sh 4      mine with exactly 4 workers

  More workers means more hashrate under double-SHA256, but one core
  is left to the OS by default. Under yespower the best worker count
  is whatever your memory bandwidth allows, which is often fewer than
  the number of cores - compare the hashes/s line the script prints.

  The script is short and does nothing hidden - read it before you run
  it. Every command it issues is a local RPC call to the bitcoind next
  to it, and the keys it creates never leave ./data.

  Four things worth knowing about how it works:

  1) Each worker mines to its own address.

     A generatetoaddress block template is fully determined by the
     previous block, the height, the coinbase output and nTime - and
     nTime only has one-second granularity. Two workers that start in
     the same second on the same address therefore grind a
     byte-identical block header in the identical nonce order, and
     one of them does no useful work whatsoever. Giving each worker
     its own address changes the coinbase, which changes the merkle
     root, which splits the search space for certain.

     The addresses are saved in data/mining-addresses.txt and all
     belong to the same 'miner' wallet, so the balances simply add up.

     Note that a count of mining addresses is NOT a count of miners.
     One person can hold any number of them.

  2) It raises rpcthreads automatically.

     generatetoaddress holds one RPC thread for the entire duration of
     the call. bitcoind only serves 4 threads by default, so without
     this change extra workers would just queue behind each other
     instead of mining in parallel. The script writes
     (workers + 4) into data/bitcoin.conf.

     If a node was already running when you start the script, the
     running node keeps using its old value; the script tells you so
     and shows you how to restart it.

  3) It sizes each call by measurement, not by assumption (new in v1.7).

     A yespower hash costs about 20,000 times a double-SHA256 hash, so
     a fixed nonce budget cannot be right for both eras. Each worker
     times its own calls and resizes its budget to land near 30
     seconds, which keeps calls short enough that a block found late
     in one is unlikely to be stale, on a slow single-core box and on
     a 64-core machine alike.

  4) It will mine on a stalled chain instead of waiting for it (new in
     v1.7).

     Older versions waited for the node to report that its initial
     block download had finished. A node only reports that once its
     own tip is less than a day old, and never re-reports it after
     that - which makes the flag a reliable "I have caught up" signal
     for a node that was already running, and a trap for one started
     while the chain itself is stalled. Anybody who had started the
     old script during the 123-hour freeze in November 2026 would have
     watched it print "synced up to block 17324" forever, and the
     chain would have been left without the one miner that could have
     ended the stall.

     This version also stops waiting when there is demonstrably
     nothing left to fetch: the block count has caught up with the
     header count, at least one peer agrees, and nothing has moved for
     a minute. Then it mines, because a stalled chain is exactly when
     it most needs a miner.

  Stop mining with Ctrl-C. The node keeps running. To stop the node:

      ./bigcoin-cli -datadir=$PWD/data stop

  On a headless server you will probably want it detached:

      nohup ./mine-bigcoin.sh 4 > mine.log 2>&1 &
      tail -f mine.log          # watch it
      kill %1                   # stop it (or: pkill -f mine-bigcoin.sh)

  A detached run cannot be stopped with Ctrl-C - there is no terminal
  to press it in - so use kill. The script handles SIGTERM the same way
  it handles Ctrl-C: it stops the workers and leaves the node running.


■ DOING IT BY HAND

  1. Create a data directory
       mkdir -p data
  2. Copy the config template (the seed node is already in it)
       cp bitcoin.conf data/
  3. Start the node
       ./bitcoind -datadir=$PWD/data -daemon
  4. Check the state
       ./bigcoin-cli -datadir=$PWD/data getblockchaininfo
  5. Create a wallet
       ./bigcoin-cli -datadir=$PWD/data createwallet mywallet
  6. Get an address
       ./bigcoin-cli -datadir=$PWD/data getnewaddress
  7. Mine - and mind the last number, it is the nonce ceiling for one
     call and it depends on which algorithm is live:

       double-SHA256 (below height 19,500)
         ./bigcoin-cli -datadir=$PWD/data \
           generatetoaddress 1 <big1address> 20000000

       yespower (from height 19,500)
         ./bigcoin-cli -datadir=$PWD/data \
           generatetoaddress 1 <big1address> 4000

     Always pass it: the default (1,000,000) gives up almost
     immediately under double-SHA256, and would run for an hour under
     yespower. Do not make it enormous either - the call does not
     notice a new chain tip while it runs, so a worker would keep
     grinding a stale template after someone else found the block.
     If nothing is found the call returns an empty array [], so call
     it in a loop. The mining script does all of this for you.
  8. Stop
       ./bigcoin-cli -datadir=$PWD/data stop


■ RUNNING A NODE PERMANENTLY (systemd example)

  Create /etc/systemd/system/bigcoind.service:

    [Unit]
    Description=BigCoin node
    After=network-online.target

    [Service]
    User=bigcoin
    ExecStart=/opt/bigcoin/bitcoind -datadir=/var/lib/bigcoin
    Restart=on-failure
    Type=simple

    [Install]
    WantedBy=multi-user.target

  Then:  systemctl enable --now bigcoind


■ SECURITY AND BACKUPS

  - Your private keys live in the wallet file inside the data
    directory. Back it up:
      ./bigcoin-cli -datadir=$PWD/data -rpcwallet=miner backupwallet /path/to/backup.dat
  - Mining rewards become spendable after 100 confirmations, which is
    roughly one day.
  - NEVER expose RPC port 8337 to the internet. Forward only the P2P
    port 8338.
  - Opening port 8338 lets other nodes connect to you, which helps
    the network. It is optional.


■ REPRODUCING THESE BINARIES

  Built from the published source archive. Anyone can repeat this.

    Source  : bigcoin-source-v1.7-unix.tar.gz
    SHA256  : (see http://133.242.139.204/downloads)
    Toolchain: Ubuntu 22.04 (glibc 2.35), GCC 12.3.0, CMake 3.22.1

  Build:

    tar xzf bigcoin-source-v1.7-unix.tar.gz && cd bigcoin-source-v1.7
    make -C depends NO_QT=1 NO_ZMQ=1 NO_USDT=1 -j"$(nproc)"
    cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake \
      -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=OFF -DBUILD_TESTS=OFF \
      -DBUILD_BENCH=OFF -DBUILD_FUZZ_BINARY=OFF -DINSTALL_MAN=OFF \
      -DENABLE_IPC=OFF -DWITH_ZMQ=OFF -DWITH_USDT=OFF \
      -DAPPEND_LDFLAGS="-static-libstdc++ -static-libgcc"
    cmake --build build -j"$(nproc)"

  Binaries land in build/bin/. Most of the depends build time goes to
  capnproto and Boost.

  The yespower implementation lives in src/crypto/yespower and is the
  reference yespower 1.0 code, unmodified apart from the compatibility
  header that lets it compile as part of this tree. Its only BigCoin
  specific input is the personalisation string, which is in src/pow.cpp
  next to the call.

  ★ If you use the .zip source archive instead, fix two things first

    bigcoin-source-v1.7.zip was created on Windows and will NOT build
    on Linux as shipped. The -unix.tar.gz archive above is the same
    source with exactly these two problems already fixed; if you
    prefer the zip, apply them yourself after unzipping:

    1) Line endings are CRLF.
       Every shebang is read as "/bin/sh\r" and fails with
       "bad interpreter"; the Makefiles break as well.

         sudo apt install dos2unix
         find . -type f ! -name '*.png' ! -name '*.raw' -print0 \
           | xargs -0 dos2unix -q

       (dos2unix detects and skips binary files.)

    2) The zip format did not preserve the executable bit.
       If depends/config.guess cannot run, build_os comes out empty,
       which empties build_TAR and build_SHA256SUM, and the depends
       Makefile collapses into hundreds of
       "/bin/sh: Syntax error: \"|\" unexpected".

         grep -rlI --null '^#!' . | xargs -0 chmod +x
         chmod +x depends/config.guess depends/config.sub depends/gen_id

  ★ One build flag that does not do what it looks like

    Passing MULTIPROCESS=0 to depends disables nothing. The Makefile
    tests  ifneq ($(MULTIPROCESS),)  so "0" is a non-empty string and
    falls on the ENABLED side - the opposite polarity of the NO_*
    variables. In 31.x capnproto and libmultiprocess are part of the
    default depends set regardless of that flag; -DENABLE_IPC=OFF is
    what actually keeps the IPC binaries out of the build.


■ CHANGELOG

  v1.7 (2026-11-09) Two consensus changes and a rewritten mining
                    script.

                    Proof of work becomes yespower 1.0 from height
                    19,500 (hard fork). Every hash needs 2 MiB of
                    memory, which excludes SHA-256 ASICs from the
                    chain entirely rather than merely outcompeting
                    them. Block identity stays double-SHA256.

                    From height 18,000, ASERT measures elapsed time to
                    max(parent's timestamp, candidate's timestamp minus
                    six hours) instead of the parent's timestamp alone
                    (hard fork). Below six hours the result is
                    byte-identical to the old rule, so normal operation
                    is unchanged; past six hours of silence the target
                    eases on its own and a difficulty stranded by a
                    departed miner no longer freezes the chain, which is
                    what cost 123 hours at height 17,324. Costs at most
                    a 2.9% discount to a miner who dates a block into
                    the future, and no step at the activation height.

                    Pinned block added at height 17,750, which caps how
                    far back a fork rooted in the remaining
                    double-SHA256 range could be mined.

                    mine-bigcoin.sh now sizes its nonce budget by
                    measurement (required: a yespower hash is about
                    20,000 times a double-SHA256 hash), switches
                    algorithm by asking the node rather than by a
                    hardcoded height, and no longer waits forever on a
                    stalled chain. If you use the script, take this
                    version - the stall bug would have silenced every
                    script-driven miner for the whole duration of a
                    freeze longer than a day.

                    A v1.6 with the stall protection at height 22,000
                    was built and tested but never published; v1.7
                    supersedes it, and its activation heights are not
                    in any released binary.
  v1.5 (2026-11-08) Linux x86-64 build added (first Linux package), with
                    mine-bigcoin.sh bundled, plus an LF-ending source
                    archive that builds on Linux as-is. No consensus
                    changes - same source as Windows v1.5.
  v1.5 (2026-11-07) Bundled the easy mining script mine-bigcoin.cmd.
                    Removed build-environment local folder path
                    strings that had been embedded in the shipped
                    binaries (no effect on behaviour).
  v1.4 (2026-11-07) Moved the ASERT activation height forward from
                    18,000 to 17,325.
  v1.3 (2026-11-02) Difficulty adjustment switched to ASERT
                    (aserti3-2d).
  v1.2 (2026-11-01) Added the GUI wallet bigcoin-qt.exe (Windows only).
  v1.1 (2026-11-01) Fixed a header sync bug; pinned the early blocks.
  v1.0 (2026-11-01) First release.


■ LINKS

  Mining guide  http://133.242.139.204/mining
  Downloads     http://133.242.139.204/downloads
  Explorer      http://133.242.139.204/
  Seed node     133.242.139.204:8338

  Licence: MIT, as inherited from Bitcoin Core.
  yespower 1.0 by Solar Designer, BSD-2-Clause / public domain as
  stated in its own headers (src/crypto/yespower).
================================================================
