Nxt Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client 1.11.2 - Announcement for Ardor (Nxt 2.0) is here. Ardor Tokens have been released!

Pages: [1] 2 3 ... 5  All

Author Topic: [Client Plugins] Specification / Developers Guide  (Read 7238 times)

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

Hi guys,
here the draft for the developers guide for upcoming plugin system for the NRS client, directly copied from the DEVELOPERS-GUIDE.md readme file:

----
# PLUGIN DEVELOPERS GUIDE #

----
Current Plugin Version: 1

## Introduction ##

By developing a plugin, you can add functionality to the NRS client. Have
a look at the client source code and documentation to get an overview
about the various javascript APIs and best practices and examples how to
use them.

For a plugin to be valid is has to be delivered with a minimum set of files
and come with a ``manifest.json`` plugin manifest file being compatibel with
the current major plugin version and providing some meta information about
the plugin.

----
## Example Plugin ##

There is an example plugin ``hello_world`` which can be found in the ``plugins``
folder. If you want to see this plugin in the client UI you can activate it
in the associated ``manifest.json`` file by setting the ``deactivated`` flag to ``false``.

----
## File Structure ###

The following is the minimal file structure for a plugin:

```
[plugin_name]/
[plugin_name]/manifest.json
[plugin_name]/html/pages/[plugin_name].html
[plugin_name]/html/modals/[plugin_name].html
[plugin_name]/js/nrs.[plugin_name].js
[plugin_name]/css/[plugin_name].css
```

### Manifest File ###

Meta information about the plugin is provided as a ``JSON`` dictionary in a
``manifest.json`` file in following format:

```
{
    //mandatory
    "pluginVersion": 1, //Integer, don't use parenthesis!
   
    "name": "Name of your plugin", //max. 20 characters
    "myVersion": "Your plugin version", //no format requirements
    "short_description": "A description of your plugin", //max. 200 characters
    "infoUrl": "http://infosaboutmyplugin.info",
    "startPage": "p_hello_world", //One of the pages used for NRS.pages.PAGENAME method(s)

    "nrsVersion": "1.5.0", //ALWAYS provide three sequence numbers, no additions like "e"!

    //optional
    "deactivated": true, //hard-set deactivation, default: false
    "sidebarOptOut": true //opt out of being listed under sidebar "Plugins" entry, default: false
}
```

Hint: Don't use comments in your own ``JSON`` file!

### Plugin Compatibility/Valdation ###

Plugins are compatible when the manifest file is written for the same
major plugin version supported by the installed client.

Mayor plugin versions won't change very often, minor plugin version releases will
remain compatible within the major version.

After a detected plugin is determined as compatible the NRS client will be validating the
manifest file format and file structure.

### NRS Compatibility ###

Due to the broad scope of plugins the functional compatility of the plugin
with various NRS versions can't be guaranteed by the plugin mechanism
and is the responsibility of the plugin creator.

The ``nrs_version`` attribute in the manifest file indicates the NRS version
the plugin was written for. Due to possible changes in javascript API behaviour
it is recommended to release a new plugin version for every new NRS release,
though a plugin will still be running after minor release updates (e.g. a
plugin written for "1.5.1" running under "1.5.5" client installation).

After a major NRS update (e.g. from "1.5.9" to "1.6.0"), the plugin will stop
working and has to be updated.

## Best Practices for Development ##

- Namespace your function names, CSS IDs and classes and other possible
identifiers to avoid collisions affecting core NRS behaviour
- Convention vor namespacing: "p_[PLUGINNAME]_[LOCALIDENTIFIER]", e.g.
"p_hello_world_info_modal"
- Don't manipulate non-plugin HTML or CSS with your javascript code or CSS
declarations

----
## Changelog ##

**Version 1.0, 2015/02/16**

Initial plugin/manifest version
« Last Edit: February 18, 2015, 09:26:44 am by HolgerD77 »
NXT-AQ9F-JC4F-NCM2-4JSXZ

Riker

  • Core Dev
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1443
    • View Profile
  • Karma: +380/-42

After a major NRS update (e.g. from "1.5.9" to "1.6.0"), the plugin will stop
working and has to be updated.

I don't think this is necessary. Chances are most plugins will continue to work on a minor upgrade and we can't expect developers to update their plugins every 2 month.
I would just restrict plugin version to be less than or equal to the NRS version so that new plugins cannot work with old client versions and display the plugin version in a visible location.
NXT Core Dev
Account: NXT-HBFW-X8TE-WXPW-DZFAG
Public Key: D8311651 Key fingerprint: 0560 443B 035C EE08 0EC0  D2DD 275E 94A7 D831 1651

SwissAlps

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 439
    • View Profile
    • TheMillionNxtHomepage
  • Karma: +25/-8

Would like to try this "Hello world", but I do not know where to find this "Plugin" folder...?
 ???

OK, just found it using Wikipedia...oops
« Last Edit: February 18, 2015, 09:59:15 am by SwissAlps »
NXT-SBSP-BPHH-E7BR-9USXU is promoting the use of NXT in the real life, see : http://www.NXTtracker.com...
Member of TheNxtForex committee

Tosch110

  • Global Moderator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2375
    • View Profile
  • Karma: +211/-16

Would like to try this "Hello world", but I do not know where to find this "Plugin" folder...?
 ???

OK, just found it using Wikipedia...oops

can you enlighten us?

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

After a major NRS update (e.g. from "1.5.9" to "1.6.0"), the plugin will stop
working and has to be updated.

I don't think this is necessary. Chances are most plugins will continue to work on a minor upgrade and we can't expect developers to update their plugins every 2 month.
I would just restrict plugin version to be less than or equal to the NRS version so that new plugins cannot work with old client versions and display the plugin version in a visible location.

Ok, will change that and just show a warning.
NXT-AQ9F-JC4F-NCM2-4JSXZ

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

Would like to try this "Hello world", but I do not know where to find this "Plugin" folder...?
 ???

OK, just found it using Wikipedia...oops

One of the most cryptic posts I read on this forum to date. :-)
NXT-AQ9F-JC4F-NCM2-4JSXZ

Tosch110

  • Global Moderator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2375
    • View Profile
  • Karma: +211/-16

But I have the same problem. Where is the "plugin" folder? I would like to port my plugin to the tool so it can be published soon ;)

Riker

  • Core Dev
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1443
    • View Profile
  • Karma: +380/-42

But I have the same problem. Where is the "plugin" folder? I would like to port my plugin to the tool so it can be published soon ;)

It will be available in 1.5.0e
NXT Core Dev
Account: NXT-HBFW-X8TE-WXPW-DZFAG
Public Key: D8311651 Key fingerprint: 0560 443B 035C EE08 0EC0  D2DD 275E 94A7 D831 1651

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

Current status of plugins overview page:

NXT-AQ9F-JC4F-NCM2-4JSXZ

Tosch110

  • Global Moderator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2375
    • View Profile
  • Karma: +211/-16

Ok, I have setup all the things you defined above. Would be ready for testing =)

jones

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
  • Karma: +310/-8

I suggest adding a section to include a validation token.

createToken(sha256(plugincode), personWhoMadeItsAccount).

That way we can validate that this person did create the plugin and that the text of the plugin you recieved is correct and from that person who owns that account at a specific time.

Also managing security is tough, what if I make a plugin that just sends everyones balance to my account, A system of code reviewers signing off on plugins would be helpful down the line.
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

bitcoinpaul

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3090
  • Karmageddon
    • View Profile
  • Karma: +587/-586

This is great.

Could Multigateway (and every other shit out there) be developed as a plugin, please.
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

I suggest adding a section to include a validation token.

createToken(sha256(plugincode), personWhoMadeItsAccount).

That way we can validate that this person did create the plugin and that the text of the plugin you recieved is correct and from that person who owns that account at a specific time.

Could you describe this a bit more detailed in a few steps and separated by actions by plugin creator and plugin user? Not yet really understand the process.
NXT-AQ9F-JC4F-NCM2-4JSXZ

