Levy fee deduction depends on quantity of mosaic transferred or not

Hello,

Levy fee deduction depends on the quantity of mosaic transferred or not?

As mosaic creator can set levy config at the time of mosaic creation and that fee will be taken from the sender of the transaction. But it depends on quantity? or not?
For e.g.,

  1. Fee is 1000 and quantity of mosaics transferred is 1 then total fee deduction = 1000
  2. Fee is 1000 and quantity of mosaics transferred is 2 then total fee deduction = ?

If the levy is relative (type = 2) then depends on the amount transfered.
If (type = 1) then it doesn’t depend on amount transfered.

No, I’m asking whether it depends on the number of mosaics transferred or not?

Means the levy fee is for one mosaic or levy fee*mosaics quantity or it’s not like that and it will deduct only one time for one transaction?

I guess I answered above.
type=1 - doesn’t depend on the amount of transferred mosaics. Because it’s an absolute fee.
type=2 - it does depend on amount of transferred mosaics. Because it’s a relative fee.

Yeah got it.

Could you please explain the calculation for levy type 2. In the documentation, it’s mentioned as ‘The fee is specified as multiple of the percentile of the quantity that is transferred.’

Can you please explain from the below example how much the total levy fee deducted from the sender’s account? and how?

Example,

Transaction: (BlockHeight 1294247)

{

“timeStamp”: 78369906,

“signature”: “0e15ddd2a4b6bd1e5db21b1a6ad1d6b2fb36aa49a7ff4cb78ff502bc2fae359f0c0db5e46920fa4a0e67417efcb7509e63f96af7e356c90863a809e63cc8310f”,

“fee”: 150000,

“type”: 4100,

“deadline”: 78456306,

“version”: 1744830465,

“signatures”: [

{

“timeStamp”: 78370245,

“otherHash”: {

“data”: “2eee6aa8f6ea5e83152a0cc5e97271095f4cc650f5d03f4a76e8a2301e24532f”

},

“otherAccount”: “NB3O425TAD7DK3R7OXMAMO55ELRFKIZBIO5QVZJS”,

“signature”: “d938a8d28d989c2890a1cb9756e13eaf391f43a29626aa4da1301190ab793ba374a40a648b81e5c98987d8e6a2a3cd2468e0d5cb7ca68433b7568ea5d3389c0b”,

“fee”: 150000,

“type”: 4098,

“deadline”: 78456645,

“version”: 1744830465,

“signer”: “b0d580f1b9b2095c696c1c8189e01c5729e8d21053556208e17ad80a3f5bed7e”

}

],

“signer”: “4c9182592db690c4b66c5f3d77604865f9216fc00e5fc545253c416e2f8326df”,

“otherTrans”: {

“timeStamp”: 78369906,

“amount”: 1000000,

“fee”: 150000,

“recipient”: “NCVGXTCV7YYGCUTOWRSEALEVHVTDFRJ54BQYDKTI”,

“mosaics”: [

{

“quantity”: 2,

“mosaicId”: {

“namespaceId”: “mizunashi”,

“name”: “minarin”

}

}

],

“type”: 257,

“deadline”: 78456306,

“message”: {

“payload”: “4578636c7564696e67207468652064697374757262696e67206d6f736169632e”,

“type”: 1

},

“version”: 1744830466,

“signer”: “680ff2aca38506b82f32bc5a7e7e7515353dbd79fbb39ce089c40514f883bc59”

}

}

Levy:

