# <img src="https://cryptologos.cc/logos/polkadot-new-dot-logo.png?v=032" style="width:30px; padding: 0 10px 5px 0"> Solidity Tooling Research
## Polkadot Plaza smart contract components
- GOAL: we need `Polkadot Plaza smart contract general components` which can be re-used in any of the JS based tooling (Hardhat, Remix, VS code plugins and our native IDE) + in Foundry through Hardhat integration = so in all popular Solidity tooling to cover the broadest possible audience most efficiently
### Interpretation of the research below
The Soldity survey results indicate that developers use a variety of tools to meet their needs.
The vast majority use VScode as their preferred editor to write & mange solidity projects and they leverage solidity plugins to augment, analyze and optimize their code.
Compilation is supported by almost all tools with 59.9% avoiding the Solidity compiler via command line in favor of web-based compilers in web IDEs or VS Code plugins, a trend consistent with last year.
For advanced debugging and interaction, developers can choose between Remix and Foundry. They also support deployment, simulation and running tests, which HardHat is an additional choice for.
All major tools apart from Foundry are written in Javascript/Typescript, which are also by far the most used languages of solidity developers and hence the most convenient language to script and automate tasks, supported by CLI and WEB tools. Additionally, HardHat and Remix specifically can also be extended via Plugins, which themselves are also written in Javascript/Typescript, allowing Solidity developers to extend their tools without the need to wait for the tool maintainers. It is noteworthy, that Foundry offers integration for HardHat, which allows it to utilize HardHat plugins and the other way around. Additionally, Remix supports integrating both, HardHat and Foundry to utlize their features as well. The Visual Auditor plugin for VScode stands out as a tool, which supports a lot of features related for security auditing.
When analyzing ZKSync's approach, wich is most similar and comparable in what we would need to do as well, in developing their [Remix](https://github.com/NethermindEth/zksync-remix-plugin) and [Hardhat](https://github.com/matter-labs/hardhat-zksync) plugins, we observed that they focused on developing the Hardhat plugin first and then, after a year, developing the Remix plugin. The development of the Hardhat plugin is ongoing for two years, while the Remix plugin is ongoing for 10 months now. Based on contributions from listed contributors, both have a different team of 5-6 engineers working on the project. Their approach did not focus on developing general components for reuse code in both plugins, but instead developed each component separately, which most likely took more time than the other approach would have taken. Also, re-using the code to make or support yet another tool in a quickly changing landscape or deciding to create an additional VScode plugin might again take many more months, increasing the costs further.
## Solidity Surveys (2020-2024)
| Year | Survey participants | Most used language |
| ---------- | ------------------- | ---------------------------------------- |
| [2020][20] | 193 | JS (36%), Solidity (21%), TS (11.5%) |
| [2021][21] | 435 | JS (27%), Solidity (27%), TS (14.7%) |
| [2022][22] | 1401 | JS (25.6%), Solidity (28.6%), TS (20.5%) |
| [2023][23] | 474 | JS (15.4%), Solidity (42.9%), TS (16.7%) |
| Editor when writing Solidity | VS code | VIM | Remix |
| ---------------------------- | ------- | ----- | ----- |
| [2020][20] | 50% | 12.6% | 9.8% |
| [2021][21] | 64% | 7% | 11% |
| [2022][22] | 81.8% | 3.7% | 2.3% |
| [2023][23] | 77.2% | 4.7% | 3.5% |
| Eth Specific Dev Environment | Truffle | Remix | Foundry | Hardhat |
| ---------------------------- | ------- | ----- | ------- | ------- |
| [2020][20] | 60% | 50% | --- | 38.6% |
| [2021][21] | 26% | 26% | 1.6% | 65% |
| [2022][22] | 17% | 42% | 30% | 75% |
| [2023][23] | 0.6% | 25.8% | 32% | 33% |
|Solidity related plugins | HardHat VS code plugin | Solidity Juan Blanco VS code plugin | Remix VS code plugin | Solidity Visual Auditor VS code plugin | Truffle VS Code Plugin |
| ----------------------- | ---------------------- | ----------------------------------- | -------------------- | -------------------------------------- | ---------------------- |
| [2020][20] | --- | --- | --- | --- | --- |
| [2021][21] | --- | --- | --- | --- | --- |
| [2022][22] | 631 people (45%) | 507 people (36%) | 244 people (17%) | 218 people (16%) | 87 people (6%) |
| [2023][23] | 180 people (38%) | 119 people (25%) | 89 people (19%) | 82 people (17%) | 25 people (5%) |
## Tooling comparison table
`VS: = (vs code plugin)`
| Features ⬇️|[Hardhat][1]|[Remix][2]|[Foundry][3]|[Tenderly][4]|[VS: Hardhat][5]|[VS: Solidity(JB)][6]|[VS: Visual Auditor][7]|[VS: Truffle][8]|
| ---------------------------------------------------|--|--|--|--|--|--|--|--|
| Environment |CLI|Browser|CLI|Browser|VScode|VScode|VScode|VScode|
| Language |JS/TS|JS/TS|RS|JS/TS|JS/TS|JS/TS|JS/TS|JS/TS|
| Free |✅|✅|✅|❌|✅|✅|✅|✅|
| Edit source code |❌|✅|❌|✅|✅|✅|✅|✅|
| Augment Solidity language |❌|✅|❌|✅|✅|✅|✅|❌|
| YUL support |❌|✅|❌|❌|❌|❌|❌|❌|
| Static analysis |✅|✅|✅|✅|❌|❌|✅|❌|
| Profiler/Reporter (gas, state, ... ) |✅|✅|✅|✅|❌|❌|✅|❌|
| Generate Docs (custom, NatSpec, ...) |✅|❌|✅|❌|❌|❌|❌|❌|
| Solidity Copilot |❌|✅|❌|❌|❌|❌|❌|❌|
| Contract Signatures database |✅|✅|❌|✅|✅|✅|✅|❌|
| compiler/evm version manager |✅|✅|✅|✅|❌|❌|❌|❌|
| Formal verification |❌|❌|❌|❌|❌|❌|❌|❌|
| Optimizer (gas, ...) |❌|✅|✅|✅|❌|❌|❌|❌|
| Package Management |✅|✅|✅|❌|❌|❌|❌|❌|
| Sourcify support |❌|✅|✅|❌|❌|❌|❌|❌|
| File Watcher |✅|❌|✅|❌|❌|❌|❌|❌|
| Preprocess source code |✅|❌|✅|❌|❌|❌|✅|❌|
| Compiling |✅|✅|✅|✅|❌|✅|❌|✅|
| Testing (runner, mock, matcher, ...) |✅|✅|✅|❌|❌|❌|❌|❌|
| Code Coverage |✅|❌|✅|❌|❌|❌|❌|❌|
| Fuzzing |❌|❌|✅|❌|❌|❌|❌|❌|
| ERC1820 Registry support |✅|❌|❌|❌|❌|❌|❌|❌|
| EIP-712 deployment |❌|❌|✅|❌|❌|❌|❌|❌|
| Create-2 deployment |❌|❌|✅|❌|❌|❌|❌|❌|
| 4Byte Eth Signature database |✅|❌|✅|❌|❌|❌|❌|❌|
| Deployment |✅|✅|✅|✅|❌|❌|❌|✅|
| Deployment automation & migration |✅|✅|✅|❌|❌|❌|❌|❌|
| Network simulator |✅|✅|✅|✅|❌|❌|❌|✅|
| Timetravel Debug transactions |❌|✅|✅|✅|❌|❌|❌|✅|
| Compiler Output Analysis |✅|✅|❌|❌|❌|❌|❌|❌|
| Storage Layout Manipulation |✅|❌|❌|❌|❌|❌|❌|❌|
| Decompiler |❌|❌|❌|❌|❌|❌|✅|❌|
| Disassembler |❌|❌|❌|❌|❌|❌|✅|❌|
| Scriptable signer/wallet |✅|❌|❌|❌|❌|❌|❌|❌|
| Contract verification |✅|✅|✅|✅|❌|❌|✅|❌|
| ABI based contract interaction |❌|✅|✅|✅|❌|❌|❌|❌|
| Blockchain Node as a Service |❌|❌|❌|✅|❌|❌|❌|❌|
| Blockchain Network as a Service |✅|❌|❌|✅|❌|❌|❌|❌|
| Scripting actions (REPL, CLI, API) |✅|✅|✅|✅|❌|❌|❌|❌|
| Web3 cronjob & reaction automation as a service |❌|❌|❌|✅|❌|❌|❌|❌|
| Monitoring |❌|✅|❌|✅|❌|❌|❌|❌|
| Logging and tracing |✅|✅|✅|✅|❌|❌|❌|❌|
| Onchain transaction explorer |❌|❌|❌|✅|❌|❌|❌|❌|
| Onchain contracts explorer |❌|❌|❌|✅|❌|❌|❌|❌|
| Onchain accounts explorer |❌|❌|❌|✅|❌|❌|❌|❌|
| Plugin system |✅|✅|❌|✅|❌|❌|❌|❌|
[1]: https://hardhat.org/docs "HardHat CLI"
[2]: https://remix-ide.readthedocs.io/en/latest/ "Remix Web IDE"
[3]: https://book.getfoundry.sh/getting-started/first-steps "Foundry CLI"
[4]: https://docs.tenderly.co/ "Tenderly Web IDE"
[5]: https://github.com/NomicFoundation/hardhat-vscode/blob/development/client/README.md "VS code plugin: Hardhat"
[6]: https://github.com/juanfranblanco/vscode-solidity/blob/master/README.md "VS code plugin: Solidity (JB)"
[7]: https://github.com/Consensys/vscode-solidity-auditor/blob/master/README.md "VS code plugin: Visual studio Auditor"
[8]: https://github.com/trufflesuite/vscode-ext/blob/develop/README.md "VS code plugin: Truffle"
[20]: https://soliditylang.org/blog/2021/01/26/solidity-developer-survey-2020-results/ "Solidity Survey 2020"
[21]: https://soliditylang.org/blog/2022/02/07/solidity-developer-survey-2021-results/ "Solidity Survey 2021"
[22]: https://soliditylang.org/blog/2023/03/10/solidity-developer-survey-2022-results/ "Solidity Survey 2022"
[23]: https://soliditylang.org/blog/2024/04/03/solidity-developer-survey-2023-results/ "Solidity Survey 2023"
---
## Remix history
<ul>
<li>
<b>first commit (Jul 2015) - uses emscripten transpiled compiler to compile solidity from editor</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/ed6f3caf55f95d90a0f546c52b53522b5ee268aa">create basic editor + transpiled compiler</a></li>
</ul>
</li>
<li>next commits optimize compiler API and structure output in frontend and outputs json and show formatted assembly in dom</li>
<li>
<b>added ethereujs-vm transpiled to execute compiled solidity</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/b09870d6d9220bba2cfc50f7e9c1fd9067e6ce92">add browser evm</a></li>
</ul>
</li>
<li>
<b>added first udapp version + map compiler output ABI to web3js</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/dc166a2bee346871b5b05462980f8004baa69588">udapp + web3js</a></li>
</ul>
</li>
<li>
<b>deploy from browser to testnet using geth</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/b82177eaaf76b84205d1ca98c55af53924ac5eb8">geth deploy</a></li>
</ul>
</li>
<li>next commits improve udapp, editor and general UX</li>
<li>show runtime bytecode</li>
<li>
<b>start versioning compiler (Sep 2015)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/2ed2a1c0fec4e901f6cf3b3ab4facecc24ec4121">compiler version</a></li>
<li><a href="https://github.com/ethereum/remix-ide/commit/3f881d9dbe9c4432c13fbeb215273fb477c59b43">version list</a></li>
</ul>
</li>
<li>
<b>highlight errors in editor</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/1581a4c74efaff963b8107a347cd1d5500e454fc">editor errors</a></li>
<li><a href="https://github.com/ethereum/remix-ide/commit/3f881d9dbe9c4432c13fbeb215273fb477c59b43">october 2015 - multiple file tabs</a></li>
</ul>
</li>
<li>
<b>allow compiler hook for solidity imports</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/9a3352aa34a027597f2459c84e087beef7e46a16">recursive import hooks</a></li>
</ul>
</li>
<li>
<b>autodeploy and link bytecode (Oct 2015)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/c6062c5355e3daec6cc9730c675d2f424c4ebf4e">deploy+link</a></li>
</ul>
</li>
<li>
<b>use webworkers (Oct 2015)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/2b6b02a769062351fb1b18697ebce3e6fd31495c">webworker</a></li>
</ul>
</li>
<li>
<b>update compiler import callback (Jan 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/3e834239158a117086936e8e9ecdea1ea96a49af">compiler callback</a></li>
</ul>
</li>
<li>
<b>add multi account to compiler</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/2d8ed0b5d52a308be485e379da1f5d7b89a94661">multiaccount</a></li>
</ul>
</li>
<li>
<b>add transaction browser (april 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/6490717a980cc92aad5e54aa6a9ca4af55c68cb2">txbrowser</a></li>
</ul>
</li>
<li>
<b>start debugger development (april 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/6490717a980cc92aad5e54aa6a9ca4af55c68cb2">debugger panels</a></li>
</ul>
</li>
<li>
<b>add some tests (jun 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/f81756a44ccc926183410b58e3e72365aa7410bb">tape tests</a></li>
</ul>
</li>
<li>
<b>add first debugger (july 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/f81756a44ccc926183410b58e3e72365aa7410bb">initial debugger</a></li>
</ul>
</li>
<li>
<b>start formal verification of solidity (july 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/519dbe2d4a1536568b98df8b4cd9f9763dc7687f">formal verify</a></li>
</ul>
</li>
<li>many commits to turn editor into IDE with communicating components</li>
<li>many commits to improve debugger and other details and testing</li>
<li>
<b>add dissassembler (Oct 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/64b8bbf4b822f83285326c125415af46ff690958">disassembler</a></li>
</ul>
</li>
<li>
<b>start static analysis module (Nov 2016)</b>
<ul>
<li><a href="https://github.com/ethereum/remix-ide/commit/88df6c9f59f64ce7429f3fedfa897ef6531a9f47">staticAnalysis</a></li>
</ul>
</li>
<li>many commits to refactor/improve/refine debugger and other modules</li>
<li>many commits to improve debugger</li>
</ul>
<!--
## Plan
- milestones:
- further research
- build first set of components
- build second set of components + refine of the existing ones
- implementation of components into the chosen tool based on the research results (should be discussed with the Polkadot community - Parity Smart contract team, Web3 foundation, technical specialists etc.)
- update the proposal
- add utility.batch to split the proposal into 4 payments based on the milestones
#### Features to unlock:
- contract compilation
- contract testing
- contract deployment
- contract interaction
- onchain transaction debugging
- contract verification
- hooks (events, state... for monitoring, alerts...)
#### Core Components list:
- browser PVM
- solc revive web compiler
- solc version manager
- custom web3js based libraries to support EIP-712 deployments
- eth ABI polkadot.js codec library
- time travel debugger
- contract interaction component
- disassembler
- decompiler
- signature database
- monitoring and logging transactions
#### Components:
-->
--------------------------------------------------------------------------------------
<style>
/* Use https://unbounded.polkadot.network/ */
#doc, body {
--brightpink: hsla(328, 100%, 55%, 1);
--background: #181a1b;
--boxes: hsla(328, 100%, 20%, 1);
--titles: #e6007a;
--text: #ddd;
--tablehead: hsla(328, 100%, 30%, 1);
--tablecells: hsla(328, 100%, 10%, 1);
--tablecells: var(--background);
--links: hsla(328, 100%, 55%, 1);
--listnumbers: var(--titles);
--quotes: #999;
}
#doc blockquote, .ui-content blockquote {
color: var(--quotes) !important;
}
#doc h1, #doc h2, #doc h3, #doc strong,
.ui-content h1, .ui-content h2, .ui-content h3, .ui-content strong {
color: var(--titles) !important;
letter-spacing: -.02em !important;
}
body, .ui-view-area, .ui-content, #meta-title-tags > div {
background-color: var(--background) !important;
}
#doc, .ui-content {
color: var(--text) !important;
}
/* #doc summary, .ui-content summary {
cursor: default !important;
margin: 0 !important;
padding: 0 !important;
}
#doc details, .ui-content details {
background-color: var(--boxes) !important;
background-color: var(--background) !important;
border-radius: 10px !important;
padding-left: 30px;
padding-right: 30px;
padding-top: 0px;
padding-bottom: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
#doc summary::marker, .ui-content summary::marker {
content: '';
} */
#doc a, #doc a:hover, .ui-content a, .ui-content a:hover {
color: var(--links) !important;
}
#doc table, .ui-content table {
font-size: 13px !important;
border: 0 !important;
background-color: var(--background) !important;
}
#doc thead {
border: 2px solid var(--brightpink) !important;
border-radius: 10px !important;
border-bottom: 1px solid black !important;
}
#doc tbody, .ui-content tbody {
border: 2px solid var(--brightpink) !important;
border-top: 1px solid black !important;
}
#doc th, .ui-content th {
border: 1px solid black !important;
background-color: var(--tablehead) !important;
padding: 8px !important;
margin: 0 !important;
}
#doc td, .ui-content td {
border: 1px solid black !important;
background-color: var(--tablecells) !important;
padding: 8px !important;
margin: 0 !important;
text-align: center !important;
}
#doc td:nth-child(even), .ui-content td:nth-child(even) {
opacity: 99% !important;
}
#doc td:nth-child(1), .ui-content td:nth-child(1) {
color:var(--brightpink) !important;
}
#doc ul, #doc ol, .ui-content ul, .ui-content ol {
list-style: none !important;
}
#doc .marker, .ui-content .marker {
color: var(--listnumbers) !important;
}
#doc ul li::before, .ui-content ul li::before {
content: "•";
color: white;
display: inline-block;
width: 1em;
margin-left: -1em
}
</style>