elective-stereophonic
elective-stereophonic
Prefix in AM for better usage  
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.12.2

Pages: [1] 2 3  All

Author Topic: Prefix in AM for better usage  (Read 11700 times)

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Prefix in AM for better usage
« on: March 23, 2014, 04:09:12 pm »

So the question is: Should we get a standard for Prefixes in AM to make it easier and better to make new features in Nxt, on top of Nxt or what ever?

There was a short discussion in the monster thread and I think it is worth discussing it now.

Example usage: http://107.170.117.237/index.php/topic,60.msg283.html#msg283

And should there be a technical change in the core code for this.

Let's discuss!
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #1 on: March 23, 2014, 04:26:12 pm »

From the perspective of AT it would be nice to have a 32 bit (or whatever sized) *type* prefix (to simplify Nxt AT API).

The types themselves should probably map to other internet standards (a bit like MIME types).
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #2 on: March 23, 2014, 04:54:57 pm »

From the perspective of AT it would be nice to have a 32 bit (or whatever sized) *type* prefix (to simplify Nxt AT API).

The types themselves should probably map to other internet standards (and bit like MIME types).


Well, AM does stand for *arbitrary* messaging, so do we really want to limit things?  Couldnt the AT logic create and look for its own header?  But 32bit does leave a lot of possibilities, what all types can we think of for now?  The problem is that adding them will require client upgrades.  We kind of want to get to the point where that doesnt happen frequently at all, right?
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Prefix in AM for better usage
« Reply #3 on: March 23, 2014, 05:06:29 pm »

Where is the problem if we would decide on 32bit now - plenty room in the future, right?
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #4 on: March 23, 2014, 05:08:42 pm »

Where is the problem if we would decide on 32bit now - plenty room in the future, right?

