elective-stereophonic
elective-stereophonic
Why CETx is much needed in the core ? singapore
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  All

Author Topic: Why CETx is much needed in the core ?  (Read 4548 times)

SwissAlps

  • Hero Member
  • *****
  • Karma: +31/-16
  • Offline Offline
  • Posts: 519
    • View Profile
    • NxtTracker.com
Why CETx is much needed in the core ?
« on: October 16, 2014, 07:37:40 am »

Why CETx ?

Because here is what you can do with CETx :
  • single transaction for dividends payment
  • single transaction for interest payment
  • trustless buy/sell an asset directly, without the AE
  • transfer asset
  • send NXT
  • create complex transaction templates
  • basic simple pseudo anonymizer
  • basic simple voting system
  • trustless forex emulation (example convert NXTEUR into NXTCHF without using NXT, except for the fees)
  • and probably much more...

For each of these, I will give a simple working example.

During most of my career, I have been working for swiss banks and there, we have used CETx a lot; the version we used was quite simple, most of the time single currency; I have adapted it here to take in account the asynchronous use of the blockchain.

CETx  stands for Compound Entries Transaction; to use them, we need two different transaction types :
  • a CETx header
  • a CETx line
A CETx is always made of one header, followed by 2-n CETx lines.

The CETx header

The header is the template of the future transaction; to be accepted by the system, it has to be wellformed. It shows all the individual transaction lines that the transaction will have, the accounts, the amounts, and the currencies used (NXT, assets, or subcurrencies). Here is a list of the header fields :
 
  • optional tx description
  • deadline blocknr
  • a table with 2-n elements :
  • element 1
    • account 1
    • sign + or -
    • amount 1
    • currency 1, subcurrency 1 from MS, or AssetId 1
    • optional message 1, can be encrypted using account 1
  • element 2
    • account 2
    • sign + or -
    • amount 2
    • currency 2, subcurrency 2 from MS, or AssetId 2
    • optional message 2, can be encrypted using account 2
  • element...
    • ...
    • ...
    • ...
    • ...

The rules to build a wellformed header are very simple :
  • the deadline must not be too far away in the future
  • currencies or assets must exist
  • the total of '+' amounts in a given currency or asset must be equal to the total of the '-' amounts in the same currency

Once you have a wellformed header, you can post it (it costs you 1 NXT); after this, every acccount that has a '-' amount in one of the elements of the header has to make a CETx line matching exactly. In standard accounting, we would used debit and credits, but these are a little bit complicated for non pros, most of the time they don't understand why suddenly the balance of an account can increase when we debit it ! 


The CETx line

The individual lines are created after the header has been posted, and are totally asynchronous; the order doesn't matter, line 6 can be before line 2. A CETx is valid only if all the lines have been posted and valid before the deadline given in the header; this enable very easy "trustless" transactions because if a participant doesn't honour his obligation, the transaction is invalid and the amounts stay where they were originally.

Here is a list of the CETx line fields :
  • header id
  • line nr in the header table
  • account id
  • amount
  • currency, subcurrency or asset id
  • optional text, encrypted or not

Here also, the validation is quite easy; it is the same as the standard asset transfer, or standard NXT sending, but without the recipient part (the header can be considered as the receiver of all these '-' amounts).

Once the last needed CETx line has been posted in time, and validated, the CETx itself is said to be valid. We do not need further action in the blockchain, all the accounts that have a '+' in the header can now be credited with their respective amounts and currencies (or assets), an easy task.


.....to be continued....following days I will show details about the individual examples...

Logged
CryptoNanoPay project
Note that the "Barter Point" test has just started...

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Why CETx is much needed in the core ?
« Reply #1 on: October 17, 2014, 09:05:50 am »

Maybe this could be implemented as a special case of phasing?
Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322

SwissAlps

  • Hero Member
  • *****
  • Karma: +31/-16
  • Offline Offline
  • Posts: 519
    • View Profile
    • NxtTracker.com
Re: Why CETx is much needed in the core ?
« Reply #2 on: October 19, 2014, 06:30:33 am »

Maybe this could be implemented as a special case of phasing?
Hello Jean-Luc,

Sorry but I don't kwnow much about phasing, so I could not say; I'm sure the nxt devs have answers and ideas. But as you can easily see by looking at the few given examples, it is overlapping small parts of many different projects, like 'Voting', 'Smart Contract', 'Phasing?', and probably others. And it makes life easier for clients : example if you want to analyze the dividends paid by an asset, you just have to look and analyze a single CETx.

