I am following along the tutorial on the EOS website at https://developers.eos.io/eosio-home/docs/your-first-contract
At the first smart contract development section, I cannot manage to publish the simplest hello world contract. Here is the error message I face:
[******** hello]$ cleos set contract hello . -p hello@active
Reading WASM from /home/*****/eos/contracts/hello/hello.wasm...
Publishing contract...
Error 3070003: Serialization Error Processing WASM
Error Details:
invalid index: localIndex>=locals.size()
pending console output:
[******** hello]$
My hello.cpp is as follows:
#include <eosio/eosio.hpp>
using namespace eosio;
class [[eosio::contract]] hello : public contract {
public:
using contract::contract;
[[eosio::action]]
void hi( name user ) {
print( "Hello, ", name{user});
}
};
(By the way, the tutorial website seems slightly unclear on whether it should be print( "Hello, ", name{user});
or print( "Hello, ", user);
)
I have also noticed that eosio-cpp -abigen -o hello.wasm hello.cpp
will hang forever and needs to be terminated manually with ctrl+c. This seems similar to https://github.com/EOSIO/eosio.cdt/issues/123
The suggested fixe mentions having a 2-core CPU, which I have set my VM to use already.
However, in my case, hello.abi and hello.wasm ARE generated, In which case I continue and then run into the error message mentioned at the beginning.
I have noticed that when I run cat hello.wasm
, I can read the following among all the messy characters :
>A▒▒
!failed to allocate pagesHello, A▒▒
Here some info about my setup :
[*** hello]$ eosio-cpp --version
eosio-cpp version 1.6.0
[*** hello]$ eosio-abigen --version
eosio-abigen version 1.6.0
[*** hello]$ nodeos --version
v1.7.0
[*** hello]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
How can I fix this and complete the EOS tutorial?