I think 2 billion possibilities is probably more than enough (but we could always use 64 bit if there is some real concern that it isn't).
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #5 on: March 23, 2014, 05:26:18 pm »

Where is the problem if we would decide on 32bit now - plenty room in the future, right?

I think 2 billion possibilities is probably more than enough (but we could always use 64 bit if there is some real concern that it isn't).


still though, what problem will adding subtypes solve, given that AM is meant to contain any arbitrary message.  Lets say we do this, how could it be enforced?
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #6 on: March 23, 2014, 05:36:53 pm »

still though, what problem will adding subtypes solve, given that AM is meant to contain any arbitrary message.  Lets say we do this, how could it be enforced?

To me this is really just a technical question of whether to use 32 bits or 64 bits - the answer is up to what you guys think is the most suitable (the code is easily changed to adjust).
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Prefix in AM for better usage
« Reply #7 on: March 25, 2014, 04:50:43 am »

I am using the following for AM header:

struct NXT_AMhdr
{
    int32_t sig __attribute__ ((packed));
    int32_t size __attribute__ ((packed));
    uint64_t nxt64bits __attribute__ ((packed));
};

sig is a unique signature for each application so it can specify what AM's it needs to be notified of.
size is the size of the entire AM, this is handy due to my gateway_AM struct below
the nxt64bits is the binary representation of the NXT acct that sent the AM, used as a double check to make sure there are no errors or tampering with the "sender" field of getTransaction

struct compressed_json { uint32_t complen,sublen,origlen; unsigned char encoded[]; };

The compressed_json is getting around 3:1 or even 4:1 compression over just using text so it is almost as good as binary, but a lot more flexible

struct gateway_AM
{
    struct NXT_AMhdr H;
    int32_t funcid,gatewayid,timestamp,tbd __attribute__ ((packed));
    struct compressed_json jsn;
};

The plan is for each NXT service to define its own AM structure. The above is what I am currently using for gateway_AM. The standard header + 16 bytes of binary and compressed json.

We just need a way to "register" the 32bit sig each app is using. If people just picked a random number, odds are there wont be a collision, but maybe it is a good idea for people to document what sigs they want to reserve

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Prefix in AM for better usage
« Reply #8 on: March 28, 2014, 09:09:17 am »

Additional, after chatting with CIYAM, I want to suggest to reserve some bits for a flag. This flag shows the blockchain shrinking process to NOT delete these AMs.

That way, we can store settings/profiles/data (what ever) via AM in the chain longer than a blockchain shrinking period.

To prevent bloating the blockchain, the flag must be set every time a blockchain shrinking occurred via a fee (the shrinking process could de-flag the flags). Don't know the technical aspects of this.

Please discuss!
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #9 on: March 28, 2014, 09:15:57 am »

I think it is a reasonable proposal as a sort of "less convenient but probably cheaper" alternative to a Service Provider keeping data storage.

This would only require a single bit but it might be worthwhile "reserving" a few extra bits in case we think of other "flags" we might need down the track.
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #10 on: March 28, 2014, 02:03:41 pm »

or maybe create a new transaction type that is a modified ver of existing AM that is perm?  We'd need to increase the fee for this kind of transaction though
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #11 on: March 28, 2014, 02:09:40 pm »

or maybe create a new transaction type that is a modified ver of existing AM that is perm?  We'd need to increase the fee for this kind of transaction though

I don't think we really want to do "permanent" AM at this stage (as it could be abused - look what SD did to the Bitcoin blockchain).
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

anon136

  • Hero Member
  • *****
  • Karma: +86/-19
  • Offline Offline
  • Posts: 1015
    • View Profile
Re: Prefix in AM for better usage
« Reply #12 on: March 28, 2014, 02:13:21 pm »

I think the short answer is yes. The question is how many characters and do we assign to this first field? how do we communicate sparation between fields? spaces? colons? or what?
Logged

anon136

  • Hero Member
  • *****
  • Karma: +86/-19
  • Offline Offline
  • Posts: 1015
    • View Profile
Re: Prefix in AM for better usage
« Reply #13 on: March 28, 2014, 02:16:19 pm »

or maybe create a new transaction type that is a modified ver of existing AM that is perm?  We'd need to increase the fee for this kind of transaction though

I don't think we really want to do "permanent" AM at this stage (as it could be abused - look what SD did to the Bitcoin blockchain).

i think permanent am's are good but only if properly priced. there is a big cost to them but if people are willing to pay that cost than they should be allowed to store information forever. maybe we should stop talking in terms of AM's though and talk about PM (permanent messages) and TM (temporary messages) and the former should be significantly more expensive than the latter.
Logged

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #14 on: March 28, 2014, 02:33:24 pm »

everyone keep in mind that spamming the blockchain via alias is notas cost effective for the spammer as using the alias transaction to spam. plus alias is (currently) permanent.
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

CIYAM

  • Hero Member
  • *****
  • Karma: +75/-3
  • Offline Offline
  • Posts: 575
  • Ian Knowles - CIYAM Lead Developer
    • View Profile
    • CIYAM
Re: Prefix in AM for better usage
« Reply #15 on: March 28, 2014, 02:37:55 pm »

everyone keep in mind that spamming the blockchain via alias is notas cost effective for the spammer as using the alias transaction to spam. plus alias is (currently) permanent.

Yes - another reason why I am really *against* the whole Alias thing.
Logged
With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #16 on: March 28, 2014, 02:49:48 pm »

Im
everyone keep in mind that spamming the blockchain via alias is notas cost effective for the spammer as using the alias transaction to spam. plus alias is (currently) permanent.

Yes - another reason why I am really *against* the whole Alias thing.


for this reason Im actually for increasing the fee for aliases fairly drastically.  Since the name is a limited resource (limited to 1), the fee should reflect this, regardless of its size in the blockchain.  I think the same way should continue to exist for assets; even though their names are now non-unique, there is a limited number of assets that can be created, so the fee should reflect this.

For other transactions I think we should pursue  fee/size cost we've been discussing
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Prefix in AM for better usage
« Reply #17 on: March 28, 2014, 02:54:31 pm »

AM Prefix with type and flag bits sound nice and flexible enough for the future. Why a separator if the bits are fixed? Well, discuss it. I'm no dev ;)

About that alias thing: make Alias non-permanent and tradeable.
« Last Edit: March 28, 2014, 02:56:12 pm by bitcoinpaul »
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

forkedchain

  • Ex-Staff Member
  • Hero Member
  • *****
  • Karma: +74/-10
  • Offline Offline
  • Posts: 1190
  • bite me
    • View Profile
Re: Prefix in AM for better usage
« Reply #18 on: March 28, 2014, 03:24:47 pm »

AM with type and flag is no longer "arbitrary"
Logged
NXT tips: 2319251 or NXT-8SWM-2224-YKWW-22222

bitcoinpaul

  • Hero Member
  • *****
  • Karma: +590/-590
  • Offline Offline
  • Posts: 3097
  • Karmageddon
    • View Profile
Re: Prefix in AM for better usage
« Reply #19 on: March 28, 2014, 03:26:00 pm »

I really don't care about the old name. Make a new one.
Logged
Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3
Pages: [1] 2 3  All
 

elective-stereophonic
elective-stereophonic
assembly
assembly