You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auth mechanism explanation
The functions of the contract that will be implemented in the first milestone has been added thoroughly
PSP has been included in the first milestone
BTC amount is edited.
Copy file name to clipboardExpand all lines: applications/SubsCrypt.md
+33-4Lines changed: 33 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,13 +72,41 @@ As we have been searching for similar ideas in the blockchain ecosystem, we foun
72
72
73
73
## Development Roadmap :nut_and_bolt:
74
74
We will divide our project into four milestones. For the first milestone, we will implement our smart contract can be deployed to a substrate chain using ink! Which is a smart contract substrate pallet. The second and third milestones will be implemented in parallel. The last milestone will be connecting the components to work seamlessly together.
75
+
75
76
**There will be three ways to connect to our smart contract:**
76
77
1. Using a Polkadot{.js} wallet to interact with the contract(state of the contract can be modified in this scenario)
77
78
2. Using our RestAPI backend or third party library to retrieve data from the contract (state of the contract can not be modified in this scenario)
78
79
3. Using any customized client to interact with the contract
79
80
81
+
**Auth mechanism :**
82
+
We have designed a secure and user-friendly auth mechanism that users and providers can easily use it.
83
+
84
+
Users have to choose a pair of token and passphrase, which we recommend having a common token(more than 16 chars) in every provider that they subscribe but have a different passphrase(can be small). Users will submit sha256(token+passphrase) to the contract, and whenever they want to authenticate themselves, they have to provide these token and passphrase in a view function( which is not a transaction, so it's not on-chain and free).
85
+
They also have to once set their sha256(token+passphrase) for using the SubsCrypt dashboard without a wallet.
86
+
The authentication with a wallet is checked by the blockchain address sender.
87
+
80
88
**First milestone**: we will design(it is almost done right now) and implement our smart contract, and we will also design XD files of UI, and we will write our white-paper in this milestone(including the test unit).
81
89
90
+
The main functions that will be deployed on the chain in this milestone are as follow:
91
+
92
+
93
+
| Function | Description | Params | Returns | State mutability |
| addPlan | This function is for providers to add their plans; each plan has duration, price, max refund percent that they are willing to lock in contract and withdraw after that the subscription period has finished. | list of durations, list of prices, list of max refund percent | None | change state |
96
+
| editPlan | This function is for providers to edit their plan. (Old subscriptions are not affected by this change) | index of their plan, new duration, new max refund percent, new price | None | change state |
97
+
| changeDisable | This function is for providers to edit their plan that changes the active or deactivate status of their plan(so people can or can't subscribe in that plan) | plan index| None | change state |
98
+
| subscribe | This payable function is for users to subscribe to their desired service and plan; they have to provide a hash of their password (the auth mechanism will be explained thoroughly in Auth Section) and provider address and plan index and some metadata that is encrypted by the public key of the provider(users can trust providers to share their data with but nobody else can know that data) | provider address, plan index, the hash of pass, An optional encrypted metadata| None | change state(payable) |
99
+
| refund | This function is for users to refund their subscribe anytime they want and instantly withdraw the rest of their money(maximum amount of refund is indicated by max refund percent that provider had set for that plan) | provider address, plan index| None | change state |
100
+
| withdraw | This function is for providers to withdraw the amount that is now ready to withdraw(this is the money that we lock in the contract when a user subscribes to a plan according to max refund percent, and when their plan is finished, that money can be withdrawn). We used an optimized LinkedList solution, which is really cheap to execute and fast. | None | amount of money you are paid | change state |
101
+
| checkSubscription | This function is for users or anyone to check that if a user has an active subscription in a specific plan of a provider | address of the user, address of provider, plan index| return boolean | view |
102
+
| checkAuth | This function is used to check if the given combination of token and passphrase can authenticate a specific user for a provider(the auth mechanism will be explained thoroughly in Auth Section) | address of the user, address of provider, token, passphrase| return boolean | view |
103
+
| retrieveWholeDataWithPassword | This function is used to get every subscription record of a user with their token and passphrase, which first have to be set in setSubsCryptPass function(this token and passphrase is only worked to login in SubsCrypt website to have a whole review of your account) | address of the user, token, passphrase| return whole records of a user | view |
104
+
| retrieveWholeDataWithWallet | This function is the same as the above function with a slight difference that it is used with user wallet to trigger the contract directly | None | return whole records of a user | view |
105
+
| retrieveDataWithPassword | This function is used to get every subscription record of a user only related to a specific provider with their token and passphrase is set once they subscribe to their chosen plan of that provider | address of the user, address of provider, token, passphrase| return whole records of a user | view |
106
+
| retrieveDataWithWallet | This function is the same as the above function with a slight difference that it is used with user wallet to directly trigger the contract | address of provider| return whole records of a user-related to that provider | view |
107
+
108
+
109
+
82
110
**Second milestone**: we will implement the UI Dashboard(Vue.js) and UI modules(ES6 and pure js) regarding our XD design in the previous milestone.
83
111
84
112
**Third milestone**: Implementing our RestAPI backend in Node.js to provide an API layer to interact with our contract(it is optional to use this API), we will also implement our third-party libraries for Django and node.js to interact with our backend and implement the required functionality to make the integration for developers easier(including test unit).
@@ -88,7 +116,7 @@ We will divide our project into four milestones. For the first milestone, we wil
88
116
### Overview
89
117
***Total Estimated Duration:** 9 weeks
90
118
***Full-time equivalent (FTE):** 5
91
-
***Total Costs:** 1.1 BTC
119
+
***Total Costs:** 1 BTC
92
120
93
121
### Milestone 1 — Smart Contract
94
122
***Estimated Duration:** 3 weeks
@@ -99,14 +127,15 @@ We will divide our project into four milestones. For the first milestone, we wil
99
127
| Number | Deliverable | Specification |
100
128
| ------------- | ------------- | ------------- |
101
129
| 0a. | License | Apache 2.0 |
102
-
| 1. | Contract Implementation | we will implement the contract and deploy it to a test net.
130
+
| 1. | Contract Implementation | we will implement the contract and deploy it to a test net.|
103
131
| 1.1 | Contract code | implementation of contract |
104
132
| 1.2 | High-level API | we will provide an API of contract |
105
-
| 1.3 | Documentation | full documentation of API that explains how to connect to and use it.
133
+
| 1.3 | Documentation | full documentation of API that explains how to connect to and use it.
106
134
| 1.4 | Testing Guide | The code will have unit-test coverage (100%) to ensure functionality and robustness. In the guide, we will describe how to run these tests |
107
135
| 2. | Article | We will write an article or tutorial that explains the work done in this milestone as part of the grant.
108
136
| 3. | Design Front-End component | design UI and UX of front-end component with adobe xd.
109
137
| 4. | white-paper | full description of roadmap and technical specification of this project |
138
+
| 5. | Polkadot Standards Proposals (PSPs) | we will pull request a PSP in this milestone containing our implementations |
110
139
111
140
### Milestone 2 — UI
112
141
***Estimated Duration:** 5 weeks
@@ -127,7 +156,7 @@ We will divide our project into four milestones. For the first milestone, we wil
127
156
### Milestone 3 — Back-end libraries
128
157
***Estimated Duration:** 6 weeks(parallel with milestone 2)
0 commit comments