-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Feature request: Export code for etherscan verification #564
Comments
I found a nice |
This sounds like a great idea! I'll add it to our internal tracking. Thanks! |
Whoops. Closing the issue wasn't what I intended. Reopened. |
This is a wonderful feature that is very useful. I've tried multiple times in the past to verify contracts I wrote with Truffle, and it was an absolute hassle; The only times I was able to do so, was when I side-stepped Truffle's deployment pipeline, and manually flattened the source, followed by manually uploading it using Mist or Parity. I see this as a must-have for any serious smart-contract project. 🙂 |
I would love this feature - I'm actually trying to include a flattener into my scripts now so that I always deploy flattened files so I always can verify the solidity. That will let me develop with separate files but not have to worry about tracking down what Solidity was compiled. The really frustrating part of this process is that change comments, spacing, or anything about your Solidity results in different binary. You need exactly what was deployed - there's really no way around it. |
Better yet, it would be nice if |
I agree @moodysalem - Truffle Flattener still has issues but the team is working on making it easier and easier to use every day. It's what I use but it's still not ideal. |
@mtbitcoin is it possible for you to expose an API for verifying your contracts? A package that combines truffle-flattener and a call to the etherscan API would be trivial to write |
Would love to see this soon! |
I'm using: https://www.npmjs.com/package/truffle-flattener Also helpful when exporting to |
This issue can be closed since |
@xpepermint @stefek99 I can try this again, but truffle-flattener did not do the trick at the time of posting this issue. Truffle flattener got close but not close enough to map perfectly to Etherscan, not to mention it was impossible to integrate into an automated workflow to run automatically as changes were made. |
sol-merger works a treat. I used yesterday and will merge all your deps into one file and it works for deploying to etherscan code. Would be lovely to integrate this into build flow by way of a switch or something. |
There is also https://github.com/BlockCatIO/solidity-flattener |
Would be good to put a list of flatenners that work. I know the blockcat one does. We can then put together a formal list which would be helpful |
No need a list, just one that works is fine. |
|
I just funded this from FundRequest, we verify our contracts everytime we do a deploy. If the process could be simpler/faster it would be a time saver 👍 |
Despite original issue was about building additional files needed for verification proces on etherscan.io, I think Truffle could go a step further, and instead actuall call etherscan API for verfication. Ideally it would do so for every deployed contract (i.e. in deployer), subject to config option (as I guess some people may prefer not to share source code). It is at the position to do so, it just deployed a contract, it knows the source code, it knows compiler version, so making human do the work is suboptimal. |
@burdakovd Completely agree with you as I've had the some thoughts for over a year now. Any update on getting a true 1 for 1 Truffle Deployed Smart Contract source code file to verify on etherscan? |
For reference the API endpoint for the source code verification is available at https://etherscan.io/apis#contracts |
This is a great candidate for a |
Good callout @mtbitcoin, I found that link earlier today when doing some research since it's been awhile since I looked for a solution last time. Couple that with I'm going to start work on implementing this within Validity Labs toolchain (to be opensource in the future) |
We’ve been running that api endpoint for quite a while. It is stable and should have 100% compatibility with the manual source verification on Etherscan (minus the error messages and some input checking). It does however require an api-key which can be generated for free on Etherscan.io Ping if you have questions |
Hi all. I'm closing this issue as out-of-scope, since, as mentioned, |
@mtbitcoin I tried pretty much every flattener and can't get verification to work. What is the currently recommended way/tool? I'm using solidity 0.5. |
@JohannesMayerConda if the flattened code compiles in Remix it should also work with ours |
@mtbitcoin truffle-flattener works for me and compiles in remix but it doesn't verify. Their Readme also states
I opened an issue for Flattery https://github.com/akombalabs/SolidityFlattery/issues/2 where I'm stuck And BlockCatIO/solidity-flattener has open issues like this BlockCatIO/solidity-flattener#26 and does strange things like putting a very old pragma version in the file Is the solution to get rid of truffle migrations? What is good/best practice? Still the BlockCatIO solidity-flattener that has latest commit Dec 13, 2017? |
I started work on a truffle plugin to automatically verify source code for deployed truffle contracts. The syntax is currently like this: truffle run verify SimpleStorage --network rinkeby Which automatically calls the Etherscan API and returns The functionality is still very limited and it doesn't support code flattening yet, so any kinds of contributions to the plugin are welcome! |
I've been working on my own flavor that uses With that, I'll write up a small deployer tool that can used along with the flattener and verify-er. Buidler also has an empty (from last week) repo that's titled to give the impression they are working on ethercan contract verification automation as well. |
Hey guys, quick update. Thanks to @vinceau's great work from a few weeks back, Run |
It seems that there is (still) no straight way to verify your solidity contracts on
etherscan.io
. Truffle makes it easy to build and deployreal
solidity projects. Splitting code into multiple files is a good practice but usingimports
makes it difficult to verify your contracts onetherscan
because you have to provide all your contract's source code as a single file. I usenpm
libraries to build solidity contracts so you can imagine that it's extreamly difficult to collect all source code.Truffle could procide a new command
verify
orexport
which would build additional files needed for verification proces onetherscan.io
.The text was updated successfully, but these errors were encountered: