A tool to coordinate and incentivise a set of independent actors to assess a set of independent criteria, using Chain link and XMPP to link block chain payment rails to real world activity.
(Note that this project is a proof of concept. No further updates will be made to this repo as a full rewrite is in progress)
A tool to coordinate and incentivise a set of independent actors to assess a set of independent criteria, using Chain link and XMPP to link block chain payment rails to real world activity. Actors are assigned randomly to various criterion, with each criterion having at least three actors assessing it. The system rewards actors whose assessment aligns with that of the majority, and penalizes assessments that go against. Once an assessor has registered on chain, all other interaction between the assessor and the system is done via XMPP (Instant messaging), using Chain link to bring the results back on chain to automatically execute payment.
This is the external adapter/bot that talks to the chainlink node, either receiving instruction to initiate an audit, or sending the settlement details back to be executed.
The contracts are here https://github.com/rogervs/RWA_contracts
pyenv-virtualenv
pip install -r requirements.txt
python rwa.py
TCPFlow is a program that shows you the TCP stream going in and out of a port.
sudo tcpflow -c -i lo port 8080
A proof of concept on-chain version was written first in Solidity. It can be found in the rwa_poc_sol
directory.
You should be able to use any public XMPP server, but I haven't tried. Some might have issues with you running bots, dunno.
For a locally hosted XMPP server, I've been using Openfire . Seems to work fine. I've seen there's options to run clusters of these. I'd like to investigate what benefits that brings. If if brings fallover resilience, than each chainlink node could run a openfire node in that cluster bringing more resilience. Still an open question.
These seem fine: . Dino . Gajim
https://devpost.com/software/real-world-auditor
Once a user starts a chat with the EA bot, and they have been assigned as the admin in an audit via the smartcontract, these commands will be available to them. Any input that is not recognised will result in this list of commands being printed. Some of them are not currently operational.
open
: Allows auditors to registerclose
: Closes registrationstart
: Start the auditstop
: Stop the auditstate
: Returns the current state of the auditadd <description>
: Adds an item to the audititems
: Returns the items in the auditdel <number> :
Deletes item from the audit. is obtained from item list
set num_items <value>
: Sets the number of items that need to be auditedset num_audits_per_item <value>
: Sets the number audits per item (needs to be an odd number)outstanding_inspections
: Returns the outstanding auditsset slashing_ratio <value>
: Sets the severity of the slash an auditor will receive for every incorrect observationEach audit is run as a state machine. The states are defined as:
class State(Enum):
INITIALIZATION = 0
AUDITOR_REGISTRATION = 1
AUDITOR_REGISTRATION_COMPLETE = 2
AUDITING = 3
AUDITING_FINISHED = 4
CALCULATED_ITEM_RESULTS = 5
CALCULATED_AUDIT_RESULTS = 6
CALCULATED_AUDITOR_RESULTS = 7
WAITING_FOR_CONTRACT = 8
COMPLETE = 9
INITIALIZATION
admin_jid
specified in the smartcontract can interact with the bot at this stage.add <description>
command.open
commands transitions the state machine to the AUDITOR_REGISTRATION
state.AUDITOR_REGISTRATION
[email protected]
, and the name of projects, eg "Downtown Working Street Light Inspection"close
command, which transitions the state of the bot to AUDITOR_REGISTRATION_COMPLETE
AUDITOR_REGISTRATION_COMPLETE
start
to transition the state to AUDITING
.AUDITING
True
or False
, y
or n
, yes
or no
stop
command to transition the state to AUDITING_FINISHED
AUDITING_FINISHED
, CALCULATED_ITEM_RESULTS
, CALCULATED_AUDIT_RESULTS
, CALCULATED_AUDITOR_RESULTS
WAITING_FOR_CONTRACT
WAITING_FOR_CONTRACT
run
function on the RWA smart contract with the name of the project.COMPLETE
COMPLETE