TIP-4 - Free Software License TON VM Opcode [FB0A]

by Mitja Goroshevsky

with special thanks to Sergey Yaroslavtsev


Many members of our community have asked questions about Free TON code philosophy. Why we call it Free Software? What is a relationship between Free TON and Free Software? What is the difference between Free Software and Open Source? I have decided to combine this with an idea I have regarding gas payment redistribution in TON. You will see below why it is related.

The concept of Free Software predates open source. Richard Stallman has started the free-software movement in 1983 with a launch of GNU Project while open-source movement has been derived from Free Software only in 1998.

To clarify, the Free Software is not in conflict with Open Source. As explained below it follows all the same principles and the differences seems more ideological. Yet TON project did not have any problem with open-source nature of it software. It is all open sourced. The problem was exactly about the Freedom of people to use it. That is why Free TON is heavily influenced by Free Software movement. Declaration of Decentralisation is, in many ways, inspired by Stallman’s “The GNU Manifesto” [1].

In “Why Open Source misses the point of Free Software” Stallman writes among other things: “The terms “free software” and “open source” stand for almost the same range of programs. However, they say different things about those programs, based on different values. The free software movement campaigns for freedom for the users of computing; it is a movement for freedom and justice. By contrast, the open source idea values mainly practical advantage and does not campaign for principles. This is why we do not agree with open source, and do not use that term.”[2]

It seems Free TON is in agreement with this line of thought. While all our software is open source it is the Freedom to run the software what has launched this network.

Now let’s talk about Copyright and Licensing as they relate to the Free Software in general and Blockchain in particular. Before we start I need to say that blockchain may potentially provide a solution to some of the free software inherited business model problems.

We all remember that free in the free software stands for freedom and not for zero price. The ability to get paid for a software should not be based on restrictions imposed by its license. But what it should be based upon then? There are several business models for free software non of which really works. What works is a business model that is not exactly related to the software itself and therefore can not be attributed to it. Such as charging for support or for portions of the software which are closed source. It all seems quite unnatural. It also prevents one of the major points of free software — an open collaboration of the community around software projects.

Donald Fischer article title “Open source creators: Red Hat got $34 billion and you got $0. Here’s why” [3] is self explanatory. IBM has bought a commercial company that was built on top of many developers’ contribution to its code. Those developers never got any part out of the value they have created.

Aligning the incentives

Many free and open source software projects struggle to introduce a sustainable business model. This is one of the reasons why most of the open source software contributors work for large corporations. When a venture capital provides funding to a software project it expects multiple return on its capital. With commercial software it is quite straight forward — a company is charging money for its software use and if successful passes profits to its stakeholders. With free software its quite difficult. That is why there are very few (or should we say: not enough) commercially successful open source software companies.

Blockchain introduces a unique opportunity for Free Software developers to align their commercial interests with those of users for the benefit of the whole ecosystem. As an Internet of Value protocol, Blockchain has built-in network incentive mechanism — network fees (or gas).

To remind:

Miners in Proof-Of-Work collect miner rewards and network fees to compensate them for resources spent to secure the network and process transactions. Both security computations and transaction processing are separate resources, thus requiring separate fees.

In Proof-Of-Stake Validators commit funds and processing power to secure the network and process transactions (in a form of smart contract execution in TON). For this they also get separate rewards: block rewards in a form of token emission and transaction reward in a form of a fee. Please note, rewards are separated in both cases.

We propose to extend the reward model to transaction facilitators. It would be logical to pay part of the fees to the smart contract developer who is initiating the transaction which pays the fee. This will attract both Developers and Users which will increase network usage and total transaction fees for all network participants.

On-chain licensing fees

Somewhat naive mechanism but with the same underlying idea is proposed by Near blockchain.

“The developerReward are allocated by per block per account, as they can be efficiently done every time the transaction or receipts is being processed by the contract.” [4]

