putState?
See original GitHub issueIs there a built-in parser, analogous to putState (formerly, setState) in Parsec that sets the user state and returns nothing? Is there a mechanism to replace user state without performing an explicit mutation/side effect (e.g., userState.tags.push(...) like in the examples in the readme)?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Hyperledger Fabric SDK for node.js Class: ChaincodeStub
The resulting composite key can be used as the key in putState(). Hyperledger Fabric uses a simple key/value model for saving chaincode states....
Read more >PutState and GetState: The API in Chaincode ... - KC Tam
Overview. Ledger in Hyperledger Fabric is composed of two parts: blockchain of transaction records and world state (link).
Read more >shim - Go Packages
Package shim provides APIs for the chaincode to access its state variables, transaction context and call other chaincodes.
Read more >Chaincode for Developers - Hyperledger Fabric Docs
A chaincode can be invoked to update or query the ledger in a proposal transaction. Given the appropriate permission, a chaincode may invoke...
Read more >Fail to putstate in hyperledger-fabric - Stack Overflow
The data is not written to the ledger when PutState() is called. The chaincode execution produces a peer endorsement to write some data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mgreenbe Interesting! I never really thought about reverting user state. And yeah, you’re right, it’s probably not possible unless I allow replacing user state in the first place.
Now that I see the reasoning, it’s definitely something I’ll add. The two techniques can be complementary.
My reasoning is twofold: A
putStateparser would make it really simple to port things from (F)Parsec. Second, I’d likeuserStatestate to revert if the parser needs to backtrack, and that won’t happen automatically if I’m always mutating it in place (right?).