I have created smart contract inside the /build/contracts and running this comman generates empty abi file.
eosiocpp -g eosio.test.abi eosio.test.cpp
tried both hpp and cpp but same result.
EOS.IO Stack Exchange is a question and answer site for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO. It only takes a minute to sign up.Sign up to join this community
When you're generating your ABI consider a few things:
Use the new command eosio-cpp
For example: eosio-cpp -I include -o my_contract.wasm my_contract.cpp -abigen
Use the C++ 11 attributes included in the newest EOSIO version such as [[eosio::action]], [[eosio::table]], [[eosio::contract]]
you need extra comments marked in hpp file to help eosiocpp generate concrete abi file. for actions, you need to add comment
above its declaration. for multi_index table, you need to add comment
//@abi table <underlying class or struct name> (i64|i32)
above the underlying class or struct definition.
This may be caused by an invalid contract name. If filename and contract class name do not match,
eosio-cpp does not generate the abi.
If your file has the name
foobar then your contract must also have the name
foobar. If this is not the case you need to specify the
Assuming your file is named
foobar.test.cpp and your contract name is
foobar, you need to compile with:
eosio-cpp -abigen fooobar.test.cpp -o foobar.wasm -contract=foobar