- Add your Starton API Key
API_KEY
in the .env file of the project - Setup MongoDB vars
MONGODB_URI
andDB_NAME
in the .env file of the project - Make sure Docker is working with
docker run hello-world
- Build and start the app with
docker compose up
It is recommanded to use NVM to have the correct node version.
- Export your Starton API Key with
export API_KEY=xx_xxx_xxxxxxx-xxxx-xxxx-xxxxxxxxxx
, replacing xxxxx with your key - Export your MongoDB vars with
export MONGODB_URI=xxx && export DB_NAME=xxx
, replacing xxx with your vars - Install the correct version of node with
nvm install 18
- Use the correct version of node with
nvm use
- Install dependencies with
npm install
- Build the app with
npm run build
- Start the app with
npm start
You can now access to the app at http://localhost:3000 or http://localhost:80
See the deployed project on licenka.space !
It is difficult for small businesses to manage their license sale.
After thinking about the tracks proposed in this hackathon, we have finally found this problem: "It's difficult for small businesses to manage their sold licenses" which is into the "E-Society" track.
Nowadays, many companies want to sell their software products through the sale of licenses to its users.
However, in order to be able to sell licenses, these companies are forced to choose between two options: develop their own license and user management solution, or pay another company for a license management service.
In both cases, doing this is very expensive for businesses, which is very complicated for small businesses. This problem can also affect open-source projects, which do not have funds, and which must also find their own solution to make the companies that use the project pay, for example. The other problem that can arise concerns users, indeed if the platform managing their license were to close, there is no longer any evidence that the user has paid the license.
In our opinion, this issue falls within the theme of "Building a decentralized Future" because the important themes of real possession of its information, infallibility and democratization of decentralized technologies are at the heart of the challenges of Web3.
To solve this issue, we decided to create a license management platform called Licenka.
The objective of our platform is to make it easy to create a license by defining a price in BUSD and linking a wallet that will receive the funds when purchasing the license.
One of the challenges is to allow companies to use our solution very easily, so we were inspired by Starton in order to offer public API routes allowing companies to very simply buy, and check if a user has a license without Web3 knowledge.
The technologies we used are Next.js for the front and the API, Vercel for the deploy, Docker, MongoDB, Web3.js, Starton API, BNB Chain and we support Ledger.
Our main technical challenge was to be able to buy licenses easily, because it is necessary to approve the transfer of funds beforehand to be able to make the payment, and companies should not need to use Web3 technologies. Thus, we decided to create a page inspired by Paypal, on which the payment is made and which redirects the user to the chosen address once the license has been acquired.
Another problem we had to deal with was the fact that we could easily authenticate a user with metamask, on a Web2 app, to verify that he had a license. However we have developed a "oauth" flow (describe below). After oauth flow the client will receive a signed_nonce, which is use to call our Web2 API to authenticate the user and permit to client to know if the user has the license. This process avoids to the Web2 version for companies that do not wish to use Metamask auth.
Thus, our solution can work both with the implementation of their own authentication flow for Web3 client, and both with the Web2 version for companies that do not wish to use Metamask auth.
See the deployed project on licenka.space !2
- Use
git clone [email protected]:MaximePremont/Licenka.git
- Use
cd Licenka
- Add your Starton API Key
API_KEY
in the .env file of the project - Setup MongoDB vars
MONGODB_URI
andDB_NAME
in the .env file of the project - Setup and start like described here, recommanded :
docker compose up
You can now access to the app at http://localhost:3000
Team members :
During the hackathon we learned how to create a contract on the BSC blockchain and deploy it using Starton API/Front. Using next.js and Web3.js we were able to create our first Dapp, and interact with our contract using Starton and direct function calling with Web3.js.
To use our system, you must first create a license in order to obtain the license ID. Then it is possible to use it as desired.
๐ It is possible to define an expiration for licenses in days when they are created !
๐ Here are the following address:
- Licenka Contract address: 0x150B6328F1810589aF899f6d9F17E0347f77c8b8
- BUSD Contract address : 0xeD24FC36d5Ee211Ea25A80239Fb8C4Cfd80f12Ee
Our solution is deployed and working with 3 parts :
- A main page (https://licenka.space) to show the project
- A license creation page (https://licenka.space/create), to create a new license with our wallet
- A license buy page (https://licenka.space/approve), which allow the user to buy a license with his wallet, and redirect to the company page after that.
- A oauth page (https://licenka.space/oauth?redirect_uri=https://demo.licenka.space/auth&licence_id=7)
As explained, our API can be used in 2 different ways: Web2 or Web3 :
-
Web2 API
:- Get license informations for a user
https://licenka.space/api/license
Query: userAddress licenseId 200: license: { licenseId: validTime: isInfinite: }
- Know if a user has a license
https://www.licenka.space/api/checkLicense
Query: userAddress licenseId signedNonce 200: license: bool
- Get a nonce of user, with this nonce signed we can authenticate user
https://www.licenka.space/api/wallet/nonce
Query: walletAddress 200: nonce: string
- Get license informations for a user
-
Web3 Licenka
: ย Here are the functions which can be called by users (Owner functions and internal functions are not displayed)- Licenka Contract address: 0x150B6328F1810589aF899f6d9F17E0347f77c8b8
- BUSD Contract address : 0xeD24FC36d5Ee211Ea25A80239Fb8C4Cfd80f12Ee
ย
- Get the
license
information from a given ID.
function licenses(uint index) returns(License) struct License { address owner; string name; uint price; uint duration; }
- Get the
subscription
information from a given ID.
function subscriptions(uint index) returns(Subscription) struct Subscription { address owner; uint validTime; }
- Create a
license
with a given name, price, and duration (0 for an endless license). Each payment will be sent to the owner address.
function createLicence(address owner, string memory name, uint price, uint duration)
- Create a
subscription
to alicense
.
function subscribe(uint licenseId)
- Check if an address has a valid
subscription
to alicense
.
function verifySubscription(address owner, uint licenseId) returns(bool)
- Get all the
licenses
owned by a wallet
function getLicenses(address owner) returns(uint[])
- Get all the
subscriptions
owned by a wallet
function getSubscriptions(address owner) returns(uint[])
- Get information about the
subscription
of the owner for alicense
.
function getSubscriptionIdForLicense(address owner, uint licenseId) returns(uint)
-
Web3 LicenkaChecker
: ย LicenkaChecker is a contract to be added to developers' contract who would like to check for users subscription validity.- Add the address of the Licenka contract address.
constructor(address licenkaAddress)
- Modifier to require a wallet to have a valid
subscription
to alicense
.
modifier mustBeSubscribe(address owner, uint licenseId)
The objective of our project is to propose a reliable and very inexpensive alternative. Thus, we will earn money by taking 3 % when purchasing a license with our system.
Our possible project has a very big potential to grow, indeed we have already been able to imagine an even more advanced system which would make it possible to propose an client and/or an user dashboard to they can manage their purchased or selled licenses.
https://www.youtube.com/watch?v=vazbtqNn8To&ab_channel=MaximePremont
You can also find the 1.0 video here.
We have built an demonstration app, called CloudGaming, you've seen in the previous video. This application is in demo folder. If you want to know how to implement Licenka and/or test it, check the demo demo/README.md.
Our project is deployed and available on licenka.space !
- Web3 implementation
- Web2 API simple implementation
- Create a license
- Create a license with expiration time
- Check if user has a license
- Get license informations for a user
- Buy a license
- Oauth flow with wallet signature of an nonce
- Be able to authenticate user with signed nonce
- Starton : for contract calls and management
- BNB Chain : deployment
- Ledger : full compatibility of ledger wallets with our system
โค๏ธ Thanks to Starton and all of its partners for making it possible to attend the talks, workshops and the organization of this hackathon.