Steps to create your own mining source that can be used to mine artifacts on Alex. We are paying out bounties of up to $30 AR for successful mining source implementation and documentation.
Here are the steps to search for suitable mining sources and implement them into the Alex CLI: arc-pools.
- Availability of a web API: An API is an interface provided by platforms like Twitter, which allows for external applications to interact with their data.
- It is best if the API output is available in HTML or JSON to utilize existing Alex tooling.
- Large number of API requests for free (~100 a day minimum).
- Full content can be accessed for free.
- Legally allowed to archive source content (review terms of use of source).
The goal of this bounty is to modify the Alex miner available in the arc-pools repository to add a new mining source.
- NodeJS (v18)
- NPM and Git installed.
- Fork arc-pools on GitHub.
git clone <url_of_the_forked_repo>
git checkout <new-branch>
-
Add a new source to the mine command.
a. Open
src/helpers/config.ts
, add in to the section that definesCLI_ARGS.sources
sources: { ..., yourNewSource: { name: 'yourNewSource' } },
b. Open
src/command/mine.ts
, modify the switch statement to handle your new source:switch (source) { ... rest of the switch statement case CLI_ARGS.sources.yourNewSource.name: console.log('Mining new source'); return; case CLI_ARGS.sources.all.name: await all.run(poolConfig); return; default: exitProcess(`Source Not Found`, 1); }
-
Add a new miner.
a. Copy the
src/miners/wikipedia
directory into a new directorysrc/miners/yourNewSource
.b. Remove the file
src/miners/yourNewSource/index.ts
.c. Open
src/miners/yourNewSource/miner.ts
and edit the code:import { PoolClient, PoolConfigType } from 'arcframework'; import { log } from '../../helpers/utils'; export async function run(poolConfig: PoolConfigType) { const poolClient = new PoolClient({ poolConfig }); log(`Mining Your new source...`, 0); }
d. Now open
src/commands/mine.ts
and import your new miner:import * as yourNewMiner from '../miners/yourNewSource/miner';
d. And edit the switch case you added earlier to call the miner:
case CLI_ARGS.sources.yourNewSource.name: yourNewMiner.run(poolConfig); return;
-
First, create a new pool if you have not already:
ts-node src/index.ts init yourNewPool
-
Configure the pool as described here.
-
Now create the pool:
create yourNewPool --control-wallet <PATH_TO_WALLET.json>
-
Now run the miner against your new pool:
ts-node src/index.ts mine <pool_id> --source yourNewSource
You should see your output from within the
miner.ts
file. Now you should modifyminer.ts
to pull data from an external API of your choosing and push it to Alex. View the otherminer.ts
files for examples on pushing the data to Arweave/Alex. The main facility provided by arc-pools currently for doing this is thecreateAsset
function. Import it and call it in your miner with the data you would like to upload. For uploading many assets, call it in a loop with different assets.import { createAsset } from '../../api';
-
Check TX output from CLI in Sonar.
Push your code to your Fork when ready. To collect a bounty, your source must take assets from an external source of your choosing and successfully push them to Alex. Also your source API and code will have to be approved by the team which will be indicated by an approved and merged PR.
- Open a pull request in arc-pools from your fork.
- Drop a link to the PR in the feature-requests channel of our Discord
- Please give us 5-10 days to review and test the mining source.
- If your pull request is implemented in arc-pools (Alex-Alex Archive) will message you on Discord about sending your reward.