Trust Engine register

Register a file with the Trust Engine Core API
The register command allows you to register a file with the Trust Engine Core API for blockchain verification and provenance tracking. Files are hashed, stored on IPFS, and recorded on the Solana blockchain. To use it, run the following command from your terminal
trust-engine-cli register [options]

Options

OptionDescription
-f, --file <path>Path to the file to register
-t, --contentTitle <title>Title for the content being registered
-w, --walletAddress <address>User wallet address (Solana public key)
-y, --walletType <type>Wallet type: ‘self’ or ‘managed’
-r, --returnActionLinkReturn an action link for transaction signing (self wallets only)
-m, --metadata <text>Public metadata as a string (optional)
--jsonOutput the result as JSON

Examples

Register a file with basic information:
trust-engine-cli register \
  --file ./document.pdf \
  --contentTitle "Important Legal Document" \
  --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" \
  --walletType "managed"
After running the command, you’ll see registration details:
✅ File registered successfully on the blockchain.

Registration Details:
  - Status: completed
  - Transaction Signature: 5J7X2vK8mWzNfEtY2jDw5mVpL1WzNfEtYKJH2mNqR3pB
  - Content Registration PDA: 9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
  - IPFS CID: QmExampleCidForYourFileMetadata123
  - Explorer URL: https://explorer.solana.com/address/5J7X2vK8mWzNfEtY2jDw5mVpL1WzNfEtYKJH2mNqR3pB?cluster=devnet
If you’re using a self wallet, you have two options for signing: Use the --returnActionLink flag to get a secure web page for signing:
trust-engine-cli register \
  --file ./document.pdf \
  --contentTitle "Important Legal Document" \
  --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" \
  --walletType "self" \
  --returnActionLink
This will return an action link:
✅ Transaction prepared and action link created. Use the link to sign the transaction.

Registration Details:
  - Status: action-link-created
  - Action Link: http://trustengine.org/tx-action/abc123def456789
  - Token: abc123def456789
  - Expires At: 2024-01-25T15:30:00.000Z
  - Visit the action link to sign the transaction via your browser wallet.
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
Simply visit the action link in your browser and click “Sign” to complete the registration using your wallet (Phantom, Solflare, etc.).

Option 2: Manual Transaction Handling

Without the --returnActionLink flag, you’ll get the raw transaction:
✅ Transaction prepared and pre-signed. Please sign and submit via your wallet.

Registration Details:
  - Status: requires-client-signature
  - Sign the transaction using your wallet and submit it using the following command:
    trust-engine-cli submit-transaction --transaction <signed_base64_transaction>
  - Transaction (Base64): eJzTYmBkYGBkZWBgZGZgYGRhYGBkZmBgZGVgYGRmYGBkZWBgZGZgYGRh...
  - Content Registration PDA: 9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR
  - Content Hash: abc123def456789ghi012jkl345mno678pqr901
  - IPFS CID: QmExampleCidForYourFileMetadata123
You can also register with metadata:
trust-engine-cli register \
  --file ./contract.pdf \
  --contentTitle "Confidential Contract" \
  --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" \
  --walletType "managed" \
  --metadata "type:contract,department:legal" \
For self wallets with action links:
trust-engine-cli register \
  --file ./contract.pdf \
  --contentTitle "Confidential Contract" \
  --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" \
  --walletType "self" \
  --metadata "type:contract,department:legal" \
  --returnActionLink
For automation purposes, use the JSON output:
trust-engine-cli register --file ./data.csv --contentTitle "Research Data" --walletAddress "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" --walletType "managed" --json
Managed wallets return completed transactions:
{
  "message": "✅ Success! Your file has been registered and confirmed on-chain.",
  "details": {
    "status": "submitted",
    "transactionId": "5J7X2vK8mWzNfEtY2jDw5mVpL1WzNfEtYKJH2mNqR3pB",
    "contentRegistrationPDA": "9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR",
    "contentHash": "abc123def456789ghi012jkl345mno678pqr901",
    "ipfsCid": "QmExampleCidForYourFileMetadata123",
    "explorerUrl": "https://explorer.solana.com/address/9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR?cluster=devnet"
  }
}
Self wallets with action links return:
{
  "message": "Transaction prepared and action link created. Use the link to sign the transaction.",
  "details": {
    "status": "action-link-created",
    "actionLink": "http://trustengine.org/tx-action/abc123def456789",
    "token": "abc123def456789",
    "expiresAt": "2024-01-25T15:30:00.000Z",
    "contentHash": "abc123def456789ghi012jkl345mno678pqr901"
  }
}
Self wallets without action links return unsigned transactions:
{
  "message": "Transaction prepared and pre-signed. Please sign and submit via your wallet.",
  "details": {
    "status": "requires-client-signature",
    "transaction": "eJzTYmBkYGBkZWBgZGZgYGRhYGBkZmBgZGVgYGRmYGBkZWBgZGZgYGRh...",
    "ipfsCid": "QmExampleCidForYourFileMetadata123",
    "contentRegistrationPDA": "9MzRqTnV8mYpH4xL9WvNfEtY2jDw5mVpQcfGKJH2mNqR",
    "contentHash": "abc123def456789ghi012jkl345mno678pqr901"
  }
}