Giter VIP home page Giter VIP logo

bcos-auth's Introduction

bcos-auth

bcos-auth是FISCO BCOS 3.0的权限控制实现,其中CommitteManager.sol以二进制的形式内置在链上,固定地址为0x1005。

文档

使用说明

1. 账户生成

当底层节点部署时,可由部署者配置一个账户地址作为治理委员会的第一个成员,如果用户未配置,则系统随机生成一个。

2. 初始化系统合约

在部署节点时,需要部署治理委员会系统合约CommitteeManager,系统地址为固定的合约地址,需底层预留。 CommitteeManager内部会部署提案管理合约和部署权限管理合约。同时需要系统部署拦截器合约ContractInterceptor。

需要注意的是,在节点初始化系统合约时,需要检测其他节点是否已经部署。

3. 设置治理委员会

当节点部署完成后,可完成治理委员会的设置,比如添加其他治理委员会成员,设置投票阈值等操作。 此步骤为非必须项,如果不设置,则治理委员会只有一个成员,即管理员模式。

4. 设置部署合约权限

当节点部署完成后,可对部署合约的权限进行设置,分为黑名单和白名单模式,并可以添加对应的账户,开通或禁止相关账户的部署合约权限。 此步骤为非必须向,如果不设置,则所有人默认具有部署合约的权限。

5. 部署用户合约

当用户具有部署合约权限时,进行用户合约部署,可通过拦截器合约ContractInterceptor中的create接口进行判断。 每部署一个用户合约, 系统会在对应的目录下部署一个对应的MethodAuthManager合约,用于对合约接口访问权限的管理。

需要注意的是:合约内部署合约,同样需要部署对应的MethodAuthManager合约,详情见设计文档。

6. 设置合约访问权限

当完成用户合约部署时,默认所有合约接口在系统层面对于所有用户具有访问权限。此时,合约管理员可以对合约接口的权限进行设置,分为白名单和黑名单两种模式。

7. 调用合约接口

在调用合约接口时,系统会通过拦截器合约ContractInterceptor中的call或者sendTransaction对接口访问权限进行校验。

加入社区

FISCO BCOS开源社区是国内活跃的开源社区,社区长期为机构和个人开发者提供各类支持与帮助。已有来自各行业的数千名技术爱好者在研究和使用FISCO BCOS。如您对FISCO BCOS开源技术及应用感兴趣,欢迎加入社区获得更多支持与帮助。

License

bcos-ledger的开源协议为Apache License, 详情参考LICENSE.

bcos-auth's People

Contributors

dalaocu avatar grayson1001 avatar jc0803kevin avatar kyonray avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

bcos-auth's Issues

What's the difference of access control mechanism between bcos 2.0 and bcos 3.0?

I see the console supports grantNodeManager command in 2.x version, however, I don't see this command in v3.0 console. When I dig ino the source code, I find the precompiled contracts PermissionPrecompiled.sol & PermissionPrecompiled.cpp implement the command above. And v3.0 doesn't have the PermissionPrecompiled contract. Recently I'm doing some development based on V3.0, and I want to control the access of commands like addSealer. Any ideas on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.