Skip to content
Proving the concept that network abuse can be handled by levying bitcoin penalties
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Proof of Concept for the Berewic idea

Alistair Mann 2018-12-26


A PHP library containing classes useful for simulating berewic back end functionality.
Also helpers:
/berewic-bitcoin/easybitcoin.php (MIT Licence)


PHP files simulating a BTA.


Simulate /bond.
GET /bond/N at Bob's BTA obtains the status (+ confirmation code) due for P2SH address matching N.
POST /bond at Alice's BTA takes a proposal and commits funds to it.


Simulate /proposal
GET /proposal/[HOST]/[URI]?idv1=[A]&ratev1=[B]&hmacv1=[C] at Bob's BTA obtains proposals for that user A at host HOST etc.
PUT /proposal/[HOST]/[URI]?idv1=[A]&ratev1=[B]&hmacv1=[C] at Bob's BTA accepts the uploaded proposal and asks for the P2SH address.


A Bash script simulating a BUA from initial connection to obtaining the confirmation code.
Typical run:

$ ./
Accessing URL to obtain a BTA. [Done]
BTA chosen:
Get proposals from BTA. [Done]
Add buyer address 2N89uTZbJ1K3jWRviJkfZ3uGVC9ATxmh4eS to proposal. [Done]
Supply above modification back to to BTA for the P2SH address. [Done] 
P2SH Address: 2N4C6TcbHxEdHiin5CzPbQyA1zP7cnZVbQq
Fund the P2SH address and so commit to the bond. [Done]
Poll BTA for '200' & confirmation code once it sees bond on the blockchain, 30 second sleep if not. 
1549292539: 202
1549292569: 202
1549292599: 202
1549292629: 202
1549292659: 202
1549292689: 202
1549292719: 200 [Done]
Header which confirms bond acceptable will be:
berewic-bond-confirmation: idv1=52676381&bta=78f7&amount=0.0004&locktime=1549297938&mtime=1549292719636004&hmacv1=17c7c1f3793c4178b270a59c3dfd47ef0e68bf63


A PHP file that can return different content based on the bonding status of incoming connections.

You can’t perform that action at this time.