Skip to content

Commit bae4d60

Browse files
SaberDoTcodeRMarcin
authored andcommitted
Update SubsCrypt.md
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.
1 parent 26f6bd0 commit bae4d60

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

applications/SubsCrypt.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,41 @@ As we have been searching for similar ideas in the blockchain ecosystem, we foun
7272

7373
## Development Roadmap :nut_and_bolt:
7474
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+
7576
**There will be three ways to connect to our smart contract:**
7677
1. Using a Polkadot{.js} wallet to interact with the contract(state of the contract can be modified in this scenario)
7778
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)
7879
3. Using any customized client to interact with the contract
7980

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+
8088
**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).
8189

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 |
94+
| ------------- | ------------- | ------------- | ------------- | ------------- |
95+
| 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+
82110
**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.
83111

84112
**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
88116
### Overview
89117
* **Total Estimated Duration:** 9 weeks
90118
* **Full-time equivalent (FTE):** 5
91-
* **Total Costs:** 1.1 BTC
119+
* **Total Costs:** 1 BTC
92120

93121
### Milestone 1 — Smart Contract
94122
* **Estimated Duration:** 3 weeks
@@ -99,14 +127,15 @@ We will divide our project into four milestones. For the first milestone, we wil
99127
| Number | Deliverable | Specification |
100128
| ------------- | ------------- | ------------- |
101129
| 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.|
103131
| 1.1 | Contract code | implementation of contract |
104132
| 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.
106134
| 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 |
107135
| 2. | Article | We will write an article or tutorial that explains the work done in this milestone as part of the grant.
108136
| 3. | Design Front-End component | design UI and UX of front-end component with adobe xd.
109137
| 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 |
110139

111140
### Milestone 2 — UI
112141
* **Estimated Duration:** 5 weeks
@@ -127,7 +156,7 @@ We will divide our project into four milestones. For the first milestone, we wil
127156
### Milestone 3 — Back-end libraries
128157
* **Estimated Duration:** 6 weeks(parallel with milestone 2)
129158
* **FTE:** 3
130-
* **Costs:** 0.5 BTC
159+
* **Costs:** 0.4 BTC
131160

132161
| Number | Deliverable | Specification |
133162
| ------------- | ------------- | ------------- |

0 commit comments

Comments
 (0)