If this tool is available in the core, the clients via API calls take the burden of doing most of the work to polish and make use of the thing user friendly; I would say it should be considered as a building stone, very low level, a little like the current Tx.  If the Tx is the "building stone", the CETx is a "carved building stone", you use them for doors, windows and special places of your house, a little bit everywhere.

In the real life accounting, you can always convert a CETx into a serie of single Txs, it is just a more powerful acounting tool. Using the blockchain, this is not true anymore, everything there is asynchronous; this means that if you can avoid using CETx in the real life, you really could and should not in the Nxt world.
Logged
CryptoNanoPay project
Note that the "Barter Point" test has just started...

SwissAlps

  • Hero Member
  • *****
  • Karma: +31/-16
  • Offline Offline
  • Posts: 519
    • View Profile
    • NxtTracker.com
Re: Why CETx is much needed in the core ?
« Reply #3 on: October 19, 2014, 08:04:59 am »

CETx Example 1 : Single transaction for dividends payment

Note : The syntax used here  is only for clarity, will not be the final API syntax.

Company ABC wants to pay 1200 NXT to 10 shareholders SH1, SH2, ..., SH10; ABC also wants to give 50 ABCasset to both SH3 and SH7; you do all this in a single CETx, total cost 3NXT.

The  data CETx header looks like this; in bold, I show the needed data.
  • optional tx description   October 2014 dividends
  • deadline blocknr   234000
  • a table with 14 elements :
  • element 1
    • account of ABC    NXT-AAAA-ABC8-ABC9-ABC10
    • sign    -
    • amount   1200
    • currency  NXT
  • element 2
    • account of ABC    NXT-AAAA-ABC8-ABC9-ABC10
    • sign    -
    • amount   100
    • assetId  ABCasset
  • element 3
    • account  of shareholder 3  NXT-SH03-XYZ8-XYZ9-33333
    • sign   +
    • amount   50
    • assetId   ABCasset
    • message  special asset given to you
  • element 4
    • account  of shareholder 7  NXT-SH07-XYZ8-XYZ9-77777
    • sign   +
    • amount   50
    • assetId   ABCasset
    • message special asset given to you
  • element 5
    • account  of shareholder 1  NXT-SH01-XYZ8-XYZ9-11111
    • sign   +
    • amount   100
    • currency   NXT
  • element 6
    • account  of shareholder 2  NXT-SH02-XYZ8-XYZ9-22222
    • sign   +
    • amount   100
    • currency   NXT
  • element 7
    • account  of shareholder 3  NXT-SH03-XYZ8-XYZ9-33333
    • sign   +
    • amount   100
    • currency   NXT
  • element 8
    • account  of shareholder 4  NXT-SH04-XYZ8-XYZ9-44444
    • sign   +
    • amount   200
    • currency   NXT
  • element 9
    • account  of shareholder 5  NXT-SH05-XYZ8-XYZ9-55555
    • sign   +
    • amount   140
    • currency   NXT
  • element 10
    • account  of shareholder 6  NXT-SH06-XYZ8-XYZ9-66666
    • sign   +
    • amount   100
    • currency   NXT
  • element 11
    • account  of shareholder 7  NXT-SH07-XYZ8-XYZ9-77777
    • sign   +
    • amount   130
    • currency   NXT
  • element 12
    • account  of shareholder 8  NXT-SH08-XYZ8-XYZ9-88888
    • sign   +
    • amount   120
    • currency   NXT
  • element 13
    • account  of shareholder 9  NXT-SH09-XYZ8-XYZ9-99999
    • sign   +
    • amount   100
    • currency   NXT
  • element 14
    • account  of shareholder 10  NXT-SH10-XYZ8-XYZ9-00000
    • sign   +
    • amount   110
    • currency   NXT

The CETx header is well formed, you can check that the total of e2+e3+e4 = 0 (for assetId ABCasset) and the total of e1+e5-e14=0 (for NXT).

To be valid, all accounts with a '-' in the header need now to post a CETx line, in our case, two lines need to be posted.

The  data in the CETx lines looks like this :

  • header id  364625253
  • line nr in the header table  1
  • account of ABC    NXT-AAAA-ABC8-ABC9-ABC10
  • amount   1200
  • currency   NXT

  • header id  364625253
  • line nr in the header table  2
  • account of ABC    NXT-AAAA-ABC8-ABC9-ABC10
  • amount   100
  • assetId   ABCasset

