Ensure read-only transactions

Closes #2142
Merge pull request #2305 from strk/master-readonly

Ensure read-only transactions