Skip to content

TEP: Contract source registry#91

Merged
EmelyanenkoK merged 5 commits into
ton-blockchain:masterfrom
talkol:master
Jan 9, 2026
Merged

TEP: Contract source registry#91
EmelyanenkoK merged 5 commits into
ton-blockchain:masterfrom
talkol:master

Conversation

@talkol

@talkol talkol commented Sep 9, 2022

Copy link
Copy Markdown
Contributor

This proposal defines decentralized infrastructure and an on-chain registry to store the source code for verified TON smart contracts.

The proposal also defines a simple permissionless protocol where community source code verifiers can register and publish signed attestations that they have indeed verified specific contracts.

@talkol talkol changed the title TEP-92: Contract source registry TEP-91: Contract source registry Sep 9, 2022
Comment thread text/0092-contract-source-registry.md Outdated
Comment thread text/0092-contract-source-registry.md Outdated

## sources.json

JSON file provided by a specific **verifier** for a specific **contract code hash** containing the URLs of source-code files and verification attestations. Fields of this file include:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should also include the original signatures (which are done on the data part of the json)

{
   data: {
      codeHash:...
  },
  sigs: [{sig: '...', pubKey: '...'}]
}

otherwise, the UI will not be able to display the signatures used to verify the contract.

@talkol talkol Sep 9, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's indeed nice to add here as well for UI purposes, but then it's a bit circular. Because the signature is over code hash + sources_json_url and the sources_json_url is derived from a hash over its data and the signature is in the data. Do you have any simple way to overcome this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if signatures are stored on chain within the source item contract?
Each signature is 512bit, so this would add another 2-3 cells (assuming 5 verifier multi sig threshold)

This has interesting implications in case we retire and replace one or more of the original verifying nodes, so it would be good to decide how clients should handle such case (i.e. that the public key used to sign can no longer be found in the verifier registry).

Comment thread text/0092-contract-source-registry.md Outdated

### Actions

* `update_verifier(verifier_id, backend_endpoints, quorum_config)` - If the verifier does not exist, ensures it deposits the required amount and adds to the registry. Otherwise updates details in the registry. The address that sends this update message is stored in the registry as the admin address and only it can update. The quorum config contains the list of public keys and how many are needed for quorum.

@mrbonezy mrbonezy Sep 9, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There probably should be a public key (representing the verifier) sent with this op as well, so that future operations (update endpoints, remove verifier) for an existing verifier can be authorized.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the simplest behavior is that the address that sends the update message is regarded as the admin address and only this address can update later. So if the admin is a wallet contract, it would send the internal message of the update and on the first update (insert) it would be set.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes In general I think verifying the sender is more elegant ( and more gas and storage efficient than public key method and simpler to code )


## Verifier registry contract

A smart contract deployed to TON mainnet that holds a mapping between a **verifier id** to the **verifier details** which include the list of backends, their public keys and quorum configuration. To prevent spam in this registry, we propose that each verifier will deposit in the contract a sum of 1,000-10,000 TON coin. This sum will be returned when the verifier unregisters.

@mrbonezy mrbonezy Sep 11, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An interesting point was whether to tie the staking amount to a config param, in order to reflect changes in TON/USD price.

E.g. 10 * 1e9 * Gas price (currently 1,000) => 10K ton

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea, since the contract is immutable without any special admin role, this can normalize the deposit size in case TON USD price changes significantly

@EmelyanenkoK

Copy link
Copy Markdown
Member

I think it is expedient to explicitly invite Source-code uploaders(probably tools for deployment like toncli?), Source-code verifiers(currently only tonwhales I believe?) and Source-code displayers (explorer-developers) to discussion.
@tvorogme @ex3ndr @tonscan

@ex3ndr

ex3ndr commented Sep 12, 2022

Copy link
Copy Markdown

LGFM, maybe just some possible generalizations - we want to have verifiable credentials in ton, and it's verifier is so similar to Verite and may just have the same infrastructure ready and then implement source code repository.

@v-lebedev v-lebedev changed the title TEP-91: Contract source registry TEP: Contract source registry Sep 12, 2022
@talkol

talkol commented Sep 12, 2022

Copy link
Copy Markdown
Contributor Author

I think it is expedient to explicitly invite Source-code uploaders(probably tools for deployment like toncli?), Source-code verifiers(currently only tonwhales I believe?) and Source-code displayers (explorer-developers) to discussion. @tvorogme @ex3ndr @tonscan

Sure, great idea