The CETx is valid if all the posted CETx lines with a '-' are present and match EXACTLY the corresponding header lines (this is a kind of contract).

Done !

The fees :  1NXT to post the header, and 1NXT per CETx line : total 3NXT.

Note that the fees will probably in the future depend upon the transaction size in bytes, but still, it will be much less expensive this way as doint the same job using independent Txs.

.....following days, I will show the next sample.....
Logged
CryptoNanoPay project
Note that the "Barter Point" test has just started...

ChuckOne

  • Hero Member
  • *****
  • Karma: +293/-17
  • Offline Offline
  • Posts: 3450
  • ☕ NXT-4BTE-8Y4K-CDS2-6TB82
    • View Profile
Re: Why CETx is much needed in the core ?
« Reply #4 on: October 22, 2014, 07:38:04 pm »

It is basically group of transactions that needs to be verified at once, right?
Logged

SwissAlps

  • Hero Member
  • *****
  • Karma: +31/-16
  • Offline Offline
  • Posts: 519
    • View Profile
    • NxtTracker.com
Re: Why CETx is much needed in the core ?
« Reply #5 on: October 23, 2014, 07:12:11 am »

    It is basically group of transactions that needs to be verified at once, right?

    Hello ChuckOne,

    Nearly what you said, but with a few differences; to grasp it easier, you can compare the CETx with a bucket that fills slowly with every single CETx line posted.

    .the header elements represent only half your normal Nxt Tx, either a sending part (with a '-' sign), or a receiving part (with a '+' sign), and very important, these parts don't have to match
     
    .only the '-' parts need to be visible in the blockchain, represented by a CETx line 

    .only when the last CETx line comes in is the bucket full. At this time, the entire bucket IS VALID and it's content can be splitted to all the receiving parts (those that have a '+' sign in the header), without further action needed on the blockchain
    [/list]
    Logged
    CryptoNanoPay project
    Note that the "Barter Point" test has just started...

    SwissAlps

    • Hero Member
    • *****
    • Karma: +31/-16
    • Offline Offline
    • Posts: 519
      • View Profile
      • NxtTracker.com
    Re: Why CETx is much needed in the core ?
    « Reply #6 on: October 23, 2014, 08:53:04 am »

    It is basically group of transactions that needs to be verified at once, right?

    If you remember the last CfB riddle (holy graal), if you have CETx implemented in the core, conversion of BTC to NXT becomes totally "trustless" and nearly trivial, here is how it would go :
     
    CETx Example 2 : Direct trade BTC-NXT trustless

    Note : The syntax used here  is only for clarity, will not be the final API syntax.

    Joe (BTC seller, NXT buyer) wants to sell 1.5 BTC to Mary (BTC buyer, NXT seller) against 10'000 NXT.

    For this specific CETx, the order is important; first Mary sends the 10000 NXT, but at this stage, the NXT are just locked; then Joe sends the BTC to the given BTC address; then the NxtServiceProvider, who has a bot analyzin the BtcBlockChain, says that Joe has done it's part of the deal; it sends a 1 NXT to itself. This validates the whole CETx.

    Also, we need an independent and trustful NxtServiceProvider that can run a bot on the BTCblockchain to assert that Joe has correctly send the BTC.

    Note that we can easily have more than one NxtServiceProvider, if security is an issue.

    The  data CETx header looks like this; in bold, I show the needed data.
    • optional tx description   Trustless BTC-NXT trade
    • deadline blocknr   237000
    • a table with 4 elements :
    • element 1
      • account of Mary NXT-AAAA-ABC8-ABC9-MARY0
      • sign    -
      • amount   10000
      • currency  NXT
      • unencrypted messagemy BTC address is : .....
    • element 2
      • account of Joe NXT-AAAA-ABC8-ABC9-JOE00
      • sign    +
      • amount   10000
      • assetId  NXT
      • unencrypted messagemy BTC address is : .....
    • element 3
      • account  of NxtServiceProvider NXT-SH03-XYZ8-XYZ9-PROVD
      • sign   -
      • amount   1
      • assetId   NXT
      • unencrypted message  I have checked on the BTC blockchain that the 1.5 BTC transfer beetween Joe and Mary has been done
    • element 4
      • account  of NxtServiceProvider NXT-SH03-XYZ8-XYZ9-PROVD
      • sign   +
      • amount   1
      • assetId   NXT

    The CETx header is well formed, you can check that the total of e1+e2+e3+e4 = 0

    To be valid, all accounts with a '-' in the header need now to post a CETx line, in our case, two lines need to be posted.

    The  data in the CETx lines looks like this :

    • header id  364625253
    • element nr in the header table  1
    • account of Mary   NXT-AAAA-ABC8-ABC9-MARY0
    • amount   10000
    • currency   NXT

    • header id  364625253
    • element nr in the header table  3
    • account of NxtServiceProvider NXT-SH03-XYZ8-XYZ9-PROVD
    • amount   1
    • assetId   NXT
    • unencrypted message  I have checked on the BTC blockchain that the 1.5 BTC transfer beetween Joe and Mary has been done

    The CETx is valid if all the posted CETx lines with a '-' are present and match EXACTLY the corresponding header lines (this is a kind of contract).

    Done !
    Logged
    CryptoNanoPay project
    Note that the "Barter Point" test has just started...

    kushti

    • Sr. Member
    • ****
    • Karma: +184/-5
    • Offline Offline
    • Posts: 384
    • Nxt Core & Apps Dev
      • View Profile
    Re: Why CETx is much needed in the core ?
    « Reply #7 on: October 23, 2014, 09:12:36 am »

    In the first place, thanks for the proposal!

    I will definitely read & give feedback on CETx though some time needed to do it in a quality manner.

    Meanwhile, you can read 2-Phased Transactions specification(implementation is already done accordingly by me) https://nxtforum.org/general/2-phased-transactions-pre-implementation-specification/
    Logged
    for donations / messages: NXT-PKXM-WH25-UXXG-CJAVD (alias: kushti)

    SwissAlps

    • Hero Member
    • *****
    • Karma: +31/-16
    • Offline Offline
    • Posts: 519
      • View Profile
      • NxtTracker.com
    Re: Why CETx is much needed in the core ?
    « Reply #8 on: October 24, 2014, 07:04:41 am »

    In the first place, thanks for the proposal!

    I will definitely read & give feedback on CETx though some time needed to do it in a quality manner.

    Meanwhile, you can read 2-Phased Transactions specification(implementation is already done accordingly by me) https://nxtforum.org/general/2-phased-transactions-pre-implementation-specification/
    Hi Kushti,

    YES ! You are very near CETx; your proposal is much more sophisticated, and doing a lot of things that CETx cannot and will not do. I believe the CETx should rather be considered just as a simple building stone; it is very easy to be implemented (I so believe, should be confirmed by the devs), because the concept is very basic, and it does not aim high objectives. You can probably use it as a basic tool for your twophased project, but a lot of other projects could also make use of it.

    For the basic CETx, no need to have special accounts, account controls, etc...  Of course, AccountControl is something we need also, I would rate this need as quite urgent (being able to close an account is a MUST, else you cannot do even simple accounting).

    I will very much appreciate your feedback, of course; feel free to PM if you prefer; please note that I'm implementing nothing with the CETx, so you have zero risk to step on my feets; my unique objective with the current proposal is FOR A BETTER Nxt World, I want my NXT to increase in value, what is momentarily not the case (hélas, trois fois hélas).

    Because this is so simple AND powerful, we should not do without CETx.
     
     
    Logged
    CryptoNanoPay project
    Note that the "Barter Point" test has just started...

    SwissAlps

    • Hero Member
    • *****
    • Karma: +31/-16
    • Offline Offline
    • Posts: 519
      • View Profile
      • NxtTracker.com
    Re: Why CETx is much needed in the core ?
    « Reply #9 on: October 25, 2014, 05:21:02 am »

      CETx Example 3 : Simple Trustless Anonymizer

      Note : The syntax used here  is only for clarity, will not be the final API syntax.


      The master word here is "Trustless", because you can do the same today using the currently available Txs; as I explained at the beginning of this thread, a CETx can always be converted to single Txs, you would just need in our example a trusted counterparty.

      Using CETx, the task is easy and trustless.

      Like in the Example 2, we need here a simple NxtServiceProvider that will create and post the CETx header. Let us say that the NxtServiceProvider account is
      NXT-AAAA-ABC8-SRVC-PRVD0[/li][/list]. Joe (wants to anonymize some NXT) sends an encrypted message to this account, with a small fee, for example 10 NXT, and with following data :

      .Joe's sending account NXT-AAAA-ABC8-ABC9-JOE00
      .Joe's receiving account NXT-BBBB-ABC8-ABC9-JOE00

      This is a secret known only by Joe and the NxtServiceProvider; if you need more anonymity, you will just use more than one NxtServiceProvider. Now, let us say that the NxtServiceProvider receives the same request from 9 other Nxters. He is now able to post the CETx header

      The  data CETx header looks like this; in bold, I show the needed data.
      • optional tx description   One Tenth Anonymyzer
      • deadline blocknr   237000
      • a table with 20 elements :
      • element 1
        • sending account of Joe NXT-AAAA-ABC8-SEND-JOE00
        • sign    -
        • amount   10000
        • currency  NXT
      • element 2
        • sending account of Nxter2 NXT-AAAA-SEND-2222-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • elements 3
        • sending account of Nxter 3 NXT-AAAA-SEND-3333-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 4
        • sending account of Nxter 4 NXT-AAAA-SEND-4444-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 5
        • sending account of Nxter 5 NXT-AAAA-SEND-5555-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 6
        • sending account of Nxter 6 NXT-AAAA-SEND-6666-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 7
        • sending account of Nxter 7 NXT-AAAA-SEND-7777-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 8
        • sending account of Nxter 8 NXT-AAAA-SEND-8888-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 9
        • sending account of Nxter 9 NXT-AAAA-SEND-9999-NXTER
        • sign    -
        • amount   10000
        • currency  NXT
      • element 10
        • sending account of Nxter 10 NXT-AAAA-SEND-0000-NXTER
        • sign    -
        • amount   10000
        • currency  NXT

      .....AND NOW, THE ANONYMYZER PART OF THE DEAL...the NxtServiceProvider calls a randomizer....
      .....Nobody knows who is the receiving part of the deal

      • element 11 
        • receiving account of Nxter NXT-AAAA-SEND-3333-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 12 
        • receiving account of Nxter NXT-AAAA-SEND-5555-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 13 
        • receiving account of Nxter NXT-AAAA-ABC8-SEND-JOE00
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 14 
        • receiving account of Nxter NXT-AAAA-SEND-8888-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 15 
        • receiving account of Nxter NXT-AAAA-SEND-2222-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 16 
        • receiving account of Nxter NXT-AAAA-SEND-4444-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 17 
        • receiving account of Nxter NXT-AAAA-SEND-6666-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 18 
        • receiving account of Nxter NXT-AAAA-SEND-0000-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 19 
        • receiving account of Nxter NXT-AAAA-SEND-7777-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT
      • element 20 
        • receiving account of Nxter NXT-AAAA-SEND-9999-NXTER
        • sign    +
        • amount   10000
        • assetId  NXT

      The CETx header is well formed, you can check that the total of e1+e2+e3+e4+e5+e6+e7+e8+e9+e10 = 0

      The CETx will be valid as soon as all the 10 Nxters have posted their 10'000 NXT. Here an example of the data in the CETx line of  Joe :

      • header id  364625253
      • element nr in the header table  1
      • sending account of Joe NXT-AAAA-ABC8-SEND-JOE00
      • amount   10000
      • currency   NXT

      The CETx is valid if all the posted CETx lines with a '-' are present and match EXACTLY the corresponding header lines (this is a kind of contract).

      Done !

      You have no way to link Joe's sending account to Joe's receiving account; you have 0.1 probability that this is the case, that's why I call it a OneTenthAnonymyzer.
      If you call it twice, you will have 0.01,  etc... 
      So, after a few calls and a few different NxtServiceProviders, near total anonymity.
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #10 on: October 25, 2014, 05:55:23 am »

      CETx Example 4 : Direct Asset Exchange Trustless, without going through the AE

      Note : The syntax used here  is only for clarity, will not be the final API syntax.


      The master word here is "Trustless", because you can do the same today using the currently available Txs; as I explained at the beginning of this thread, a CETx can always be converted to single Txs, you would just need in our example a trusted counterparty.

      Using CETx, the task is easy and trustless.

      Joe wants to sell 500 jl777hodl directly to Mary, against 60 NXTEUR (my favorite asset), because he needs some cash.

      The  data CETx header looks like this; in bold, I show the needed data.
      • deadline blocknr   241000
      • a table with 4 elements :
      • element 1
        • Joe's account NXT-AAAA-ABC8-SEND-JOE01
        • sign    -
        • amount   500
        • assetid  jl777hodl
      • element 2
        • Mary's account NXT-AAAA-SEND-2222-MARY1
        • sign    +
        • amount   500
        • assetid  jl777hodl
      • elements 3
        • Mary's account NXT-AAAA-SEND-2222-MARY1
        • sign    -
        • amount   60
        • assetid  NXTEUR
      • element 4
        • Joe's account NXT-AAAA-ABC8-SEND-JOE01
        • sign    +
        • amount   60
        • assetid  NXTEUR

      The CETx header is well formed, you can check that the total of e1+e2 = 0 and e3+e4=0

      The CETx will be valid as soon as all the Joe has sent the 500 jl777hdl and Mary the 60 NXTEUR.

      Here is the data of both CETx lines :

      • header id  364625253
      • element nr in the header table  1
      • sending account of Joe NXT-AAAA-ABC8-SEND-JOE01
      • amount   500
      • assetId  jl777hodl

      • header id  364625253
      • element nr in the header table  3
      • sending account of Mary NXT-AAAA-SEND-2222-MARY1
      • amount   60
      • assetId  NXTEUR

      The CETx is valid if all the posted CETx lines with a '-' are present and match EXACTLY the corresponding header lines (this is a kind of contract).

      Done !

      As you see, a single transaction, totally trustless. Is it not nice  :) :D ?
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #11 on: October 28, 2014, 06:29:40 am »

      CETx Example 5 : Voting

      Note : The syntax used here  is only for clarity, will not be the final API syntax.


      You can use CETx to build a voting transaction, without having to add anything to the basic CETx features.

      Some limitations :
      .You need to know in advance all the accounts that are allowed to vote
      .The goodies, you can give some members more voting rights, depending upon whatever criter you choose

      Company ABC has 5 shareholders and wants a vote about future implementation. Note that this transaction will never be valid, because the 1st element will never be fullfilled. Only accounts that agree with the proposition do vote. After the deadline, an easy analysis of the transaction shows who have voted. It doesn't matter that CETx is invalid, the transfers are not for real but just to show the vote. Total voices 12.

      The  data CETx header looks like this; in bold, I show the needed data.
      • tx description   Note to shareholders : The proposition is accepted if at least 8 voices ok
      • deadline blocknr   241000
      • a table with 6 elements :
      • element 1
        • Company ABC's account NXT-AAAA-ABC8-SEND-ABC01
        • sign    -
        • amount   100000
        • currency  NXT
      • element 2
        • Company ABC's account NXT-AAAA-ABC8-SEND-ABC01
        • sign    +
        • amount   100012
        • currency  NXT
      • element 3
        • Shareholder 1 has 4 voices NXT-AAAA-SEND-1111-SH100
        • sign    -
        • amount   4
        • currency  NXT
      • element 4
        • Shareholder 2 has 3 voices NXT-AAAA-SEND-2222-SH200
        • sign    -
        • amount   3
        • currency  NXT
      • element 5
        • Shareholder 3 has 2 voices NXT-AAAA-SEND-3333-SH300
        • sign    -
        • amount   2
        • currency  NXT
      • element 6
        • Shareholder 4 has 2 voice NXT-AAAA-SEND-4444-SH400
        • sign    -
        • amount   2
        • currency  NXT
      • element 7
        • Shareholder 5 has 1 voice NXT-AAAA-SEND-5555-SH500
        • sign    -
        • amount   1
        • currency  NXT

      The CETx header is well formed, you can check that the total of e1+e2+e3+e4+e5+e6+e7 = 0

      The CETx will never be valid, because of element 1.

      Here is the data of shareholder 3 CETx line :

      • header id  364625253
      • element nr in the header table  5
      • sending account of shareholder 3 NXT-AAAA-SEND-3333-SH300
      • amount   2
      • currency  NXT


      Wait until the deadline. Then count the posted CETx lines.

      Done !
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #12 on: October 29, 2014, 06:51:52 am »

      CETx Example 6 : Asset transfer

      You can use CETx to transfer an asset, just like the regular asset transfer actually in use.

      I really don't know why you would do it, it would cost you 2 NXT, one for the CETx header and one for the CETx line.

      My interest would be aroused if somebody finds a good reason to use this : the difference with actual transfer beeing that the header is posted, then we have a certain time interval, then we have the transaction validated ?  Some ideas for use ?

      I spare you the data, it is trivial.



      CETx Example 7 : Send NXT

      Same as Example 6, you can do it, but why would you do it ?
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #13 on: October 31, 2014, 06:29:33 am »

      CETx Example 8 : Trustless FOREX emulation

      One of the biggest game around in the current economy is called FOREX, foreign exchange, and banks and all economics actors, your VISA, Amazon, etc..., can do a lot of profit of it.

      For this example to work, you need to have NXT trackers, that are pegged to the real underlying currencies. I was interested by these and have created NXTEUR, NXTCHF and NXTUSD. It is very important to note that they are NOT cryptocurrencies, they are only an accounting way of representing the value in the real underlying fiat currency (and not the underlying NXT, like the future Nxt Monetary System project).

      How can you have a valueless tracker represent a real fiat value? Very easy, you only need a powerfull and trusted market maker; this actor needs to put a big buying and selling wall for the tracker, buying low and selling high. More or less, the spread between these walls is the profit of the market maker. In the real world, this spread is very very small, and you have to use sophisticated high frequency trading to make profit with forex.

      How can we implement this? What are the instant benefits for the Nxt world?

      The thing is so important that I start a thread that will treat these aspects only; for the moment, I show you in this example how to convert trustless your NXTEUR into NXTUSD.

      https://nxtforum.org/index.php?topic=6303.0

      VERY EASY, go to example 4, and replace jl777hodl by NXTUSD (of course, you change also the amounts!).

      Done !

      As you see, a single transaction, totally trustless. Is it not nice  :) :D ?
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      bitcoinpaul

      • Hero Member
      • *****
      • Karma: +590/-590
      • Offline Offline
      • Posts: 3097
      • Karmageddon
        • View Profile
      Re: Why CETx is much needed in the core ?
      « Reply #14 on: October 31, 2014, 08:39:20 am »

      ChuckOne, JL, r u looking into this?
      Logged
      Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

      bitcoinpaul

      • Hero Member
      • *****
      • Karma: +590/-590
      • Offline Offline
      • Posts: 3097
      • Karmageddon
        • View Profile
      Re: Why CETx is much needed in the core ?
      « Reply #15 on: November 02, 2014, 08:27:55 pm »

      Doesn't look like...
      Logged
      Like my Avatar? Reply now! NXT-M5JR-2L5Z-CFBP-8X7P3

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #16 on: November 03, 2014, 05:53:47 am »

      ChuckOne, JL, r u looking into this?

      Doesn't look like...

      Must give them time, they have a lot of very important things to do; besides, we are not in such hurry, CETx will not magically disappear!  ;D
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      TwinWinNerD

      • Hero Member
      • *****
      • Karma: +222/-116
      • Offline Offline
      • Posts: 2012
      • CEO BitPanda.com
        • View Profile
      Re: Why CETx is much needed in the core ?
      « Reply #17 on: November 03, 2014, 11:24:45 am »

      Swissalps, do you have knowledge of the core and know if this is possible to implement without much changes?

      SwissAlps

      • Hero Member
      • *****
      • Karma: +31/-16
      • Offline Offline
      • Posts: 519
        • View Profile
        • NxtTracker.com
      Re: Why CETx is much needed in the core ?
      « Reply #18 on: November 04, 2014, 07:33:12 am »

      Swissalps, do you have knowledge of the core and know if this is possible to implement without much changes?
      Hi TwinWinNerD,

      No, sorry, I don't have knowledge of the core and even if the basic rules of CETx are very simple, they may translate in a lot of work to be implemented. But we are not in a hurry, we are speaking here about basic building stones.

      I try to think long term, in a year, in two years, what is usefull, how can clients use Nxt as a tool. So simple rules and so potent result, for example the possibility to to build easily entirely trustless transactions.
      Logged
      CryptoNanoPay project
      Note that the "Barter Point" test has just started...

      TwinWinNerD

      • Hero Member
      • *****
      • Karma: +222/-116
      • Offline Offline
      • Posts: 2012
      • CEO BitPanda.com
        • View Profile
      Re: Why CETx is much needed in the core ?
      « Reply #19 on: November 04, 2014, 04:12:15 pm »

      It is not the "Lot of work" to implement things. The devs always stress that things that change core-codebase in a substantial matter must yield a very big advantage otherwise they will get rejected.
      Pages: [1] 2  All
       

      elective-stereophonic
      elective-stereophonic
      assembly
      assembly