Readonly Smart Contract Calls #1970
damip
started this conversation in
Smart contract engine
Replies: 4 comments 3 replies
-
How do you manage the "even if there is currently no block there" part ? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Opened a partner issue at #1977 |
Beta Was this translation helpful? Give feedback.
0 replies
-
updated with Greg's comments |
Beta Was this translation helpful? Give feedback.
0 replies
-
@damip Should we publish the spec in a markdown spec so the code can link to it? I guess we can also link to here... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Rationale
When using Massa in a Web3 context for example, one should be able to perform read-only Smart Contract calls.
See: https://ethereum.stackexchange.com/questions/765/what-is-the-difference-between-a-transaction-and-a-call/770
Massa implementation
API
Add a "sc_readonly_call" API endpoint
Parameters:
Vec<u8>
// bytecode to executeReturn value:
Vec<SCOutputEvent>
// output events generated during executionOperation
when the sc_readonly_call is called, the bytecode's main() function will be called with the following execution context:
during the call, everything happens as with a normal ExecuteSC call, but when the call finishes, its effects are rollbacked (like when a SC execution fails)
Beta Was this translation helpful? Give feedback.
All reactions