NEO N3 Blockchain - Structuring fees for multi-contract transactions

Viewed 19

I'm learning NEO blockchain programming with Python and I've started working on a modular project where different parts are executed by different smart contracts hard-linked back together.

I want to have a functionality such as: send 1 NEO to contract A -> contract A mints 1 XXX Token and sends it to cotnract B -> contract B does some operations or locks the funds for a bit then allows the user to reclaim it

It's purely theoretical simplified example to illustrate my question. How in such case transaction fees would be paid? If I want a contract to call to another contract, will the contract have to pay the fees for this transaction?

1 Answers

N3 fees are paid by the transaction sender (signer #0), specifically network (verification/size) and system (execution) fees. No matter what amount of code is executed and how deep it goes with contract calls it's all counted equally and paid for with a single system fee. Usually you estimate it with a test invocation via invokefunction or invokescript RPC APIs (gasconsumed in returned data).

Contract can pay the system fee if it's a transaction sender (in which case it must have an appropriate verify method), but that'd be the same model --- one sender account paying for the whole execution.

Related