The problem with this approach lays in the fact that network fees not only pays for resources but also provide an important anti spam mechanism. One can use the developer kick-back to simply lower an attack costs. To mitigate that risk we propose a use of a special Payout Contract. This contract is going to pay the collected Copyleft fees to developers only after certain threshold in both amount of fees and time frame are surpassed.

In this respect the Developer motivation is again aligned with the Network security model — it is not practical to break the network where one receives a long term rent.

Some technical details

Technically we introduce a TVM Opcode FB0A. Contract may include that code together with a License information and address of its developer.

Collator will include a reward related to gas fees from these transactions into the block for the address indicated in the TVM instruction in the amount corresponding to the indicated License. The percentage of gas fees depends on the license type such as that the most free software compatible license provides more gas.

FB0A - COPYLEFT (n x y - ), looks up for the license rule for ‘n’ in ConfigParam (for example 42) and creates output action to send part of the tokens it collected from gas fees to Payout contract indicated in ConfigParam for address x:y, where x - is 32 bit signed integer for workchain and y is 256 bit unsigned integer for contract address in this workchain. It will not throw any exceptions if n or the address are incorrect.

Generally allowed licenses are those supported by Free Software Foundation as described here: https://www.gnu.org/licenses/license-list.html#SoftwareLicenses

License types payout

GPL-Compatible Free Software Licenses → 30% fees

GPL-Incompatible Free Software Licenses → 20% fees

Copyright discussion

“What is the proper way to decide copyright policy? If copyright is a bargain made on behalf of the public, it should serve the public interest above all. The government’s duty when selling the public’s freedom is to sell only what it must, and sell it as dearly as possible. At the very least, we should pare back the extent of copyright as much as possible while maintaining a comparable level of publication.” [5]

  • One important dimension of copyright is its duration
  • Another dimension of copyright policy is the extent of fair use: some ways of reproducing all or part of a published work that are legally permitted even though it is copyrighted.

(c) Richard Stallman

Both duration and fair use of copyright is balanced in this proposal by virtue of compensating copyright holder by Payout Contract creating an ongoing reward from the network while at the same time not preventing a forking possibility by other developers who then need to improve the software in a way that will bring new users and create new intensive for the new contributor. So both improvements as well as long term rent (subscription) is provided for developers.

The Copyleft spirit is fully supported here as the Fee is collected for developers who facilitates the fees creation in the first place. The freedom to fork is fully executed as well as anyone can fork the code of a smart contract. In the end it is the community of users who chooses which contract to use and the decision is usually based upon the reputation of the code represented by the hash of the code where is no single byte has been changed. Therefore the system is merit-based. Both long term developer’s incentives for original developers and forking is provided.

To recap the proposed system is compatible with all four essential freedoms:

:white_check_mark: The freedom to run the program as you wish, for any purpose (freedom 0).

:white_check_mark: The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.

:white_check_mark: The freedom to redistribute copies so you can help others (freedom 2).

:white_check_mark: The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.


[1] https://www.gnu.org/gnu/manifesto.html

[2] https://www.gnu.org/philosophy/open-source-misses-the-point.html

[3] https://blog.tidelift.com/open-source-creators-red-hat-got-34-billion-and-you-got-0.-heres-why

[4] https://near.org/papers/economics-in-sharded-blockchain/#developer-business-models

[5] https://www.gnu.org/philosophy/misinterpreting-copyright.en.html


Is it possible to use existing opcodes to reach the same goal?
If yes, why do we need a new one?
If no, could you clarify, please what exactly is not possible? May be some use case could help me to understand better.
Thank you!

1 Like

Please provide an example of a smart contract that will have the same functionality using existing Opcodes. I can not imagine how you would redistribute the gas fees by combination of existing opcodes.


