简体   繁体   中英

Unknown action hi in contract error while deploying smart contract on testnet

I am tring to deploy contract on testnet http://api.kylin.alohaeos.com . I have following hello2.cpp program

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>

using namespace eosio;

class suniltestacc : public contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( name user ) {
              //require_auth( user );
              //print( "Hello, ", name{user} );
                print( "Hello, ", user);
      }
};

EOSIO_DISPATCH(suniltestacc, (hi))

I compiled this program using eosio-cpp -o hello2.wasm hello2.cpp --abigen . It gives me two warnings which I ignored.

Warning, empty ricardian clause file
Warning, empty ricardian clause file

Then I execute cleos -u http://api.kylin.alohaeos.com set contract suniltestacc /home/varsha/Varsha/contracts/hello2 This runs successfully, after that I am trying this command

cleos -u https://api.kylin.alohaeos.com push action suniltestacc hi '["bobmarley"]' -p suniltestacc@active

It is giving me error

error 2019-01-22T08:10:35.520 thread-0  main.cpp:3449                 main                 ] Failed with error: Assert Exception (10)
!action_type.empty(): Unknown action hi in contract suniltestacc.

Can somebody help me with this.

There is nothing wrong with this, Its all working fine.

Below is the result when i called your function.

cleos -u https://api.kylin.alohaeos.com push action suniltestacc hi '["bobmarley"]' -p doslnjslongd@active

executed transaction: 8faa9669ed143c979afa842489dafdfc610e0c6ad4f2831039a170448f867835 104 bytes 134 us

suniltestacc <= suniltestacc::hi {"user":"bobmarley"}

warning: transaction executed locally, but may not be confirmed by the network yet ]

Let me know if i can help you further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM