1

I run 2 private nodes follow this tutorial of Substrate. When I send funds from one account to another or execute a contract function. Transactions include a fee. However, I don't know who will receive these fees and how to withdraw these rewards.

Linh Tran
  • 21
  • 1

2 Answers2

1

First of all, just after completing that tuto you end up dispatching some extrinsics. As contracts in substrate have a very concrete meaning and is not the same as what a pallet nor a runtime are.

You can learn more on extrinsics on its Knowledge Base section.

An overview here on smart contracts vs runtime

To understand how fees work in substrate here you have a pair of resources that will clarify all your doubts.

Hope that gain you a better understanding :)

1

You can configure where the proceeds will go. You can give it to the block author, treasury, burner or to any address you want. To do that you need to do the following steps:

If you want the author of the block to receive it. You need:

STEP 1: install pallet_authorship

STEP 2: get the current author of the block

The next steps is where you configure the transaction fees will be handled.

STEP 3: implement the OnUnbalanced for DealWithFees (most important)

Then cofigure the pallet_transaction_payment

STEP 4: Modify the tuple entry in the OnChargeTransaction type to include the DealWithFees implementation

Thats it, for complete the code please refer to my blog: https://hgminerva.wordpress.com/2022/06/21/how-to-pay-the-block-author-validator-on-a-proof-of-authority-poa-consensus-in-substrate/

hgminerva
  • 184
  • 5