Federation Node Onboarding
This guide walks you through the essentials for provisioning a new Agrinet federation node, syncing with the Mycelium network, generating McEliece keys, and wiring up a UI contract.
Prerequisites
- Node.js (v14 or newer)
- Git
- Yarn or npm
- Access to the repository
Clone the Repository
git clone https://github.com/NTARI-RAND/Agrinet.git
cd Fruitful
Install Dependencies
# With Yarn
yarn install
# Or with npm
npm install
Sync with Mycelium
- Create or update your
.envfile. - Add your node configuration:
MYCELIUM_NODE_NAME=your-node-name
MYCELIUM_PEER_URLS=https://peer1.example.com,https://peer2.example.com
MYCELIUM_PORT=7000
- Start the Mycelium node:
yarn mycelium:start
# or
npm run mycelium:start
nota
Monitor the logs and confirm that the node connects to at least one peer.
Generate McEliece Keys
Agrinet uses the McEliece cryptosystem for secure federation traffic.
node scripts/gen-mceliece.js
If no script is available, create one with node-mceliece:
scripts/gen-mceliece.js
const mceliece = require("node-mceliece");
const fs = require("fs");
const { publicKey, privateKey } = mceliece.keyPair();
fs.writeFileSync("keys/mceliece_public.key", publicKey);
fs.writeFileSync("keys/mceliece_private.key", privateKey);
console.log("McEliece key pair generated in /keys/");
precaución
Treat private keys as secrets and never commit them to version control.
Define a UI Contract
The UI contract captures how frontend clients interact with your federation node.
contracts/uiContract.js
/**
* UI Contract Example
* Describes methods exposed to the UI for interacting with the federation node.
*/
module.exports = {
authenticateUser: async (publicKey) => {
// implementation
},
requestSync: async () => {
// implementation
},
submitTransaction: async (transaction, signature) => {
// implementation
},
};
Integrate with the Frontend
- Call
authenticateUserwith the McEliece public key. - Trigger
requestSyncto keep data in sync via Mycelium. - Use
submitTransactionfor writes that require federation consensus.
Final Checklist
- Run tests
- Secure keys
- Wire the UI
- Execute end-to-end tests against at least one peer node.
- Confirm Mycelium log output reports a healthy connection.
- Store generated keys in a secure secrets manager.
- Rotate credentials on a regular cadence.
- Ensure your frontend calls the UI contract methods consistently.
- Document the API surface for downstream teams.
Welcome aboard the Agrinet federation! For questions, open an issue or reach out to the platform team.