@challenges/shard-address
v0.2.2
Published
This project addresses the first challenge of the MultiversX Winter Coding Challenge by creating a fully functional CLI tool that simplifies the process of generating blockchain accounts across all shards and automating token requests from the faucet. The
Downloads
654
Readme
Here’s the README for your package, @challenges/shard-address
:
@challenges/shard-address
A CLI tool for generating shard-aware blockchain addresses and automating faucet requests on the MultiversX Devnet network. This package simplifies the process of creating accounts across all shards and requesting test tokens for them, providing developers with an efficient solution for blockchain testing.
Features
Shard-Aware Address Generation:
- Generates 3 unique accounts per shard (Shard 0, Shard 1, Shard 2).
- Ensures deterministic shard mapping for generated addresses.
Automated Faucet Requests:
- Requests test tokens from the faucet for all generated accounts in a single step.
- Returns transaction hashes for verification.
Developer-Friendly Output:
- Displays addresses, private keys, and transaction hashes in a clean JSON format.
- Saves the output to a file for reuse.
Installation
Install the package globally via npm:
npm install -g @challenges/shard-address
Or, run it directly with npx
:
npx @challenges/shard-address
Usage
1. Generate Addresses and Request Tokens
Run the CLI to generate addresses and request tokens:
npx @challenges/shard-address
The output includes:
- Generated addresses grouped by shard.
- Private keys for each address (This is for testing purposes only, do not use on mainnet!).
- Transaction hashes for the faucet requests.
Output Example
Below is a sample output from the tool, including transaction hashes and addresses:
{
"addresses": {
"0": [
{
"address": "erd10hyv4kc58j57lt9x3t3l44ptp57m8lzxsl6cunpep2mrhqwruqsqffxkta",
"privateKey": "f7a2830794ca7b134dbb0bde340cf4f40573e78a7bc8e4f8d599491193bc528a",
"mnemonic": "lava edge replace chronic skin water raw spend token stove approve bounce swamp wreck borrow wrong mixture gift dress hockey retreat tiger letter baby"
},
{
"address": "erd1jj0fmmjtj9whxqxrwtl0xa046a3te3a02yavrhsnmjgkylr7g47qsrqxh4",
"privateKey": "edc99d49c6ae9e90167248803cb0af1cff19f224154a58d9b4bf370faa8453af",
"mnemonic": "nest visual knee now beyond ridge adapt hour year option latin put cloth glow run chef scrub vacuum warm carpet chief dish bicycle often"
},
{
"address": "erd14kc8t2wpg88zy3dtsnj4u0sgayft5mvcf8tg9ptw6au6y50smruqt4lk5n",
"privateKey": "994c04a99693ba3c1f115e60ec2596d86c8348ae6b1b90f791ee327107f478d3",
"mnemonic": "pumpkin lonely heavy little brother bachelor birth identify torch vehicle lion split close cycle gentle depart little clock remind viable celery wear glue air"
}
],
"1": [
{
"address": "erd19shk3xak76un2m68lfef6t48mdk3y6w97vussa96k9vrh0s8kj0se83fg0",
"privateKey": "bede2d99a6a2cb36f9f3f3eff77be85ab6cb70555a97c5ff3d56ded66b404033",
"mnemonic": "club kitten cheap hospital high one rug young income truly prepare replace spell crunch blind grunt anchor place proof race room adult sponsor type"
},
{
"address": "erd16pueanxkfpnvc6k8tya5gc5f9n6rkm6l2nghqz7zh0fdde7gppqsfy27g4",
"privateKey": "9b817778e4900880e27e8fac7a7bd74f05db6ea97978b18e40d88a7d3c411eb8",
"mnemonic": "spare smooth rebel prosper major great prison twenty deputy cart pelican fly dry response later olive hybrid fun puzzle pizza hover tomato canal deliver"
},
{
"address": "erd15hwq6zx3kknfhwd6ats0z7js5j20pf8fj8zkyfzt7306wkf89zcstwcf9r",
"privateKey": "15b8528337c7aaa420f1d45728e7a2e537bea4e109a208df42a7f7e15605f386",
"mnemonic": "place there drama pet foil evidence tragic front thought mesh neither empty excuse fame play december giraffe car wonder satisfy intact near people cousin"
}
],
"2": [
{
"address": "erd1w2a8anp3qdp9t7e4flcfz76s5wqw8vdle470gzp2hxajc9gu0dnqp45t0s",
"privateKey": "091aa712bd227c607b335a3e979c629f8a7f57f5c3b572df5936dc42b15794ac",
"mnemonic": "increase stadium reason ginger crouch cliff under prepare vacuum mesh stage either athlete sugar you question village donor purpose iron scout mixed unique teach"
},
{
"address": "erd1q98zlunuv5u4et54t3wtrnpd4g5pmfnggu885mvp6z3m3aq0y3rqlalkj8",
"privateKey": "bb8747f65491250dfb0cf7837ce00b6aa093d7310479b27b5581bdad5ee3a7cb",
"mnemonic": "access imitate wish web fatal purity ripple process frequent mobile arena february limb spring patient tide kidney hire injury electric monster always much sound"
},
{
"address": "erd12677ay9h7wcjk4wfyvvmfr36k52wmsc4mu8m4hjx2wz7z82xty9q6u252g",
"privateKey": "1fcfb0b6db95901082d0d8b81f9996e7c5b9fe6e5126c4758509a1c085b6a906",
"mnemonic": "find urge picnic husband deposit noble fire caught boost piece modify health excite thunder first tiger river vendor neutral armed balcony permit goddess focus"
}
]
},
"faucetResponse": [
{
"hash": "c36f8f611ed8cb96d51de8a32d1d005a1013876a820d36bce5bfb7f5a70f5a84",
"address": "erd17jc9srpacdf08yw3hhzc5c8dstef3kw6588fd8ge95694jj448zscy62sw"
},
{
"hash": "671a52cb2d100ffaf9541e8f1f86bff0dd9ecf62c7fc666f02674d2c58366cdf",
"address": "erd1e5vtusj4kuz2e02yv7zdk8r2r9v9tgglrvqxvvmd3cw80s5996hq59zfuk"
},
{
"hash": "d4a628b05c1f0ea2d4c42b049b70e953306fa24758c0665e0aee629a82ea87fd",
"address": "erd156qu5eg3t7lg48xzuwe7r9u7auntgq8zuc0cprtcjcwrnh8vsz3qgkf6ef"
},
{
"hash": "79a79b332be0ecd2c0fa6ef931edf7722151b53b6c71239cd3c7a26a4500e64f",
"address": "erd10stms7uuxfh0zs3u6wklv8cgh7vyv8jhderrqmhz22qz8an6qnrqrkl5yz"
},
{
"hash": "f8aece6a7116e040749295bc6974ba614fa370215246370228a9e4258c299a66",
"address": "erd1r5unnm36qlhxpsm5fjnds22kdm9ytks0stupd3nzcadu46umnvmq0tkvrr"
},
{
"hash": "56febc8bfedd030c2b19ecf3174b3c212b451424c20404b28ce343a24f292d5e",
"address": "erd16k270n9dysfavded03zycjlps00w8axa888d64q62hxd0pcx84us5c25sm"
},
{
"hash": "e70020360683bf22a4315b5b5bf3ce015bcf08be810f550116d047b8b4703e31",
"address": "erd1ht3058ncc7s5rd2867qph4jznljxkeyweupykz6uxh9fcg6hpcxq8p7rsl"
},
{
"hash": "d28636425d308dc31ed38930366851688288ecf55f879ab5006bb0881515cfea",
"address": "erd1w9d0e7aata7jjf2ex64582pmm0ehzmyls4mh658zeuyt4m5z6j7svmk5xs"
},
{
"hash": "f09f06d8a6bd83f629f688e602b2ac01fda4c1351a1f75648e2b45569b36eac9",
"address": "erd1qqm7yg9mlymywujlf5pgfufjgyypqt5zttkzu0wtqyu89sr5exaqp5p94w"
}
]
}
Transaction Hashes
Here are the devnet transaction hashes for the generated accounts:
- Shard 0:
c36f8f611ed8cb96d51de8a32d1d005a1013876a820d36bce5bfb7f5a70f5a84
- Shard 1:
56febc8bfedd030c2b19ecf3174b3c212b45142c20404b28ce343a24f292d5e
- Shard 2:
e7002306083bf22a4315bb5b5f3ce015bcf08be810f550116d047b8b4703e31
License
This project is open-sourced under the MIT License.