2

https://developers.eos.io/eosio-home/docs/sending-an-inline-transaction-to-external-contract

In above tutorial, I can see that 'addressbook' send notofication message to 'abcounter', but the data(notification message) is just a string not actual contract data.

What I'm trying to do is send a contract data(fisrt name, last name, street, city, state) to abcounter (to make people_backup table in abcounter).

I see there are examples that sends action to other contract but no data.

Is it possible to send contract data to other??

1 Answer 1

3

Take a look at inline actions (executed in the same transaction) or deferred transactions (executed in another transaction.

Inline Actions

The link refers to the official developer portal. Inline actions will execute in the same transaction as the initiating action. If the inline action fails the whole transaction will fail. These actions also count to the transaction time limit, so keep an eye on the execution time.

I guess an important code snippet is to make a tuple for your action's data:

std::make_tuple(first_name, last_name, street, city, state)

Deferred Transactions

The link refers to another thread on this Exchange. These transactions are completely new transactions which may be included in another block. There is also no guarantee that these will be executed. So keep an eye if your action actually gets triggered.

If you combine these clever you can perform mighty interactions between smart contracts. E.g. your contract's action sends an inline action to a write to another contract which will perform another deferred transaction that will notify the original contract on so on.

2
  • what about with authorization of user pushing the action??? Commented Aug 7, 2020 at 19:14
  • This is depending on the desired functionality of your contracts. You can read about authorization here
    – tmm
    Commented Aug 10, 2020 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.