Currently anyone can send transactions to the system. Support external KYC processes by having a restricting set of sender_addresses (users) that are granted the right to have their transactions evaluated (note sending in transactions is a different issue) by the system.
Task:
Write a smart contract that keeps track of the eligible users
Write an abstraction to check for membership in the set of users
Users are added and removed by registrars. Registrars are added and removed by super registrars (this supports cascaded registrars). In a practical application any registrar can add any user or sub registrar that she has done real world a KYC process with, and potentially have signed agreements with. Users/Registrars can only be removed by the onboarding registrar. Note an initial admin is necessary to add the first users/registrars to the system. Every registrar is also a user. When a transaction is added to the block, it is checked if the sender_address is in users/registrars and current block_height must be >= begin_block. Users are removed by setting begin_block to -1. If users were removed their address must not be added to the system again (this restriction simplifies the contract as we do not need to maintain authorized block_height ranges).
The wrapper should check if the sender address is authorized for the current block_height. The chain configuration (which must have the address of the user registry contract) can be found in block.confighttps://github.com/ethereum/pyethereum/blob/develop/ethereum/blocks.py#L387. The wrapper should then call the original implementation. Hydrachain code needs to monkey patch processblock.py by replacing validate_transaction with validate_transaction_wrapper.
Note: Think about configuration and bootstrapping.
Currently anyone can send transactions to the system. Support external KYC processes by having a restricting set of
sender_address
es (users) that are granted the right to have their transactions evaluated (note sending in transactions is a different issue) by the system.Task:
User Registry Contract:
Stores
users = Map(user_address : (registrar_address, begin_block)
registrars = Map(registrar_address : (super_registrar, begin_block)
Contract Logic:
Users are added and removed by registrars. Registrars are added and removed by super registrars (this supports cascaded registrars). In a practical application any registrar can add any user or sub registrar that she has done real world a KYC process with, and potentially have signed agreements with. Users/Registrars can only be removed by the onboarding registrar. Note an initial admin is necessary to add the first users/registrars to the system. Every registrar is also a user. When a transaction is added to the block, it is checked if the sender_address is in users/registrars and
current block_height must be >= begin_block
. Users are removed by settingbegin_block
to-1
. If users were removed their address must not be added to the system again (this restriction simplifies the contract as we do not need to maintain authorized block_height ranges).Hydrachain/Pyethereum
Create a wrapper around
validate_transaction
: https://github.com/ethereum/pyethereum/blob/develop/ethereum/processblock.py#L77The wrapper should check if the sender address is authorized for the current block_height. The chain configuration (which must have the address of the user registry contract) can be found in
block.config
https://github.com/ethereum/pyethereum/blob/develop/ethereum/blocks.py#L387. The wrapper should then call the original implementation. Hydrachain code needs to monkey patchprocessblock.py
by replacingvalidate_transaction
withvalidate_transaction_wrapper
.Note: Think about configuration and bootstrapping.