Skip to content

Update solana #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file removed nodes/misc/solana/UserKeypair.json
Empty file.
6 changes: 6 additions & 0 deletions nodes/misc/solana/client-executable/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MNEMONIC =

CLUSTER =

// If needed
CUSTOM =
249 changes: 249 additions & 0 deletions nodes/misc/solana/client-executable/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
# NetSepio Node Management CLI

A command-line tool for managing nodes on the Solana blockchain using the NetSepio program. This tool provides both user and admin functionalities for node registration, management, and NFT operations.

## Prerequisites

- Node.js installed
- Solana CLI tools installed and configured
- A funded Solana wallet (devnet)
- Required npm packages:
```bash
npm install @solana/web3.js @coral-xyz/anchor
```

## Installation

1. Clone the repository
2. Install dependencies:
```bash
npm install
or
yarn
```

## Available Commands

### User Commands (netsepio_user.js)

#### Register a Node

Register a new node with the NetSepio program.

```bash
./netsepio-user-linux registerNode <nodeId> <name> <nodeType> <config> <ipaddress> <region> <location> <metadata> <owner>
```

Parameters:

- `nodeId`: Unique identifier for the node
- `name`: Name of the node
- `nodeType`: Type of node (e.g., validator, edge)
- `config`: JSON string with node specifications
- `ipaddress`: IP address of the node
- `region`: Geographic region
- `location`: Physical location description
- `metadata`: JSON string with additional metadata
- `owner`: Solana wallet public key that will own this node

Example:

```bash
./netsepio-user-linux registerNode \
"node-$(($RANDOM % 10000))" \
"Zoro" \
validator \
'{"cpu":"16 cores","memory":"64GB","disk":"5TB"}' \
34.92.123.456 \
us-east \
"New York, NY" \
'{"version":"2.0.1","lastUpdate":"2023-06-15"}' \
"EdPJtnunTwxQLo3FCNWN464VLJMb4B6LhBN2HrbAYKpD"
```

#### Create Checkpoint

Create a checkpoint for a node.

```bash
./netsepio-user-linux createCheckpoint <nodeId> <checkpointData>
```

Example:

```bash
./netsepio-user-linux createCheckpoint node-1234 '{"timestamp":"2023-05-15T12:00:00Z","status":"healthy","metrics":{"uptime":"99.9%","cpu":"45%","memory":"60%"}}'
```

#### Deactivate Node

Deactivate a registered node.

```bash
./netsepio-user-linux deactivateNode <nodeId>
```

Example:

```bash
./netsepio-user-linux deactivateNode node-1234 CollectionPublicKeyHere
```

#### Force Deactivate Node
```bash
./netsepio-user-linux forceDeactivate <nodeId>

```
Example:

```bash
./netsepio-user-linux forceDeactivate node-1234
```

#### Get Node Data

Retrieve information about a registered node.

```bash
./netsepio-user-linux getNodeData <nodeId>
```

Example :

```bash
./netsepio-user-linux getNodeData node-1234
```

#### CHECK BALANCE

Check your SOL balance for the keypair address.

```bash
./netsepio-user-linux checkBalance
```

### Admin Commands (netsepio_admin.js)

#### INTIALIZE GLOBAL CONFIG

ADMIN WILL INTIALIZE THE GLOBAL CONFIG

```bash
node netsepio_admin.js intializeGlobalConfig
```

#### Create Collection

Create a new NFT collection.

```bash
node netsepio_admin.js createCollection <collectionName> <collectionUri>
```

Example:

```bash
node netsepio_admin.js createCollection NetSepio www.exampleuri.com
```

#### Mint NFT

Mint a new NFT for a node.

```bash
node netsepio_admin.js mintNFT <nodeId> <nftName> <nftUri> <owner>
```

Example:

```bash
node netsepio_admin.js mintNFT node-6909 CyberPunk1 "www.exampleuri.com" EdPJtnunTwxQLo3FCNWN464VLJMb4B6LhBN2HrbAYKpD
```

#### Update Metadata

Update NFT metadata.

```bash
node netsepio_admin.js updateMetadata <newNftUri>
```

#### Update Node Status

Update the status of a node.

```bash
node netsepio_admin.js updateNodeStatus <nodeId> <newStatus>
```

## Node Status Values

The node status can be one of the following:

- `0`: OFFLINE
- `1`: ONLINE
- `2`: MAINTENANCE

## Keypair Management

The scripts use keypair configuration from the .env file:

- Add your Keypair to .env as follows:
- For user operations: `USER_KEY=[your_private_key_array]`
- For admin operations: `ADMIN_KEY=[your_private_key_array]`
- For collection operations: `COLLECTION_KEYPAIR=[your_collection_keypair_array]`
- If no private key is provided, the script will exit with an error

## Network Configuration

The network connection is configured through the .env file:

- Set `CLUSTER` to one of the following values:
- `LOCALNET`: Connect to local Solana node (http://127.0.0.1:8899)
- `DEVNET`: Connect to Solana devnet (https://api.devnet.solana.com)
- `TESTNET`: Connect to Solana testnet (https://api.testnet.solana.com)
- `CUSTOM`: Connect to custom RPC endpoint specified in `CUSTOM_RPC`
- For custom RPC connections, set `CUSTOM_RPC` to your RPC provider's URL (e.g., from Alchemy)

Example .env file:

```bash
CLUSTER=DEVNET
```

and

```bash
CUSTOM_RPC=https://your-custom-rpc-endpoint.com
```

## Error Handling

All commands return JSON-formatted responses with:

- `action`: The performed action
- `success`: Boolean indicating success/failure
- `message`: Description of the result
- `data`: Additional data (if successful)
- `error`: Error message (if failed)

## Notes

- Ensure your wallet has sufficient SOL for transactions
- For JSON string parameters, use single quotes around the entire JSON object
- Make sure to escape quotes and special characters as needed
- The scripts use the MPL Core Program for NFT operations
- All transactions are signed using the provided keypair

## Security Considerations

- Keep your keypair file secure
- Never share your private keys
- Use environment variables for sensitive data
- Regularly backup your keypair file

## Support

For issues and feature requests, please open an issue in the repository.


Binary file not shown.
13 changes: 13 additions & 0 deletions nodes/misc/solana/client-executable/nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Tested Commands :

✅ Register a new node with the NetSepio program.
✅Create a checkpoint for a node.
✅Retrieve information about a registered node.
✅Check your SOL balance for the keypair address.

### List of all nodes





1 change: 1 addition & 0 deletions nodes/misc/solana/go-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# NETSEPIO GO CLIENT
6 changes: 6 additions & 0 deletions nodes/misc/solana/js-client/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MNEMONIC =

// Options: LOCALNET / DEVNET / TESTNET/ MAINNET / CUSTOM
CLUSTER = TESTNET

CUSTOM_RPC = https://solana-devnet.g.alchemy.com/v2/api-key
Loading