Smart Contract - How to Copy or Clone it?

All - new to Github and learning Solidity. Could someone tell me if it is possible to copy or obtain a smart contract that has been proven to work on the blockchain in the past. I have a block number and the smart contract, how do I get the exact code used in that contract? Thanks.

Hey @kkrypto,

If you go to a blockchain explorer like for Ethereum, you can pull up the contract code for a given address. For example, here’s how to view the deployed CryptoKitties contract:

CryptoKitties smart contract: CryptoKitties: Core | 0x06012c8cf97bead5deae237070f9587f8e7a266d has a ton of useful features and tools + works with test networks as well.

Thanks @loganbek - unfortunately Etherscan is not providing code info for the contract I am looking for. I’m getting tabs for Decompile Bytecode, Switch to Opcodes View and Similar Contracts.
Screenshot 2021-05-24 111033

@loganbek - it seems the contract I have been looking at is not verified. so I’ll not be able to see the code. It’s not verified like the CryptoKitties you sent, thanks.

1 Like

Hey kkrypto,

Depending on what you’re trying to do with the contract, this could be helpful: Online EVM Bytecode Decompiler. Also I’ve seen this recommendation as well: Eveem. I think some decompilers do alright on simple contracts but most are going to struggle on anything complex and none are perfect from what I understand. If you just want to get a general idea of the contract it may be worth a shot though.

@loganbek - thanks, there is limited info even with these links. The source code is simply not available, but no worries as I have the basic steps the contract took. Thanks for the both links, I’ll tuck them away.

1 Like