Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.77 KB

File metadata and controls

60 lines (43 loc) · 1.77 KB

Scale Codec in Golang

Scale Codec written by golang, reference from polkascan/py-scale-codec.

Features

  • Decode
  • Encode
  • Metadata decode(V11,V12,V13,V14)
  • Extrinsic decode
  • EventRecord decode
  • Custom type reg
  • Reg special version type

Versioned transaction extensions

V5 general extrinsics (0x45) select their extension layout from V16 metadata using transaction_extension_version. Decoding exposes the account and signature from VerifyMultiSignature, along with nonce, era, tip, and the transaction hash. The extension values are retained for byte-for-byte re-encoding, including None options. V4 signed extrinsics use the version-zero layout.

Supply V16 metadata from the matching runtime when decoding a nonzero extension version. V14/V15 metadata only describes version zero; unsupported versions and invalid extension indexes fail explicitly instead of attempting the wrong layout. As with other invalid SCALE input, ExtrinsicDecoder.Process reports decode failures by panicking; GenericExtrinsic.Encode returns an error for missing or unsupported extension layouts. V16 view function IDs are decoded as 32 bytes.

Installation

go get -u github.com/itering/scale.go

Test

go test ./... --cover -v 

Docker

docker build -t scale_go .
docker run -it scale_go

Resources

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/itering/scale.go

License

The package is available as open source under the terms of the MIT License.