Official Go implementation of ChainScript. This is the recommended way to use ChainScript in your Go projects.
However, it is opinionated and tries to keep the application data as abstract
as possible. Some applications will have different requirements and might
want to optimize for specific use-cases. If you are in that case, don't
hesitate to implement your own ChainScript library.
If you do so, don't forget to set the
client_id field to make it easy for
others to deserialize and validate your data.
The ChainScript definitions are imported as a
Changes to the protobuf files should be done in the
To get the latest ChainScript definitions in this project, run:
Note that when you update the git subtree, you must not squash your commits when merging to the master branch, otherwise the subtree update will fail because it will be unable to find the previous subtree commit.
Compile the new protobuf definitions:
Fixing JSON struct tags
If the protobuf compiler added json tags (
json:"map_id") to your structs,
you might need to manually fix them if you want to be fully compatible with
Those tags create an issue for fields that contain an underscore in the proto definitions. For such fields you'll need to manually update the generated go file until the protobuf compiler provides configuration options to generate json tags properly.
The fix is simple: track all your snake_case fields and update the
json:"snake_field" struct tag to
When updating dependencies (go-crypto, canonical-json, etc) we must stay backwards-compatible. That means that each dependency update should thoroughly check whether it introduces breaking changes in the serialized data. If it does, the version of some fields (link, signature) needs to be updated accordingly.