Save data in transaction generated through a smart contract

Hi @Khenfouci_Yamina,

I am not sure what you mean by not being able to sign transactions with one private key? It might help if you could describe the process flow in more detail.

As you have said, only externally owned accounts can initiate transactions.
Though a third party could be used to initiate a transaction. (An example in DeFi is Scheduled Dapp Interactions - time based first, anything else will follow).

To start playing with smart contracts you could use a simple contract that currently stores just one value. Remix can be used as a playground.

Box.sol

pragma solidity ^0.5.0;

contract Box {
    uint256 private value;

    // Emitted when the stored value changes
    event ValueChanged(uint256 newValue);

    // Stores a new value in the contract
    function store(uint256 newValue) public {
        value = newValue;
        emit ValueChanged(newValue);
    }

    // Reads the last stored value
    function retrieve() public view returns (uint256) {
        return value;
    }
}