Contract-Development

失去了我部署的合約程式碼。無論如何要看這個?

  • November 3, 2018

長話短說,我失去了我部署的合約程式碼。這被部署到實時網路。無論如何能夠查看已部署的契約程式碼的來源?

如果您知道實時網路上合約的地址,您可以獲取其字節碼並使用此工具進行反編譯https://github.com/comaeio/porosity以下是他們自述文件中的一個範例:

> porosity --abi $abi --code $code --decompile --verbose 0

Porosity v0.1 (https://www.comae.io)
Matt Suiche, Comae Technologies <support@comae.io>
The Ethereum bytecode commandline decompiler.
Decompiles the given Ethereum input bytecode and outputs the Solidity code.

Attempting to parse ABI definition...
Success.

Hash: 0x5FD8C710
function withdrawBalance() {
     if (msg.sender.call.gas(4369).value(store[msg.sender])()) {
        store[msg.sender] = 0x0;
     }
}


L3 (D8193): Potential reetrant vulnerability found.

LOC: 5
Hash: 0xC0E317FB
function addToBalance() {
     store[msg.sender] = store[msg.sender] + msg.value;
     return;
}


LOC: 4
Hash: 0xF8B2CB4F
function getBalance(address) {
     return store[arg_4];
}


LOC: 3

引用自:https://ethereum.stackexchange.com/questions/38765