Ian Costanzo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Adding Endorser Support to BPA The [Business Partner Agent (BPA)](https://github.com/hyperledger-labs/business-partner-agent) provides a UI and some value-added capabilities for businesses to run on an Aries network. The BPA consists of a backend set of services (implemented in Java) that provide an interface to the BPA agent's aca-py instance. This backend exposes a set of HTTP endpoints, and provides a listener endpoint to receive webhooks from the aca-py agent. Adding Endorser support will involve the following changes, which are described below. ```plantuml artifact Vue_App { folder Author { artifact Manage_Schema artifact Manage_Cred_Def } folder Endorser { artifact Connections artifact Transactions } } artifact backend { together { artifact BPA_API { folder Txn_Endorser_API { } folder Txn_Author_API { } } artifact BPA_Web_Hooks { folder Endorser_Hooks { } } } together { database BPA_db #line.dotted artifact aca_py { database wallet } } } Vue_App --[hidden]d-> backend Endorser -down-> Txn_Endorser_API Author -down-> Txn_Author_API Txn_Endorser_API --> aca_py Txn_Author_API --> aca_py aca_py -up-> Endorser_Hooks Endorser_Hooks .down.> BPA_db Txn_Endorser_API .down.> BPA_db Txn_Author_API .down.> BPA_db ``` ## Configuration and Startup Support Each BPA instance will need to be configured as Endorser or Author (Endorser can write to the ledger; Author can't). The Endorser will also need to be configured as to whether they will provide Endorser services or not (for example a BPA can be setup with an Endorser DID but only to write their own information to the ledger). For Authors, they will need a configuration setting for the default Endorser to connect to (Endorser endpoint and DID, and possibly a static invitation to connect). For Authors the connection to the Endorser would be automatic (on startup, if there is no Endorser connection, then establish one). For Endorsers, the BPA could be setup to either accept Author connections automatically or provide a UI to manually list/accept Author connection requests. ## Adding Backend Endorser Protocol Support The backend code exposes endpoints for the Vue app to call aca-py services. Support will need to be added for aca-py's "transaction" API's, which are used to query transactions, ask for endorsement (Author), endorse or refuse to endorse (Endorser) and write the transaction to the ledger (Author or Endorser). Support will have to be added to the schema and credential definition endpoints to support the additional "Endorser Protocol" parameters - should the transaction be written to the ledger directly? And if not, what are the Endorser settings? A separate BPA database may need to be established. The functionality *can* be implemented by just relying on aca-py's internal queues (transaction exchange records etc.) however if any meaningful configuration or auditing needs to be applied (for example a record of *who* endorsed *what* transactions *when*) then a BPA database would need to be implemented. ## Adding Frontend Support for the Endorser Role The Endorser will need a UI to: - View/approve author connections - View/approve/reject transaction endorsement requests Approval of Author connections and transaction endorsements *could* be configured to be automatic (or could be based on rules) however at minimum the Endorser UI would need to list transactions and their status (awaiting endorsement, endorsed, etc.) and provide some filtering capabilities (e.g. show me Endorsements for the past week). Integration with aca-py would be via the backend API endpoints. Note that the Endorser role and whether to provide Endorsement support to Authors would be two separate configurations (i.e. an Endorser can write their own transactions to the ledger buy *may* not want to provide Endorsement services to other Authors). Relevant backend functions: - Connection API - List Transactions - Endorse transaction request - Reject transaction request Relevant web hooks: - Depending on configuration, automatically approve Author Connection requests and Endorsement requests ## Adding Frontend Support for the Author Role If an Author does not have write access to the ledger, then they *must* be configured with an Endorser. Establishing a connection to the Endorser should be automatic and configured via configuration settings. If an Author creates a Schema or Credential Definition, then the UI must provide the additional parameters to the API endpoint - a flag to indicate that the transaction must be endorsed, and the relevant Endorser info (i.e. the connection id). The existing UI for creating the Schema or Credential Definition would not need to change. The Schema/Credential Definition *List* UI would also need to display any transactions-in-flight, and potentially give the Author the option to cancel or re-send the transaction to the endorser. Once the transaction is endorsed and the Schema or Credential Definition created, then the transaction need not be displayed. Relevant backend functions: - Create Schema - Create Credential Definition - Request Endorsement - Resend Endorsement Request - Cancel Endorsement Request - Write Transaction to Ledger - List Transactions Relevant web hooks: - Receive endorsed transaction - the web hook would automatically call the "write" endpoint when an Endorsement message was received - Potentially send notifications upon receipt of other message types ## Modes and their Policies/Rules To implement mentioned features the BPA needs to support three modes: 1. ENDORSER_PRIVATE - which is the default 2. ENDORSER_PUBLIC 3. AUTHOR Each mode requires a different set of rules/policies in the backend to be run either on startup or during runtime. 1. ENDORSER_PRIVATE This is basically what we have now, meaning all functionality that is added to support the other modes should not affect that one. 2. ENDORSER_PUBLIC - Accepts any connection - Can auto accept further endorser requests from the same connection after the first one has been allowed - Throttling of requests 3. AUTHOR - Auto connect to endorser on startup Also each mode needs different startup flags. If this gets to complicated I would recommend to switch to micronaut's configuration properties so that the BPA can fail if the configured properties do not match the configured mode. ### Switching between the modes We have two options here, first do not allow switching between the modes and fail on startup if that happens. Second, allow where it makes sense. - AUTHOR -> ENDORSER_XXX depends if indy even allows this - ENDORSER_PUBLIC -> ENDORSER_PRIVATE - probably deny - ENDORSER_PRIVATE -> ENDORSER_PUBLIC - allow - ENDORSER -> AUTHOR - probably deny, but in theory a endorser could always use another endorser especially if we think multi ledger where one might be endorser on one and author on another ## Feature Toggles To sepparate the modes in the frontend/backend the BPA needs to dynamically enable/disable features so that not all three are active at the same time. To do this we have several options. 1. In the Frontend The UI can load the current state from the backend and then show/hide certain parts. 2. In the Backend Here we need the following - For endpoints that stay the same, but should do diffenrent things based on the mode we need either consistency checks, and/or a toggle that switches the implementation based on the mode - For whole new API's like the endorser functionality the whole thing needs to be made a conditional bean so that the bean is not available to the other modes. Basically the same behaviour that we implemented in the web mode - Mode specific implementations should be maintained in a sepparate package below impl - Startup tasks should also be sepparated by mode and maybe based on a rules engine

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully