Home of the Berewic server

[ Alistair Mann | al@berewic.com | Twitter: @AlistairZ80Aftw ]

Berewic is an experimental technology implementing Good Behaviour Bonds: before accessing a resource, remote users would be required to Post Bond. If they abuse that access - for example by sending spam or robocalling etc - then that bond is forfeit to the benefit of the resource owner. If they do not abuse that access, they reclaim their funds.

The Bond required for the demopage is in the form of a Hashed Time-Locked Bond (HTLB), very closely related to the BIP-0199 Hashed Time-locked Contract (HTLC), and funded with freely available Testnet Bitcoins.

For more on HTLBs and Berewic, click here for the greenpaper notes.

Click here for the demopage.
What you see there depends on whether you have provided a bond on the Bitcoin testnet:
A very sad Jason Voorhees
No bond
a cap from an old movie
Bond is good
Sad doge
Bond is bad
You can fake access without actually bonding - see Resources section below

Video walkthrough

Trying things yourself
The requirements listed are what's known to work, not necessarily minimums. This is very much a proof of concept so expect many errors and (accidental) omissions
  1. Simplest: Watch the video walkthrough above
  2. Fake the headers
    1. Refer to Resources section below
    2. Install Chromium
    3. Install ModHeader to Chromium
    4. Edit headers to match headers provided
    5. Visit demopage above and experiment with the headers
  3. Run your own user-agent.sh reusing Alice's existing BTA
    1. Requirements: bash, the bourne again shell; wget
    2. Make a new directory and copy the user agent to it
    3. user-agent.sh will want to track the confirmations it receives to "$HOME/berewic-confirmations": edit this to suit
    4. Run user-agent.sh (New tab. example output here)
    5. Failures:
      • If you get
        "Didn't get 201 response when PUTting the proposal back
        HTTP/1.0 500 Internal Server Error ... "
        I've probably had a power cut and not restarted the testnet bitcoind. Use my email address above
      • If you get
        HTTP/1.1 402 Payment Required
        the testnet hot wallet has no funds. Send 0.0004 per run to 2NG7cvLKb9sBa8xDqpxe6KHSqemMLhWwKzU
  4. Set up your own BTA for Alice and Bob, connecting to this demopage
    1. Add Testnet Bitcoind to your server. PHP will use RPC to access it.
    2. Fund that testnet bitcoind wallet with 0.0004 btc per run
    3. Requirements: PHP 7.2
    4. Obtain the URL root you'll use. (Demopage uses https://alices-bta.mpsvr.com:8443 and rewrite rules dumping everything in one directory)
    5. Upload these library files to that URL
    6. Upload these files to the same place
    7. The BTA will want to save copies of proposals locally, whereafter they can be used for redemptions. Edit CONST_PROPOSALS_PATHANDFILE in bond_server_v1.php to suit your system
    8. Run the user agent
  5. Hardest: Set up your own demopage
    1. Set up your own BTA as described above
    2. Requirements: PHP 5.6
    3. Create a web page at your own URL. HTTPS is optional
    4. Upload the endpoint-v1.php file to it
    5. Edit BEREWIC_BTA_2 to point at your own BTA
    6. Edit all references to /covered-resource/ to point at your own images
    7. Set up your own user-agent.sh as above
    8. Edit user-agent.sh to point at your own site
    9. Set up to Fake the headers as above

... that I found useful