With gas fee it is not possible now but it should not necessary be a gas fee as I understand. You didn’t bring the use case so it is difficult to say but I could imagine the smart-contract which takes some additional fee and sends it to the wallet owner with some metadata in the message. The metadata could be used to send another part of the fee to the owner of the original SC, i.e. to the developer.
I mean it is possible to implement some kind of inheritance using existing opcodes, for example:

  1. I deployed SC which takes some commission (fee) from every transaction and sends it to me.
  2. When somebody copies SC and deploys it to blockchain, SC could detect this case and send portion of the fee to the original owner (i.e. to the developer of SC).
    The level of inheritance can be infinite.

Have I correctly described the scenario that you want to achieve with the new opcode?

Of course you can just set a fee for your own smart contract that will send it to you. But that will be on top of the fees your users already spend. That is not the point of this proposal. The usecase is I think described: You write a smart contract and you can get a portion of fees paid to validator sent to you as a copyleft owner. You can then send this back to your users effectively lowing their fees or keep it as a payment for you. All of that is perfectly aligned with FS licensing model. Users effectively dont need to pay more for their use of your software while validators will share fees with you because of the value you bring to the network. For me (and apparently for Near as well) that makes perfect sense.

BTW there is no problem to add opcodes there is a reserved opcode space precisely for that.


Thank you for this proposal. Maximizing incentives for contract developers is very important.


How is the copyleft enforced? What prevents a developer from forking contract and removing fees to original developer?

How soon can this be implemented?

1 Like

It is a statement of the license inside the code. So the code is marked with a Copyleft license. When you mark a license on github repository you are effectively doing the same. But you are correct — there should be a link to the copyleft license itself. Good catch! Thank you. Will add it.

I think I have answered that previously — nothing will or should prevent it. That is the whole point of Free Software. It should not be prevented but rather encouraged.
The original author will get people to use its original code for many reasons: the formal verification, the reputation, the quality etc.
But eventually someone else will write better version and the community will accept the code modification as a better alternative and use it and pay the fees to the Author of modified version.
IMO this is exactly the best process we want to encourage, isn’t it.

Should be there by year end I think, once accepted.


Interesting proposal but I see one issue.
If such OpCode will be implemented, there may be misuages of it, i.e. just copypasting the code with slight changes and licensing it. Who gets the fees then? Not the original developer who spent his time.
What about validators? Will the get gas fees minus developer part? If this part is too high what is a profit for validator to run the node? Validator will need more resources for the same income and hardware and electricity are not free.
What about users? If developer part is take from gas payment that could be passed to validator, this is not user problem, but if this is extra fee that user must pay, why would user want to interact with smartcontracts?

P.S. Read the comments, and the idea is becoming more and more strange. If anyone can just add slight modification to contract and call it a deal, then why do developers even bother to develop?

1 Like

Of course that was considered. But this is not a real problem for the following reasons:

  1. This is how Free Software works. Everyone can fork a code and use it the way they want. Yet that has created one of the largest industries of all times.
  2. Developers only get part of the fee user pay. Just forking a smart contract is not enough – users need to use it and that is much larger problem than writing a smart contract.
  3. The validators getting the fees that is there because developer promoted the use of its smart contract. Without developer’s effort of writing and promoting the use of his work no fees would be generated int he first place, therefore validator is just paying part of the fees to developer which caused these fees to exist. Fair deal.
  4. Validator costs are covered already by the block fees. Fees for transaction execution are a bonus, but they can be a very healthy bonus when the network becomes popular because of the Developer efforts. Again seems fair to me.
  5. It is not the extra fee user won’t feel anything and that is another important aspect of the proposal.

such a system creates a large number of forks with minor additions or changes of the lowest possible quality. And the competition of the same type of smart contracts for the users. this will lead to mountains of low-quality product that by all means will lead the user into confusion and deception. I am sure that the future, on the contrary, is in uniting developers over one product, whose remuneration will depend on the quality of the product being created and the amount of personal contribution.
That is, everyone is interested in the best possible quality of the product being created while striving to make a greater contribution in order to receive more remuneration.