Source code uploaders in the first stage will be through web UI (drag and drop in your browser). We will launch an open source client like jetton.live that runs on GitHub Pages and later offer TF to host it on verifier.ton.org. I think command line tools like toncli and hardhat will come second.

Source code verifiers - we are also planning to launch a significant decentralized verifier operated by Orbs Network (orbs.com). It will be executed by a quorum of 21 staked Orbs oracles.

Source-code displayers, I think TonWhales explorer is here and I'll contact tonscan.org to join. I already talked about this general concept with them and they're waiting to see the widget that they should embed in their site so they can comment on it


#### Actions

* `update_sources(code_hash, verifier_id, sources_json_url, signatures)` - Verifies that the signatures match the verifier's quorum detailed under **verifier registry** and updates the **sources registry** with the url.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signed data should include a measure of preventing replay attack, such as a valid_until timestamp which can be verified as well.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ادم باش

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UQBhbNvEfQE7V-CJrVKPGPOcg1IwGq984K5_yQhqdQkU7vJD

@mrbonezy

mrbonezy commented Oct 11, 2022

Copy link
Copy Markdown
Contributor

Implementation for the sources registry contract can be found here:
https://github.com/ton-defi-org/ton-src-contracts/blob/main/contracts/sources-registry.fc

@mrbonezy

mrbonezy commented Oct 11, 2022

Copy link
Copy Markdown
Contributor

Implementation for the verifier registry contract was carried out via a ton footsteps grant:
ton-society/grants-and-bounties#41
and can be found here:
https://github.com/xssnick/registry-contract/blob/master/packages/contracts/sources/registry.fc

@Osasv

Osasv commented Jan 2, 2024 via email

Copy link
Copy Markdown

@Osasv

Osasv commented Jan 2, 2024 via email

Copy link
Copy Markdown

@amirbonakchi

Copy link
Copy Markdown

@Antorhalder

This comment was marked as spam.

2 similar comments
@Antorhalder

This comment was marked as spam.

@Antorhalder

This comment was marked as spam.

@Antorhalder Antorhalder left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UQAutOwc-EVANIwf1MG2m_M0wsubYsZnwUvPMMCkI8a3fkQx

@Antorhalder

This comment was marked as spam.

@WaelAtia90 WaelAtia90 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please

@WaelAtia90

Copy link
Copy Markdown

Thanks

@AlexWater123456789

Copy link
Copy Markdown

Request ID: 7E82:106046:7B7899:8F8053:685A8E3F

@morccanna11

Copy link
Copy Markdown

UQAb0VU6irwnFvgMbytW-BabcOdJ5AQOXikFXrAwaDijTt7h

@Zh5577

Zh5577 commented Nov 5, 2025

Copy link
Copy Markdown

Ton

@alfalex77 alfalex77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Éxito

@alfalex77 alfalex77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

@Zh5577 Zh5577 mentioned this pull request Dec 30, 2025
@EmelyanenkoK EmelyanenkoK merged commit e9bd6ca into ton-blockchain:master Jan 9, 2026
@kostyan1322-hue

Copy link
Copy Markdown

kostyan1322-hue added a commit to kostyan1322-hue/TEPs that referenced this pull request Jan 28, 2026
@Balmasexy

Copy link
Copy Markdown

Good

1 similar comment
@kostyan1322-hue

Copy link
Copy Markdown

Good

@kadymarian-spec

Copy link
Copy Markdown
wallet_plug

@blendotsequad

Copy link
Copy Markdown

Proposal ini mendefinisikan infrastruktur terdesentralisasi dan registri on-chain untuk menyimpan kode sumber kontrak pintar TON yang terverifikasi.

Proposal ini juga mendefinisikan protokol sederhana tanpa izin di mana verifikator kode sumber komunitas dapat mendaftar dan menerbitkan pernyataan tertulis yang menyatakan bahwa mereka memang telah memverifikasi kontrak tertentu.

@blendotsequad

Copy link
Copy Markdown

God mengekspor ke acoun bank ansa

@farisei77 farisei77 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

@care44cubs-max care44cubs-max left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@bushy85 bushy85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Man

@care44cubs-max care44cubs-max left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@samsuryajho-maker

This comment was marked as spam.

@care44cubs-max care44cubs-max left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@noaholuwaphilip-bot

Copy link
Copy Markdown

Thank you for your good work the thing

@Balmasexy Balmasexy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code

@pepovintage-hub pepovintage-hub left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bushy85 bushy85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.