Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Method Deprecated #3366

Closed
1 task done
DsEsteban opened this issue Dec 4, 2017 · 3 comments
Closed
1 task done

Method Deprecated #3366

DsEsteban opened this issue Dec 4, 2017 · 3 comments

Comments

@DsEsteban
Copy link

DsEsteban commented Dec 4, 2017

  • I've asked for help in the Mist Gitter before filing this issue.
Version: `0.4.2`
OS & Version: linux
Node version: `geth 0.4.0` 
Number of blocks synchronized: 99%

pragma solidity ^0.4.2;

Hello, im using this contract for practicing reasons. It's the simplest one i found...

contract MyToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;

/* Initializes contract with initial supply tokens to the creator of the contract */
function MyToken(
    uint256 initialSupply
    ) {
    balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
}

/* Send coins */
function transfer(address _to, uint256 _value) {
    require(balanceOf[msg.sender] >= _value);           // Check if the sender has enough
    require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
    balanceOf[msg.sender] -= _value;                    // Subtract from the sender
    balanceOf[_to] += _value;                           // Add the same to the recipient
}

}

... and im getting in : wallet.ethereum.org, this error:

Could not compile source code.

Error: Method deprecated

What can i do? whats wrong with it?

This is the one at https://ethereum.org/token#minimum-viable-token, it should work, isnt it?

thx for any help

@alexvandesande
Copy link

Thanks for this. I made a pull request to change the code on the .org website.

@brandoncurtis
Copy link

For anyone else who also encounters this issue and wonders what's going on...

According to this document: ethereum/ethereum-org@73168f8

This is the rationale behind the changes:

* Add necessary 'public' to function in tutorial

Without adding 'public' to that line of code, Ethereum Wallet returns the error:

No visibility specified. Defaulting to "public".
    function Token(uint256 initialSupply)  {
    ^
Spanning multiple lines.

Proposing to add that in so tutorial takers don't run into this error, get confused, etc.

This is needed due to some changes in the Solidity compiler... but it's fixing a different issue than the one reported by @DsEsteban above.

The Reported Issue

I can reproduce this issue by connecting https://wallet.ethereum.org to a local Parity node, v1.10.0.

Copying the newly updated contract... or any contract, valid or not, still gives this error on https://wallet.ethereum.org:

image

The wallet is probably making an eth_compileSolidity RPC call to the node, so let's try it with curl and make sure it's working that way:

$ curl -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_compileSolidity","params":["/* some code */"],"id":1}' http://kovan.tokenpla.net
{"jsonrpc":"2.0","error":{"code":-32070,"message":"Method deprecated","data":"Compilation of Solidity via RPC is deprecated"},"id":1}

Ah! So compilation via RPC is deprecated.

This is actually an EIP: ethereum/EIPs#209

The compile RPC methods were removed from Parity in February 2017: openethereum/parity-ethereum#4577
and they were removed from Geth in March 2017: ethereum/go-ethereum#3740

It looks like, when Meteor-Dapp-Wallet is running in the Mist browser locally, it uses your local path solc Solidity compiler to make this work (ethereum/meteor-dapp-wallet#461). Now that these compile RPCs are gone, I guess that means that the contract-compiling functionality on https://wallet.ethereum.org can't ever work again?

Clarification appreciated!

@github1github2
Copy link

github1github2 commented Nov 5, 2018

screen shot 2018-11-04 at 8 53 41 pm

@alexvandesande The error is still occurring unless you change the name of the function so that it doesn't match the contract name, which, is different than how it's explained here:

https://ethereum.org/token#the-code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants