docs(examples): add an end-to-end Canopy guestbook dApp - #14
Open
CuriQusEth wants to merge 1 commit into
Open
Conversation
Adds examples/guestbook, a complete runnable appchain dApp built on this SDK: a Go plugin that defines a custom `post_message` transaction storing an append-only on-chain guestbook, and a React + TypeScript frontend that signs and broadcasts it with no backend. plugin/ is an overlay for canopy's plugin/go (verified against v0.1.22+beta), installed by install.sh with a backup of everything it replaces: - MessagePost / Post / PostCounter in proto/tx.proto, with the generated tx.pb.go shipped so protoc is not required to build - CheckTx validates a 20-byte author, valid UTF-8, non-empty content, and a 280 code-point limit; DeliverTx charges the fee, assigns the next id from a counter in state, and stamps the height from PluginDeliverRequest.Height - state prefixes 100/101, declared in CustomStatePrefixes and outside the core-reserved range; ids are big-endian in the key so a reverse range scan yields newest-first with no sorting - the plugin's own HTTP server exposes /v1/query/posts, /v1/query/post-counter and /v1/health, backed by the read-only QueryState path, with CORS so a browser can read the feed frontend/ is Vite + React + Tailwind, using the SDK's subpath imports: createProtobufEncoder + registerMessageType to teach it the plugin message, WalletManager over a localStorage keystore, NodePool for RPC failover, and createAndSignTransaction for the plugin msgTypeUrl/msgBytes format. The same client powers two node scripts (npm run post / npm run feed). Verified end to end against a local single-node chain: posts confirm on-chain with auto-incrementing ids, fees are deducted, over-long and empty content are rejected by CheckTx after mempool admission, and the browser flow was driven with Playwright at mobile, tablet and desktop widths. Also documents the example from the root README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds examples/guestbook, a complete runnable appchain dApp built on this SDK: a Go plugin that defines a custom
post_messagetransaction storing an append-only on-chain guestbook, and a React + TypeScript frontend that signs and broadcasts it with no backend.plugin/ is an overlay for canopy's plugin/go (verified against v0.1.22+beta), installed by install.sh with a backup of everything it replaces:
frontend/ is Vite + React + Tailwind, using the SDK's subpath imports: createProtobufEncoder + registerMessageType to teach it the plugin message, WalletManager over a localStorage keystore, NodePool for RPC failover, and createAndSignTransaction for the plugin msgTypeUrl/msgBytes format. The same client powers two node scripts (npm run post / npm run feed).
Verified end to end against a local single-node chain: posts confirm on-chain with auto-incrementing ids, fees are deducted, over-long and empty content are rejected by CheckTx after mempool admission, and the browser flow was driven with Playwright at mobile, tablet and desktop widths.
Also documents the example from the root README.