How to register your npm packages to Dev Protocol

You can earn DEV tokens according to your npm package(s) downloads when registering your npm package(s) to Dev Protocol.

We’ll provide a user-friendly UI in the future, but it’s not yet available, so manual operation is required for the registration, however.

This post will walk you through manually registering your npm package. Follow me!

First, create a new Property.

Property is a just ERC-20 token but helps organize your assets.

PropertyFactory creates a new Property. So please open PropertyFactory’s page on Etherscan.

https://etherscan.io/address/0xcab309ff43534e7c33a63b1ef5ec6db9e8bc2680#writeContract

Note: PropertyFactory can also discover in devprtcl.com.

Access the page, then click “🔴Write Contract Connect to Web3” to your Ethereum wallet, such as MetaMask. After connected, the red icon changes to green.

Scroll down to the “create” section, enter the required pieces of information.

“_name” is used as a token name, it’s a good idea to match the package name.

“_symbol” is used as a token symbol, it’s a good idea to keep it as short as possible, with at least three characters. The “symbol” has a role like “USD” in “1 USD.”

“_author” is your wallet address. Can associate an npm package with this new Property has who is only this account. *This address must match the wallet address of the person authenticating the npm package. If it is different, you will fail at the last step.

For example, enter like this.

Then, click the “Write” button and confirm the transaction. After showing the “View your transaction” link, click it to open the transaction information page.

Wait until the status became “Success” like the following:

Then, open the “Event Logs” tab. There is an address of the new Property at event data in an event named “Create.”

This is the address of the new Property!

Next, create an npm access token.

“npm access token” isn’t blockchain tokens, secret tokens of npmjs.com.

Logged-in your npmjs.com dashboard to create a new access token.

At this time, choose “Read Only” as the access level.

Note: For security, it cannot use already used tokens. If you are this registration is 2nd time, please create a new access token.

Please copy or save this access token.

Then, let’s go the final step!

Finally, authenticate your npm package.

In Dev Protocol, the authentication of your assets is performed by a user-generated-contract called Market. And, the Market for npm is here.

When open this page, click “Connect to Web3” to connect to your wallet.

Then, scroll down to the “authenticate” section, enter the required pieces of information.

“_prop” is your Property address. This was created in Step 1.

“_args1” is your npm package name. This is the full name of the npm package, so require organization name starts with “@” if your package is into an organization.

“_args2” is your npm access token. This was created in Step 2.

“_args3” to “_args5” is 0; those aren’t using in this Market.

For example, enter like this.

Then, click the “Write” button and confirm the transaction. After showing the “View your transaction” link, click it to open the transaction information page.

Wait until the status became “Success.” But not finished. To detect finish, require watching events because the authentication is running on asynchronously.

To watch events, open the NpmMarket contract page. (NpmMarket is implement-contract for npm market. The address is also can read from the Market’s behavior property)

Please reload every few minutes until appearing a new event named “Registered.”

When it was shown, open the Txn Hash page, view the Event Logs tab. Then, check “_package” in the event data, if the value equals your package, it’s completed!

Congratulations!🎉 Your npm package already registered in Dev Protocol!

Please make a note of the “_metrics” value in the data for the “Registered” event. The address is necessary information when minting DEV.

I will explain the minting method in another post, wait for a minute!

Dev Protocol🌐 https://devprtcl.com/

Join our Discord👾 https://discord.gg/VwJp4KM

Follow our Twitter🐤 https://twitter.com/devprtcl

--

--