How to use the token itself as a miner fee-EIP965 and slp postage agreement

5 93
Avatar for arslankhalid
3 years ago

Sending tokens requires the main network currency as a miner's fee, which is against human habits. The slp token on Bitcoin Cash needs BCH as a miner fee, the omni token on Bitcoin needs btc as a miner fee, and Erc20 token on Ethereum needs ETH as a miner fee.

Why does the public chain need miner fees

Sending a transaction on the chain, whether it is the mainnet currency or the on-chain token, requires payment of the mainnet miner fee. This is mainly to prevent DDoS. Imagine if there is no need for miner fees, one person generates two addresses, writes a script to transfer money to each other infinitely, and generates hundreds of millions of hundreds of millions of transaction data every day and sends them to the chain. The entire blockchain must not explode.

Can the token on the sending chain not use the main chain token as a miner fee by default? Why is no public chain designed to send tokens and use the tokens themselves as miners' fees?

Tokens can be generated at will. If a person sends a token, it has no value, and then use this token to send transactions on the chain indefinitely. Doesn't this also kill the chain?

Is there a way to make issuing tokens do not require the main chain currency as a miner's fee, and still be free from DDoS?

Ethereum's solution

Ethereum is the largest token economy platform. At present, the mainstream tokens in the currency circle are all running on Ethereum. Ethereum also most urgently needs a solution for issuing tokens without ETH.

In fact, in theory, Ethereum is very easy to solve this miner fee problem. Because Ethereum is a smart contract platform, you only need to write a contract that pays ETH miner fees for token transactions to solve the problem.

Ethereum has a proposal EIP965 ( ) that pays ETH miner fees for tokens , and another proposal that has not been assigned an EIP code: ERC865 ( https://github .com/ethereum/EIPs/issues/865 )

The basic idea of ​​Ethereum to solve this problem is this:

Design a smart contract.

Deposit some ETH in the contract.

The contract designs a whitelisted ERC20 token list.

For ERC20 tokens in the whitelist, the contract is called when the user sends a token transaction. (This requires a good wallet design)

The user's transaction needs to pay a sum of tokens sent to the contract as a miner's fee.

The contract will pay the user an ETH miner fee when sending the transaction, so that the transaction can be packaged by the miner.

In essence, Ethereum's free miner fee is to design a contract store that allows users to exchange tokens for ETH.

But this solution of Ethereum has not been popular. On the contrary, Ethereum has generally adopted a centralized solution.

Centralized solution

The exchange actually solved this problem. We don't need the main chain coin as a miner fee when we withdraw any tokens on the exchange. The exchange directly deducts the token for us, and the exchange itself will add the main chain coin as a miner fee.

As a wallet provider, Bitpie has also provided solutions to help users pay miners fees.

To put it bluntly, the centralized solution is that users exchange tokens for the main chain currency of the centralized company, and even users can exchange it with RMB.

BCH's solution

The slp protocol of BCH's token economic system is now slowly entering the mainstream, and it is also necessary to solve the problem of exempting the use of BCH as a miner fee for issuing tokens to improve user experience.

BCH developers proposed a solution called slp postage agreement. ( Slp-postage-protocol : )

The basic composition of a transaction using slp postage agreement is as follows:

The user uses anyone can pay to send an slp transaction with at least two transaction inputs:

Input1: The slp coin that the user needs to send

Input2: leave a bch output blank and leave it to the postage agreement service provider to make up

Input3: Generally, the amount of stamps is fixed. If the user's transaction size is relatively large, multiple stamps need to be posted, and multiple Inputs need to be left blank to post stamps to the postage agreement service provider.

At least three transaction outputs:

Output1: The destination address of the slp coin sent by the user

Output2: The service provider's coin receiving address, the user uses slp coins to pay the stamp to the postage agreement service provider

Output3: The address of the postage agreement service provider, the BCH amount of input2-the BCH amount of output3 = miner's fee. If there are multiple stamps, there will be output4.

Add a little knowledge of Anyone can pay's transaction format.

As the name suggests, it is a transaction that anyone can pay. Generally, when assembling a transaction, a transaction wallet will write all the input and output, and write the input signature, and then send it out.

When the wallet assembles anyone can pay transaction, the first sender is allowed to assemble only part of the input and sign and all the output, and if the vacancy is input, or the amount of input that meets the amount of input in the script will take effect. Then other wallets can actively add subsequent inputs and sign when receiving this transaction, but cannot add outputs.

With the above knowledge, the basic logic of postage agreement can be described:

  1. The postage server establishes a whitelist of slp tokens.

  2. The slp users in the whitelist use the Anyonecanpay transaction format to send slp tokens.

  3. The postage server receives a portion of the tokens.

  4. The server stamps the transaction, that is, adds the BCH miner fee and adds it to the user's transaction.

  5. The transaction is established, the miner verifies and packs it.

Because the postage agreement is public, anyone can build a postage server, but it needs the support of the wallet. The wallet requires the user to be able to construct anyonecanpay transaction and add the slp miner fee to the postage server by default.

$ 1.63
$ 1.53 from @TheRandomRewarder
$ 0.10 from @tula_s
Sponsors of arslankhalid
Avatar for arslankhalid
3 years ago


Thank you so much

$ 0.00
3 years ago

I save this article

$ 0.00
3 years ago

I save this article. 😳🤯

$ 0.00
3 years ago

Save this article nice to review it when Im get confused.

$ 0.00
3 years ago

Very informative article

$ 0.00
3 years ago