Hi, is that possible to sign a message from smart contract not an account? For example In contract B I want to check that this message is signed by contract A.

May 13, 2023, 8:16 AM
Not exactly sign, but you can change a state variable or something that can be used as a marker/unique signal to check if a contract A has done something directly from Contract B
May 13, 2023, 8:51 AM
Actually I want to get hash from a contract offchain (call function), and pass that hash to another contract. But I'm worry that users change that hash and pass a wrong hash. So I want to be sure that this hash is returned from true contract.
I want just call data from first contract not changing any state and pay gas.
May 13, 2023, 8:57 AM
directly call the hash from the contract to the contract
it will cost gas if it's write function and onchain, make it a view function
is the call function on the contract A a public function?
May 13, 2023, 9:06 AM
The reason that I want to call that offchain is that this funcion is searching in 1000 data and and extract couple of them. And when you call this funcion onchain yyou have to pay gas for reading these 1000 data (however it's veiw). But If you call this view function offchain you don't pay gas for reading data
May 13, 2023, 9:08 AM
dm me the contract a in question, I'll have to take a look
May 13, 2023, 9:08 AM
you consume gas anyway
May 13, 2023, 9:09 AM
or send here
May 13, 2023, 9:09 AM
No if you read data offchain you won't pay gas, but if you read data onchain in a sending transaction you should pay gas for reading data
May 13, 2023, 9:11 AM
the Solidity contract you're trying to deploy
no, make the function that calls the view function view also, it'll be same
May 13, 2023, 9:12 AM
did I say "pay" ?
May 13, 2023, 9:12 AM
like this

on the contract that calls :

address contractA;

function.... view returns(datatpe){
return Contract A.funtiontocall}
make the interface to make the call externally
May 13, 2023, 9:13 AM

© 2024 Draquery.com All rights reserved.