rudeboi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 633
  • Nxt Organization Member
    • View Profile
  • Karma: +55/-4


This is great.

Could Multigateway (and every other shit out there) be developed as a plugin, please.

Yes would work, I would expect multigateway to issue a plugin, the trade volume would grow significantly.
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬  ▄▀▀▀▀▀▀▀▀▄  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●  nimirum  ●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬ ◖ENDING CENSORSHIP ONLINE◗  ◖ ICO OPEN NOW◗ ▬▬▬

rudeboi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 633
  • Nxt Organization Member
    • View Profile
  • Karma: +55/-4

Great work Holger.

How do you access each of the launched plugins UI? Appear as a sub menu item in plugins?
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬  ▄▀▀▀▀▀▀▀▀▄  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●  nimirum  ●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬ ◖ENDING CENSORSHIP ONLINE◗  ◖ ICO OPEN NOW◗ ▬▬▬

Sebastien256

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2667
  • ^LOOK UP^ = Nxt community!
    • View Profile
  • Karma: +162/-24


This is great.

Could Multigateway (and every other shit out there) be developed as a plugin, please.

Yes would work, I would expect multigateway to issue a plugin, the trade volume would grow significantly.

That would awesome. Exactly what is need now! With 2 phase transaction in NRS 1.5 mgw could be much less centralized. This would be very good.
Please drop your ideas concerning Nxt and/or NRS in this topic -> List of feature request for Nxt and/or NRS (with the full list in OP).

jones

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
  • Karma: +310/-8

I suggest adding a section to include a validation token.

createToken(sha256(plugincode), personWhoMadeItsAccount).

That way we can validate that this person did create the plugin and that the text of the plugin you recieved is correct and from that person who owns that account at a specific time.

Could you describe this a bit more detailed in a few steps and separated by actions by plugin creator and plugin user? Not yet really understand the process.

1. User completes the entire plugin with manifest, signature field is empty.
2. User takes a sha256 sum of all the files in the directory of the plugin, (through a command or a tool can be made)
3. User puts the hash into token of nxt client.
4. User takes the token generated and adds it to the manifest.

Validating:
1. Valudator zeros the signature spot and hashes the plugin
2. Compares the hash and public key to affirm the token signature.
3. If it passes this plugin is valid.
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

SwissAlps

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 439
    • View Profile
    • TheMillionNxtHomepage
  • Karma: +25/-8

Would like to try this "Hello world", but I do not know where to find this "Plugin" folder...?
 ???

OK, just found it using Wikipedia...oops

One of the most cryptic posts I read on this forum to date. :-)

Sorry, I was just trying to have a first view of how this plugins are working, so yes, wiki was quite helpful... ;D

May be I come later with other very strange questions...
NXT-SBSP-BPHH-E7BR-9USXU is promoting the use of NXT in the real life, see : http://www.NXTtracker.com...
Member of TheNxtForex committee

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

Great work Holger.

How do you access each of the launched plugins UI? Appear as a sub menu item in plugins?

Yes, that's standard behaviour like in following screenshot of example hello_world plugin. Plugins can also opt out of sidebar integration (after current specification) and manage their own navi item e.g. to build up something more complex with subpages and the like.

NXT-AQ9F-JC4F-NCM2-4JSXZ

HolgerD77

  • Core Dev
  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 299
    • View Profile
  • Karma: +49/-0

Yes would work, I would expect multigateway to issue a plugin, the trade volume would grow significantly.

That would awesome. Exactly what is need now! With 2 phase transaction in NRS 1.5 mgw could be much less centralized. This would be very good.

As far as I understand it, this needs also account control (which is basically 2phased transactions behaviour locked/set to mandatory for an account), which is not part of 1.5.0 yet and will come one or two major releases later. Nevertheless a good step in this direction though.

What I didn't follow: is MGW meanwhile completely merged with SuperNET, so does MGW-plugin means SuperNet plugin? Or is this still handled as separate technologies?
NXT-AQ9F-JC4F-NCM2-4JSXZ
Pages: [1] 2 3 ... 5  All