Skip to content

taccatisid/fine-grained-permissioning-demo

Repository files navigation

A demo for account and contract permissioning with besu

This runs a private ethereum network of three besu nodes, one of which is a validator. Besu is running using the flexible permissioning extension that allows to control account behavior using a smart contract. Two trivial smart contracts are included to demonstrate how OpenZeppelin access control can be used either on a per-contract basis (DirectContract) or using a central authority for all contracts (DelegateContract).

Running the demo

Start the nodes via

docker-compose up -d

If you want to see the besu node logs, omit the -d and run this command in a separate terminal.

Then compile and deploy all contracts to your network using

./deploy

and follow the instructions given there.

Cleaning up

Stop the besu network via

docker-compose down

This retains the state of the blockchain. To erase all blockchain data and start from scratch run

rm -r docker-data/node*/{DATABASE_METADATA.json,caches,database}

Contract deployment sequence

Permissioning setup happens in three phases:

  1. A bootstrap contract is included in the genesis file. Besu nodes are started with --permissions-accounts-contract-enabled --permissions-accounts-contract-address=0x0000000000000000000000000000000000008888 to activate account permissioning using this particular contract. The bootstrap contract allows all blockchain interactions and has the sole purpose of being a placeholder before being updated by the actual account permissioning contract.
  2. The AccountRules contract is deployed by an arbitrary account. By deploying, this account becomes the admin account for entire blockchain.
  3. The CentralAccessControl contract is deployed. Again, the account deploying it becomes the administrator of that contract.

All subsequently deployed contracts are derived from the DelegatedAccessControl contract and linked to the CentralAccessControl instance on deployment.

Contract deployment sequence UML diagram

Permissiong control flow

Every blockchain interaction is checked on two levels:

  • Transactions are checked by looking up whether the sender is permitted in the AccountRules contract.
  • Calls in a transaction are checked by looking up whether the caller has the required role in the CentralAccessControl contract.

Permissiong control flow UML diagram

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published