“levy”: {

“fee”: 100000000,

“recipient”: “NCVGXTCV7YYGCUTOWRSEALEVHVTDFRJ54BQYDKTI”,

“type”: 2,

“mosaicId”: {

“namespaceId”: “nem”,

“name”: “xem”

}

@CryptoBeliever Can you please help here?

Hmm. I will look at this today on how it’s calculated exactly.

Yes, Please have a look. I’m stuck here for a long and it’s causing a balance mismatch.
If you provide it, this will help us a lot.

Hi @CryptoBeliever, did you get anything?

I think it’s explained on mosaic creation view in wallet:

In this example, you have mosaic aaaa1:asdads.
Total supply: 100
Divisibility: 1
So there is 1000 part of the coin

Levy fee is: 100000000 μXEM which is 100 XEM

So for transfering one smallest part (0.1aaaa1:asdads) of aaaa1:asdads coin cost is 100000000 μXEM / 10000 = 10000μXEM = 0.01XEM

So for transfering:
1 aaaa1:asdads you will pay 0.1 XEM
10 aaaa1:asdads you will pay 1 XEM

====

In your example mizunashi:minarin has total supply 10000 with divisibility 0 so there is 10000 smallest parts of coin.

Levy is 100000000 μXEM = 100 XEM

So for transfering one (smallest) part of coin (1 mizunashi:minarin) you have to pay 100000000 μXEM / 10000 = 10000μXEM = 0.01XEM

So if you transfering 2 mizunashi:minarin you should pay in my opinion 0.02 XEM
If you transfering 100 mizunashi:minarin you should pay 1 XEM
1000 mizunashi:minarin → 10 XEM
10000 mizunashi:minarin → 100 XEM

Hey,

Thank you so much for the reply.

I’ve few doubts here.

How you’ve calculated Total Supply? Initial Supply * Divisibility = Total Supply? From API, we can get only the initial supply not the total supply so asking.

How you’re saying ‘So there is 1000 part of the coin’. How you’ve calculated this?

Hello,

For the below transaction, fee is 2000000 and mosaic mizunashi.minarin transferred quantity is 8. But the balance difference of the sender’s address between 905895 and 905894 blockheight is 2000000 which is without levy? only fee? then why levy is not considered here?

Transaction:

{
“timeStamp”: 54874204,
“signature”: “e5e35064d850e3cbf2af509414149d4ff740f937094f0591337ce6013b54925aaa26af31f64223f5e4206d7a775e5c15d2e2edff4b945d4ab97916c43432480b”,
“prevBlockHash”: {
“data”: “8f34e8cdc2d535a51fcfe23feb13c22b89bfd637f169a868f726840f2726dc56”
},
“type”: 1,
“transactions”: [
{
“timeStamp”: 54874179,
“amount”: 1000000,
“signature”: “341a942e541ccf6a1d0af307b5ddbd2e696e132cfcc96514fdfee48e2ab2ecf6fb82677f6fdc7b891b2778b2d591653d77bd8e58b16ee2befdf2e339cb4fe80d”,
“fee”: 2000000,
“recipient”: “NC5LMVQVN53336NHLAA4UVHGQBBJUYGF2YPZTXTB”,
“mosaics”: [
{
“quantity”: 8,
“mosaicId”: {
“namespaceId”: “mizunashi”,
“name”: “minarin”
}
}
],
“type”: 257,
“deadline”: 54960579,
“message”: {
“payload”: “e8bfbde58aa0”,
“type”: 1
},
“version”: 1744830466,
“signer”: “4d8cf75b12d41bdeb654bc42b5054b3e8df6cd722d9ed95d037d1190fe9cffca”
}
],
“version”: 1744830465,
“signer”: “e77a65fdf395a151cfccf7f51717a1974edbeeba3a2e4964e850f81bfed7cedf”,
“height”: 905895
}

http://localhost:7890/account/historical/get?address=NCVGXTCV7YYGCUTOWRSEALEVHVTDFRJ54BQYDKTI&startHeight=905894&endHeight=905895&increment=1
balances for 905894 and 905895 is 83878787058-83876787058=2000000

Other same example I got at 1980099 block for frog.dnt mosaic.

For the below transaction, balances are not matching with the calculation you explained above.
Please correct me if I’m wrong anywhere.

total levy deduction:
29088800 part of the coin
then 500000000/29088800 = 17.1887461841
17.1887461841*11100(quantity) = 190795.082644

150000+150000+500000+levy = 800000+levy = 800000+190795.082644 = 990795.082644 not matching.

Balance difference from API is b/w 1992336 and 1992337 block height is,
13536661956-12980861956= 555800000

I know something I’m doing wrong here, can you please explain.

Transaction: (1992337 block)

{
“timeStamp”: 120594798,
“signature”: “b65fff87c3dbc357b44f33712097b3947ba11ece92b8e2c4ed76488367fc8f678a983c6028a3e9237cd67d39559f483fc23b3e289306173e476a778f10f8a802”,
“fee”: 150000,
“type”: 4100,
“deadline”: 120681198,
“version”: 1744830465,
“signatures”: [
{
“timeStamp”: 120594829,
“otherHash”: {
“data”: “9afd6f3ca3e84de3523f2bdc4c055e8298793b65b3ebd9c1980cbac5f335da98”
},
“otherAccount”: “NCDUX33YVVDMYYYFVFN4S7FOJ6PMZZFW6ORHYRI6”,
“signature”: “c4fbfcba429c949dd9ee052d8128d96299066349e46e68d03cf42710912887fb61cdab89e42e3800ceae29633d0dedcfaf271045f1a4ab516600af8d677ff008”,
“fee”: 150000,
“type”: 4098,
“deadline”: 120681229,
“version”: 1744830465,
“signer”: “9df9949cd89e95a726bf9fc210716b47f2a4d58b30ba6f5655e1eaabe6d99a5c”
}
],
“signer”: “7d3d23639d8746613b37348695a8da8025ab427174a19d55ecd2335dc3f2c89f”,
“otherTrans”: {
“timeStamp”: 120594798,
“amount”: 1000000,
“fee”: 500000,
“recipient”: “NB7CJOPYUMTOV2XNWOWIDD5SBVPVMMM5HKW4M34S”,
“mosaics”: [
{
“quantity”: 11100,
“mosaicId”: {
“namespaceId”: “evias.charity”,
“name”: “jungle-animal”
}
}
],
“type”: 257,
“deadline”: 120681198,
“message”: {},
“version”: 1744830466,
“signer”: “2def9185258bb2ff9b892185c07d1251b08011055312e2433aa495ed35396c20”
}
}

Mosaic definition:

{
“meta”: {
“id”: 2165
},
“mosaic”: {
“creator”: “2def9185258bb2ff9b892185c07d1251b08011055312e2433aa495ed35396c20”,
“description”: “Jungle charity. During a road trip through Malaysia, each Jungle animal including: Monkeys, Cats, Tigers, Elephants, Squirrels and Giant Ants - which we encounter, will increment the counter! Funds to be allocated for charity purposes afterwards.”,
“id”: {
“namespaceId”: “evias.charity”,
“name”: “jungle-animal”
},
“properties”: [
{
“name”: “divisibility”,
“value”: “2”
},
{
“name”: “initialSupply”,
“value”: “290888”
},
{
“name”: “supplyMutable”,
“value”: “true”
},
{
“name”: “transferable”,
“value”: “true”
}
],
“levy”: {
“fee”: 500000000,
“recipient”: “NB7CJOPYUMTOV2XNWOWIDD5SBVPVMMM5HKW4M34S”,
“type”: 2,
“mosaicId”: {
“namespaceId”: “nem”,
“name”: “xem”
}
}
}
}

Hi @CryptoBeliever, any updates on this?

I think that total supply must be calculated from initial supply and all deltas from mosaic supply change transactions. Basicly you synchronizing block by block and calculating it in your database.

My mistake. Total supply don’t determinate how much relative fee will be taken.

If we have relative fee 500000000 then for each basic unit will be taken
500000000 / 1000000 / 10000 = 0.05 XEM for 0.01 jungle-animal (because divisibility 2), so 5XEM for 1 jungle-animal

So regarding the transfer above. There is
111 jungle-animal so leavy will be 111*5 = 555XEM

Regarding balance for sender (NCDUX33YVVDMYYYFVFN4S7FOJ6PMZZFW6ORHYRI6)

http://54.170.97.221:7890/account/historical/get?address=NCDUX33YVVDMYYYFVFN4S7FOJ6PMZZFW6ORHYRI6&startHeight=1992335&endHeight=1992339&increment=1

Block 1992336 13536661956 microXEM = 13536.661956 XEM
Block 1992337 12980861956 microXEM = 12980.861956 XEM

So the difference is 555.8 XEM (so 555 + 0.8 for transaction fees)

Hello,

As per the below lines, the levy fee is 500000000, but what is the 1000000 and 10000 here?

If we have relative fee 500000000 then for each basic unit will be taken
500000000 / 1000000 / 10000 = 0.05 XEM for 0.01 jungle-animal (because divisibility 2), so 5XEM for 1 jungle-animal

and how you are saying this calculation is for 0.01XEM?