Respuesta JSON RPC no válida: "400 Bad Request" en Simple Embark Dapp

soy nuevo en Embark, siguiendo mi primer tutorial aquí en https://hackernoon.com/how-to-create-a-token-factory-with-ethereum-part-1-85e84d1f38fc

Cuando ejecuto lo siguiente en la consola

Token._supply().toNumber()

me sale el error

Respuesta JSON RPC no válida: "400 Solicitud incorrecta".

¿Qué hice mal?

Hasta ahora, esto es lo que hice

  1. embark new TokenFactory&&cd TokenFactory
  2. embark blockchain
  3. embark run
  4. Contrato de solidez añadido aapp/contracts/token.sol

Luego, en la consola de embarque, ejecuté el comando Token._supply().toNumber().

ingrese la descripción de la imagen aquí

ficha.sol

pragma solidity ^0.4.8;
contract Token {

  event Transfer(address indexed from, address indexed to, uint value);
  event Approval( address indexed owner, address indexed spender, uint value);

  mapping( address => uint ) _balances;
  mapping( address => mapping( address => uint ) ) _approvals;
  uint public _supply;
  function Token( uint initial_balance ) {
    _balances[msg.sender] = initial_balance;
    _supply = initial_balance;
  }
  function totalSupply() constant returns (uint supply) {
    return _supply;
  }
  function balanceOf( address who ) constant returns (uint value) {
    return _balances[who];
  }
  function transfer( address to, uint value) returns (bool ok) {
    if( _balances[msg.sender] < value ) {
      throw;
    }
    if( !safeToAdd(_balances[to], value) ) {
      throw;
    }
    _balances[msg.sender] -= value;
    _balances[to] += value;
    Transfer( msg.sender, to, value );
    return true;
  }
  function transferFrom( address from, address to, uint value) returns (bool ok) {
    // if you don't have enough balance, throw
    if( _balances[from] < value ) {
      throw;
    }
    // if you don't have approval, throw
    if( _approvals[from][msg.sender] < value ) {
      throw;
    }
    if( !safeToAdd(_balances[to], value) ) {
      throw;
    }
    // transfer and return true
    _approvals[from][msg.sender] -= value;
    _balances[from] -= value;
    _balances[to] += value;
    Transfer( from, to, value );
    return true;
  }
  function approve(address spender, uint value) returns (bool ok) {
    // TODO: should increase instead
    _approvals[msg.sender][spender] = value;
    Approval( msg.sender, spender, value );
    return true;
  }
  function allowance(address owner, address spender) constant returns (uint _allowance) {
    return _approvals[owner][spender];
  }
  function safeToAdd(uint a, uint b) internal returns (bool) {
    return (a + b >= a);
  }
}

Registros

========================
Welcome to Embark 2.6.0
========================
Building Assets
loading solc compiler..
compiling contracts...
token.sol:10:3: Warning: No visibility specified. Defaulting to "public".
  function Token( uint initial_balance ) {
  ^
Spanning multiple lines.

token.sol:14:3: Warning: No visibility specified. Defaulting to "public".
  function totalSupply() constant returns (uint supply) {
  ^
Spanning multiple lines.

token.sol:17:3: Warning: No visibility specified. Defaulting to "public".
  function balanceOf( address who ) constant returns (uint value) {
  ^
Spanning multiple lines.

token.sol:20:3: Warning: No visibility specified. Defaulting to "public".
  function transfer( address to, uint value) returns (bool ok) {
  ^
Spanning multiple lines.

token.sol:22:7: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

token.sol:25:7: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

token.sol:32:3: Warning: No visibility specified. Defaulting to "public".
  function transferFrom( address from, address to, uint value) returns (bool ok) {
  ^
Spanning multiple lines.

token.sol:35:7: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

token.sol:39:7: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

token.sol:42:7: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

token.sol:51:3: Warning: No visibility specified. Defaulting to "public".
  function approve(address spender, uint value) returns (bool ok) {
  ^
Spanning multiple lines.

token.sol:57:3: Warning: No visibility specified. Defaulting to "public".
  function allowance(address owner, address spender) constant returns (uint _allowance) {
  ^
Spanning multiple lines.

token.sol:60:3: Warning: Function state mutability can be restricted to pure
  function safeToAdd(uint a, uint b) internal returns (bool) {
  ^
Spanning multiple lines.

deploying contracts
Token already deployed at 0x4dbe9239321ddf4eae6eb32f83c1a50d3c426510
finished deploying contracts
writing file dist/css/app.css
writing file dist/js/app.js
writing file dist/index.html
Watching for changes
ready to watch file changes

Respuestas (1)

Ese tutorial es para la versión 2.5.2 de embarque y no es compatible con la versión 2.6.0; para que funcione con 2.6.0, debe convertir las llamadas js a web3.js 1.0 y actualizar el código del contrato para que sea compatible con la última versión de solc. El tutorial se actualizará en algún momento para reflejar los cambios realizados en 2.6.0.

Me pregunto si conoce alguna buena guía para portar web3.js beta a la versión 1.0.