Billing example
To illustrate the Privacy Overlay, and how it can be used effectively, two possible implementations of the Billing mechanism referred to in the Agreement Smart Contract are shown.
The requirements for the Billing mechanism are:
- The Business Network Operator ‘Agree Corp’, who has built and runs the Agreement CorDapp wants to bill the users of the Network based on usage.
- Whenever a deal is finalised on the network, as indicated by a transaction with an ‘Agree’ command, Agree Corp should receive notice of that activity.
- AgreeCorp must receive that notice before the (off ledger) invoicing date, not necessarily at the time of finalisation of the Agree transaction.
- Agree Corp should have the ability to vary the billing rate per Agree transaction at any time.
- AgreeCorp must not receive a copy of any agreements made on its Network.
- Parties who are not participants on an agreement must not receive copies of an Agreement, including in future transaction resolutions.
The intuitive approach to meeting these requirements is to create a BillingState which that must be included in each Agree transaction, with a cumulativeUse tracker that increments by a per transaction rate each time it is used. The Smart Contract for this BillingState might look like this:
With a corresponding RateCard smart contract:
You can show the Billing and RateCard Smart Contracts interacting with the Agreement Smart Contract using the Ledger Evolution view:
You can see that the cumulativeUse property has increased between the input.BillingState and output.BillingState by the amount indicated in the RateCardState.
You can then show what happens when the same billing token is used in another Agree transaction, this time with Charlie to buy ‘One kg of sausages’ for £20:
The next step is to add the privacy overlay.
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.