Skip to content

Address Bash example

ChMarina edited this page Jul 10, 2018 · 3 revisions

Bash-example (Generating a Metahash address)

Repository metahashorg/crypt_example_sh contains a script file for Bash, that describes step-by-step generation of the Metahash address with OpenSSL CLI Tool.

Run the script

./crypt_example.sh function [parameter]

List of functions:

	generate  - generate MetaHash address with OpenSSL CLI Tool

	usage  - display help info
	
	fetch-balance -- get balance information. Mandatory parameters are: --net=NETWORK(dev|main) and --address=metahash_address

	fetch-history -- get history for address. Mandatory parameters are: --net=NETWORK(dev|main) and --address=metahash_address

	get-tx -- get transaction information. Mandatory parameters are: --net=NETWORK(dev|main) and --tx_hash=transacation_hash

	get-address -- get your own metahash address. --net=NETWORK(dev|main) and --pubkey=/path/to/public_key are mandatory

	prepare_transaction -- gives you json of transaction.
	
		Mandatory parameters:
 	 		 --net=NETWORK(dev|main)
		 	 --pubkey=/path/to/public_key
		 	 --privkey=/path/to/private_key
		 	 --amount=AMOUNT_TO_SEND,
		 	 --send_to=RECEPIENT_ADDRESS
		Optional parameters:
 	 		--nonce=VALUE

	send_transaction -- send a transaction to server.
	
		Mandatory parameters:
		 	 --net=NETWORK(dev|main)
		 	 --pubkey=/path/to/public_key
		 	 --privkey=/path/to/private_key
		 	 --amount=AMOUNT_TO_SEND,
		 	 --send_to=RECEPIENT_ADDRESS

As a result of the script, the following files will be created:

mh.pem # private key file
mh_addr.pub # public key file

For more information please see the repository.

Clone this wiki locally