paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.8k stars 652 forks source link

Merklized Distribution Helper Util #5631

Open shawntabrizi opened 3 weeks ago

shawntabrizi commented 3 weeks ago

This is a simple util to generate a merklized distribution using a CSV input.

Related to #5400

Example input:

account,balance,proof
14E5nqKAp3oAJcmzgZhUD2RcptBeUBScxKHgJKU4HPNcKVf3,1000,true
14Gjs1TD93gnwEBfDMHoCgsuf1s2TVKUP6Z1qKmAZnZ8cW5q,2000,false
15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5,3000,true
126TwBzBM4jUEK2gTphmW4oLoBWWnYvPp8hygmduTr4uds57,4000,false
16D2eVuK5SWfwvtFD3gVdBC2nc2BafK31BY6PrbZHBAGew7L,12345678,true

Example output:

Trie Root: 0x7e9538fa260a6c323313239d642188b493431d2b8b604f2ef30b420022192f3d

Creating proof for account: 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
Amount Claimable: 1000
Proof Bytes: 0x08210280086380f9ac6cd8a0740d54548afbda2f243d020dd8a890885abdb9b314cc24dd22fab20080321f89ae9823b69aa0d8c75aef2131d91d9d11f8e20bf07361eeadd19673d0d380bcb4b29c3f2034e8295f09e44bf67beaeb43dee5c76a813741133c65f141a0fe801f88322700af302bcd7fffef3e454c98eebd45146fe2bc28d20f38e3badcad678c7f000eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a4800

Creating proof for account: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
Amount Claimable: 3000
Proof Bytes: 0x08210280086380f9ac6cd8a0740d54548afbda2f243d020dd8a890885abdb9b314cc24dd22fab280fd412f6290402804ce4c055adac70271d04ee034e0c508fe5028a29fbd970ca180321f89ae9823b69aa0d8c75aef2131d91d9d11f8e20bf07361eeadd19673d0d300801f88322700af302bcd7fffef3e454c98eebd45146fe2bc28d20f38e3badcad678c7f00043593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d00

Creating proof for account: 5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw
Amount Claimable: 12345678
Proof Bytes: 0x08210280086380f9ac6cd8a0740d54548afbda2f243d020dd8a890885abdb9b314cc24dd22fab280fd412f6290402804ce4c055adac70271d04ee034e0c508fe5028a29fbd970ca180321f89ae9823b69aa0d8c75aef2131d91d9d11f8e20bf07361eeadd19673d0d380bcb4b29c3f2034e8295f09e44bf67beaeb43dee5c76a813741133c65f141a0fe008c7f000659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e00
shawntabrizi commented 3 weeks ago
Screenshot 2024-09-06 at 10 27 58 PM

Works end to end :)