How to deploy and verify(public source code) ethereum smart contract programmatically? - blockchain

I want to deploy an ethereum smart contract and verify(reveal) its source code. Can I do it programmatically?
Usually I deploy a smart contract and verify it on etherscan.io. After the verification the source code is revealed. The task is that I need to deploy a lot of smart contracts but I can not verify them manually. Is there a way or API to upload the solidity code to reveal smart contract code to the public?
Though I guess the answer is "no" but still want to hear any ideas.
Thanks in advance

Indeed, at the time of writing this, it seems like there's no public endpoint to do this. There's no mention of such contract verification endpoint in Etherscan documentation here https://etherscan.io/apis or here https://hexdocs.pm/etherscan/
Someone was asking the same thing on their subreddit just about a month ago, without much success
Etherscan is using Are you a robot? checkbox CAPTCHA upon verification. That one would be pretty hard to trick, not really worth trying. What you could do instead however is a partial automation of contract verification using Selenium.
Lets say you want to verify 20 contracts with minimal effort. It should be possible to write a script which would open up 20 tabs in browser, in each it would go to Etherscan, enter appropriate contract details for one of the contracts, but then let a human to handle the page with Are you a robot? captcha.

Etherscan has an HTTP API, with which contracts can be verified programmatically
https://docs.etherscan.io/tutorials/verifying-contracts-programmatically

Related

Meta Mask - burn transaction

I am new to MetaMask API. I am looking for how to burn a NFT, but I cannot find it in the documentation.
I've seen a post on Stackoverflow similar to what I am looking for, but the burn transaction was done with Solidity. Is there anyway that I can achieve this by using MetaMask API?
Any help would be appreciated.
Thank you so much.
Gary
Metamask's job is to connect you to the networks and provide you with account service. Burning an NFT is calling the burn method written on the contract.
NFT is eventually an ERC721 token, it is a smart contract and if burn functionality is not written, you cannot burn it or kill it.
Burning an NFT effectively destroys the token and removes it entirely from the Ethereum blockchain. On the NFT platform that you are using, there should be an option like "BURN THE TOKEN". Once you click on it, you calling the burn method on the smart contract.

Blockchain dApp: How end user use dApp without care of Ethereum Account

I want to develop a dApp (Smart Contract) on Ethereum and have a mobile application on top of it.
My concern is: every time we interact with Smart Contract to inquiry or change data, we need a account as well as a certain number of ETH used as Gas. It looks no problem on the development environment, but getting into trouble in real life, I mean about user experience (UX).
- Whenever a user download and install the app, we will create for them an Ethereum account. BUT where they can get ETH to interact with Smart Contract? And absolutely, they don't care and don't want to be bothered with exchange ETH.
I have an alternative solution: we have only 1 Ethereum account with some ETH in their and act as the Proxy to the Smart Contract. Whenever user's request come, we delegate the request to Smart Contract and return to user. BUT it seems we will lost the main characteristic of Blockhain: Decentralized :) Who know we might arbitrarily change the Smart Contract without user attention.
Any suggestion is appreciated. Thank you!
You can send some ether to each new user that is just enough to call your contract.

Convert Web App to Dapp for Blockchain Implementation

I have my web-application which is in Angular2(Front end) and Rails(back end- API), now I want to implement Blckchain to this application, so needs to make it Dapp.
Here while making the Dapp, do I need to remove the Rails Back-end and convert the business login into the smart-contracts(Ethereum)?
Do I need to require to choose the cloud storage platform like Storj, Decent for storing the data?
Please share any online material/blogs which can help me into this.
EDIT
This application is having more than 50 API's, so should I have to write the 50+ smart contract for each API? that means I need to remove the all Rails API code.
Ethereum Smart contracts don't have logins…
Here is one of the best resources I can give you:
what you want to do first is to understand how the smart contracts work from here:
https://medium.com/coinmonks/ethereum-smart-contract-development-with-a-web-app-part-1-develop-the-smart-contract-ee2a7c735936
then you need to understand how to store data on the Ethereum blockchain:
https://medium.com/#ConsenSys/an-introduction-to-ipfs-9bba4860abd0
Then last you can learn more about the DApps:
https://github.com/ethereum/wiki/wiki/Decentralized-apps-(dapps)
https://www.udemy.com/ethereum-dapp/

How Ethereum Blockchain based ICO token's distribution works?

I'm working on Ethereum ICO project, I studied Solidity and created a test token and deployed to Ethereum blockchain using MetaMask & Etherscan. but I'm not sure how to proceed further. I'm trying to connect different dots to achieve my goal. I have few questions related to ICO:
When launching an ICO, do we need to implement only ERC20 token standards into Smart Contracts or we need to write other logic's as well like how token buyers going to be benefited from this contract?
When investors send Ethers against ICO token, where to store those Ethers or how those Ethers can be managed so later all can be used for further development?
How to revert back Ethers if ICO goal is not reached?
How to transfer tokens to investors if ICO goal is reached?
Do we need Dapp for launching an ICO?
How contract manages tokens reserved for developers?
I studied Truffle but not sure how to use it for ICO launch?
It will be highly appreciated if anybody can guide me by replying all the above questions and share their personal experience launching an ICO.
Thanks in advance.
Its up to you but if you want people to be able to use your token in metamask / other exchanges to implement it you need to use ERC20 token, its tested and everyone knows how to implement
All depends on how you configure the contract but usually the person who lunch the contract will have access to the contract and can transfer the funds ... of course your contract your contract needs to be ownable in order to have such a properties enabled
You can do this by setting your crowdsale contract as RefundableCrowdsale
There is contract for crowdsale and in it, in distribution section you've options to transfer funds, essentially token is just a database with a list of wallets and how much of the wallet they own. meaning you don't really transfer anything and more like recording the name in the contract.
Not necessary, essentially investors just need to send ether to your contract.
I think that could be a a separate contract holding the fund for x amount of time before it gets released. The zeppelin-solidity seems to provide Tokenvesting.sol for this purpose.
Truffle is a framework, using industry standards of how you should deploy a contract it also helps with debugging
I would advice you to go through openzeppelin and by reading it you get a general idea of how everything works - helps with learning solidity

Copying a smart contract

If smart contracts are completely open source and viewable to the public, then what stops someone from copying someone else's work to create an exact copy of their service? Is the value a blockchain company can provide completely tied to the UX/UI of their application using a smart contract?
I'm thinking of a company like this (https://www.wageth.com/contract). The code is viewable on their site and they make a small profit by taking a cut of the prize pot that people contribute to. From what I understand, there is nothing stopping a competitor creating an exact copy of this game while routing the profit to a different wallet or account?
For this specific example the value of the organization is based on the brand loyalty of the users, the number of users, the fees, and addition of new features as new games are started. While the contract is open source, if you were to copy the source and deploy it on the ethereum network yourself, it would have a very different address and you would have to convince people to use your contract over the creator's. You would either have to offer lower fees, build a better brand, add more features or do better advertising. Similar to other markets.
The contract listed above "needs" to be open source because it adds a layer of transparency to the game. The maintainer(s) need to assure the participants that the contract functions the way they say it does and the best way to do that is to publish the contract source.
You could take the contract from your example and deploy it on a test network, verify that it functions as described and then participate in their deployed contract. Keep in mind that open source doesn't always mean free to use. If the contract is not published with a license that gives you permission to copy or deploy it, you likely don't have the legal right to do so just because they published the source code on line. (I'm no lawer)
Not all contracts need to be open source, while the compiled bytecode is stored on the chain, the source is not. You could copy the bytecode of a deployed close source contract and redeploy it. However, not being able to provide the source or possibly not having a full understanding of how the contract works could make it difficult to convince users to use the contract at the address you deployed over the "official" deployment.