Small JAM services built from the Gray Paper and the polkavm crates only, without the JAM SDK. They give JAM clients a known blob, a known input and a known result to check refine and accumulate end to end.
The services target Gray Paper v0.8.0 (polkavm 0.37). The v0.7.2 versions are at tag
gp-0.7.2.
There is no v0.8.0 genesis chain spec yet. Install the service at runtime with jamt (tested with jamt 0.1.29 on a local network of v0.8.0 nodes):
jamt create-service blobs/hash_chain.jam --raw # prints the new service id, e.g. 00000001
jamt transfer 1 1000000000 # balance for the storage write
jamt item 1 "hello jam"
jamt inspect storage 1 0xd582eb39b397d24e5d14d935fbc08ffe533ed47fd559ee697c6669e6547ba461
The transfer matters: without enough balance the storage write in accumulate fails and the value never appears.
chainspecs/tiny.json, blobs/null_authorizer.pvm and tools/genesis.exs are still the
v0.7.2 genesis set (service 7 in a JIP-4 tiny chain spec) and do not run on v0.8.0 nodes.
- Refine: hashes the payload 1000 times with Blake2b-256 and returns the 32-byte result.
- Accumulate: stores that result in service storage under the Blake2b-256 hash of the payload.
Check, with the payload hello jam:
| refine output | b6ba2c4f8af4c504711a66f5f39921c8222da18e55de018a9911233237e21ed4 |
| storage key | d582eb39b397d24e5d14d935fbc08ffe533ed47fd559ee697c6669e6547ba461 |
| storage value | the refine output |
The refine output and the storage key are the same as at v0.7.2: the service logic did not change, only the host-call numbers (fetch = 2, write = 5) and the instruction set.
Needs nightly Rust with rust-src.
./build.sh hash_chain # writes blobs/hash_chain.jam
Apache-2.0, see LICENSE.