Command-line interface for timestamping and verifying documents on Ethereum through Web3Doc and Web3PGP smart contracts
npm install @jibidieuw/web3doc-cliA command-line interface for managing OpenPGP keys on Ethereum through the Web3PGP smart contracts. Interact with the decentralized key infrastructure directly from your terminal.
- 🔐 Key Management: Register, revoke, and manage OpenPGP keys on-chain
- ⛓️ Blockchain Sync: Listen to blockchain events and sync key changes in real-time
- 🔍 Key Lookup: Retrieve public keys by fingerprint from the blockchain
- ⚙️ Configuration: Generate and manage environment-specific configurations
- 📊 Event Monitoring: Real-time monitoring of key registration events
- 🛡️ Security: Secure wallet integration with private key management
``bash`
npm install -g @cryptogram/web3pgp-cli
Then use directly:
`bash`
web3pgp --help
`bash`
npm install --save-dev @cryptogram/web3pgp-cli
Then use with npx:
`bash`
npx web3pgp --help
`bash`
npx @cryptogram/web3pgp-cli --help
`bashGenerate test environment configuration
web3pgp configuration generate test
$3
`bash
Generate a new Ethereum key
web3pgp blockchain generate-keyGet a public key by fingerprint
web3pgp blockchain get 0x1234567890abcdef...Register your key
web3pgp blockchain register --key /path/to/key.ascAdd a subkey
web3pgp blockchain add-subkey 0xsubkeyfingerprint --key /path/to/subkey.ascRevoke a key
web3pgp blockchain revoke 0xfingerprint --revocation /path/to/revocation.ascListen for blockchain events
web3pgp blockchain syncView configuration
web3pgp configuration displayValidate configuration
web3pgp configuration validate
`Configuration
The CLI requires a configuration file at
~/.web3pgp/config.yaml. Generate a default:`bash
web3pgp configuration generate prod -o ~/.web3pgp/config.yaml
`$3
`yaml
ethereum:
chain: ink # Target blockchain (ink for mainnet, ink-sepolia for testnet)
wallet:
type: private-key
privateKey: "${DEXES_WALLET_PRIVATE_KEY}" # Use environment variableweb3pgp:
contract: "0x..." # Web3PGP contract address
monitoring:
logging:
level: info # debug, info, warn, error
`$3
Override configuration with environment variables:
`bash
export DEXES_CHAIN_ID=763373
export DEXES_WALLET_PRIVATE_KEY=0x...
export DEXES_WEB3PGP_CONTRACT=0x...
export DEXES_LOG_LEVEL=debug
`Commands
$3
####
web3pgp blockchain generate-keyGenerate a new Ethereum private key.
`bash
web3pgp blockchain generate-key
Output:
{
"privateKey": "...",
"address": "0x..."
}
`####
web3pgp blockchain get Retrieve a public key from the blockchain.
`bash
web3pgp blockchain get 0x1234567890abcdef...
`####
web3pgp blockchain register [options]Register a public key on the blockchain.
`bash
web3pgp blockchain register --key ./my-key.asc
`Options:
-
--key : Path to armored OpenPGP key file####
web3pgp blockchain add-subkey [options] Add a subkey to an existing key.
`bash
web3pgp blockchain add-subkey 0xsubkeyfingerprint --key ./subkey.asc
`Options:
-
--key : Path to armored subkey file####
web3pgp blockchain revoke [options] Revoke a key on the blockchain.
`bash
web3pgp blockchain revoke 0xfingerprint --revocation ./revocation.asc
`Options:
-
--revocation : Path to revocation certificate####
web3pgp blockchain sync [options]Listen for blockchain events and output armored keys to stdout.
`bash
Listen indefinitely
web3pgp blockchain syncListen to a specific block range
web3pgp blockchain sync --from 1000 --to 2000Custom polling interval (in seconds)
web3pgp blockchain sync --interval 30
`Options:
-
--from : Starting block (default: latest)
- --to : Ending block (default: listen indefinitely)
- --interval : Polling interval (default: 15)$3
####
web3pgp configuration generate [environment]Generate a template configuration file.
`bash
Test environment (default)
web3pgp configuration generateProduction environment
web3pgp configuration generate prodSave to file
web3pgp configuration generate prod -o ~/.web3pgp/config.yaml
`Arguments:
-
environment: 'test' or 'prod' (default: test)Options:
-
-o, --output : Output file path (default: stdout)####
web3pgp configuration displayDisplay the current configuration.
`bash
web3pgp configuration display
`####
web3pgp configuration validateValidate the current configuration.
`bash
web3pgp configuration validate
`Examples
$3
`bash
1. Generate new key
web3pgp blockchain generate-key > account.json2. Export the private key and use it for signing
export DEXES_WALLET_PRIVATE_KEY=$(jq -r '.privateKey' account.json)3. Create/import your OpenPGP key
(e.g., use Kleopatra or command line GPG tools)
4. Register it
web3pgp blockchain register --key my-key.asc
`$3
`bash
Export all historical events to a file
web3pgp blockchain sync --from 0 --to latest > keys.jsonListen for new events in real-time
web3pgp blockchain sync
`Troubleshooting
$3
`bash
Generate configuration in the default location
web3pgp configuration generate prod -o ~/.web3pgp/config.yaml
`$3
Check your RPC endpoint configuration:
`bash
web3pgp configuration display
`Verify the
ethereum.chain matches your target network.$3
Ensure your wallet private key is set correctly:
`bash
export DEXES_WALLET_PRIVATE_KEY=0xyourprivatekey...
web3pgp configuration validate
``- Node.js: 18.x or higher
- npm: 8.x or higher
MIT License - see LICENSE file for details
For issues, questions, or contributions:
- GitHub: https://github.com/cryptogram/web3pgp-cli
- Documentation: https://github.com/cryptogram/cryptogram
- Issues: https://github.com/cryptogram/cryptogram/issues
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request