Difference between revisions of "Test Wallet commands"
(Created page with "''You probably will prefer the high-level CLI which, like the high-level APIis much more easy to use, and basically automates all of the complexi...")
Latest revision as of 16:11, 12 June 2013
You probably will prefer the high-level CLI which, like the high-level APIis much more easy to use, and basically automates all of the complexity of OT. Whereas the low-level CLI described on this page, similar to the low-level API, is "experts only" and you probably don't even want to mess with it at all.
If you prefer a GUI client, check out Moneychanger.
NOTE: The below command line instructions are probably too low-level for your tastes.
Instead, recommend you start with the higher-level sample scripts.
This OT CLI is the command-line equivalent of the OT LOW LEVEL API. It includes no built-in synchronization, retries, timeouts, downloads, etc. Experts only!
OT CLI Usage: ot --stat (Prints the wallet contents) ot --prompt (Enter the OT prompt) ot [-h|-?|--help] (Prints this help) ot --script (assumes script until eof) The '|' symbol means use --balance or -b, use --withdraw or -w, etc. The brackets '' show required arguments, where default values are normally expected to be found in: ~/.ot/command-line-ot.opt ot --balance | -b [--myacct <acct_id>] (Display account balance) ot --withdraw | -w <amount> [--myacct <acct_id>] (Withdraw as CASH) ot --transfer | -t <amount> [--myacct <acct_id>] [--hisacct <acct_id>] ot --cheque | -c <amount> [--myacct <acct_id>] [--hisnym <nym_id> ] ot --voucher | -v <amount> [--myacct <acct_id>] [--hisnym <nym_id> ] ot --depositcheque [--myacct <acct_id>] (Deposit a cheque.) ot --depositpurse [--myacct <acct_id>] (Deposit a cash purse.) ot --deposittokens [--myacct <acct_id>] (Deposit individual cash tokens.) ot --inbox | -i [--myacct <acct_id>] (Display the inbox.) ot --sign | -s [--mynym <nym_id> ] (Sign a contract.) ot --verify [--mynym <nym_id> ] (Verify a signature.) ot --purse | -p <arguments> (Display a purse.) Arguments: [--mynym <nym_id> ] [--mypurse <asset_type_id>] ot --refresh | -r [--myacct <acct_id>] (Download account files from server.) ot --refreshnym [--mynym <nym_id> ] (Download nym files from server.) ot --marketoffer [--mynym <nym_id> ] (Place an offer on a market.) Also, [--server <server_id>] will work with all of the above. Recurring payments: ot --proposeplan <arguments> (Merchant) Arguments: [--mynym <nym_id> ] [--myacct <acct_id>] (continued.) Continued: [--hisnym <nym_id> ] [--hisacct <acct_id> ] ot --confirmplan <arguments> (Customer) ot --activateplan <arguments> (Customer again) Arguments: [--mynym <nym_id> ] [--myacct <acct_id>]
ot --prompt to enter the prompt.)
THE OT PROMPT COMMANDS
stat - Display wallet contents.
(Yes, that's just a 'c' by itself down there.)
c - Sends a checkServerID command. This is OTLib's "Ping". It's the wallet pinging the notary, and verifying to both sides that each can encrypt/verify with the other.
r - Register a new user account (using first Nym in wallet.) (Register will fail for you because I already registered with this Nym. So you can just START USING IT, since it's already registered. Ignore this command, in other words.)
u - Sends a checkUser command (retrieves public key based on userID)
s - Encrypts a message and drops it into another user's nymbox.
g - Ask the server to send me the current request number. If you get errors that the request number is wrong, use this and then try again. (It must always be in sync. This command is what re-syncs it.)
issue - Issue new currency. (It will ask for the currency contract.) The wallet will ask you for the currency contract and then create an issuer account. The public key in the currency contract must be the same as the Nym's public key, AND the signature on the contract must verify with that same key.
(I already uploaded the silver contract, which is why you see it in your wallet as though you are the issuer of that currency -- because you are.)
getcontract - Get server's copy of any currency contract, by asset type ID.
getmint - Get the server's copy of the public Mint file (contains public keys for each asset type. This is needed in order to make withdrawal requests for any given asset type.) If the public mint file doesn't yet exist on the server side, then this will fail. To create a new mint, go to the transaction/data_folder and run ./createmint.exe (the OT server, long term, will need to execute that program as a separate process, whenever a new asset type is issued. Otherwise the entire server would grind to a halt as the new keys were being generated for the mint.)
a - create asset account. (Of any type, including any Basket Type ID, which is used like another asset type ID.)
get - Get latest copy of one of my asset accounts (by account ID). This also causes the testwallet to get the outbox and inbox.
n - Ask the server to send me a new transaction number. (If you ever get an error related to being out of transaction numbers, just use this. Sometimes you just run out of them, and you need more from the server.) As a utility tool, if you append a long integer as the first parameter, then OT will add that number to the Nym as if it were a signed-for transaction number.
y - After you ask for a few more transaction numbers, you will need to download your Nymbox so you can get them and sign for them.
py - Usually whenever downloading your Nymbox, you want to just do this one next. (It will process all the nymbox items, which is necessary in order to accept and sign-for new transaction numbers.)
t - Initiate transfer from my account into another account's inbox (with a pending notice being put into my outbox).
i - getInbox from the server so I can decide what to do with it. (There will be pending notices, cheque receipts, etc. I need to go through them all and accept or reject them.)
pi - After getInbox, use this to just accept everything in your inbox.
NOTE: Obviously a real GUI client would merely display the inbox to the user, where the user could choose whether or not to accept the items individually. The API offers faculties for doing this.
o - getOutbox from the server so my balance statements don't fail. (All transactions now require a signed balance receipt, which includes data on the inbox items, the outbox items, the current account balance, and the current list of transaction numbers that are signed out to me. Your outbox should never change on the server side, but if you ever need to re-download a copy of it, you will be able to verify it against the last signed receipt.)
w - Withdraw cash and save to a purse. (It will ask for Account ID and amount.)
Note on token format: the individual notes are stored with the internal Lucre data encrypted to the user's Nym. So even if the tokens were stolen in plaintext, they still could not be used--because the internal Lucre data member is still encrypted. As long as you keep backups of your financial data, they cannot be lost, nor can they be stolen simply by the files becoming compromised.
v - Withdraw voucher. (This is like a cashier's cheque. The server removes funds from your account, then issues you a cheque drawn on one of the server's accounts.)
q - Deposit cheque. (You can also deposit vouchers here.)
d - Deposit cash. (Will ask for Account ID and Cash Note.)
NOTE: When making a deposit, the test client automatically re-encrypts the Lucre data (internal to the token) to the SERVER's nym, so that the server will be able to process the tokens. Similarly, if you wanted to give some tokens to a friend, using a nice GUI, you would simply drag the gold over to his name, and then your wallet would re-encrypt the internal Lucre Data of each token to his public key, and then send the tokens to him. Future options include exporting to a passphrase, or in the clear.
p - Deposit a purse full of cash. (It will ask for the Account ID and and Purse.)
cheque - Write a cheque. You can do this offline but you need to have at least one transaction number laying around to write it with.
basket - Create a basket currency. (It will ask for the basket details, and lead you through the process.)
NOTE: The wallet will ask for the number of asset types in the basket, then the minimum transfer amount for the basket itself, then it will ask for each asset type ID followed by the minimum transfer amount for that asset type. For example: I might create a new basket currency called the Rand, defined as, 10 Rand = [$50, 2 gold g, and 10 silver oz]. Those numbers would serve as the minimum transfer amount for each asset type, with all transfers being a multiple of those numbers.
Normally when you issue a currency, you are given an issuer account by the server. This account is allowed to go negative, and you can transfer to whoever you wish based on the terms of your currency contract. And with a basket currency, an issuer account is also created. But.. instead of handing control of that issuer account over to the user who defined the basket, the server manages it internally. Each basket account has its own internal asset accounts to store the reserves for the basket. Whenever users exchange in or out of a basket, the various assets are moved in or out of those internal asset accounts. After this point, an asset account storing a basket currency is no different than any other asset account, as far as the server is concerned. It's just another asset type ID. Due to this, baskets also support infinite nesting yet with no additional system resource usage.
exchange - Exchange from asset accounts, in and out of basket accounts. This is where the magic happens.
Any exchange in or out is based on a multiple of the minimum transfer amount. So I could transfer into 10 Rand, or 20, or 30, or 40, etc. Any multiple of 10, since 10 is the minimum amount. I would have to trade ($50, 2 gold, and 10 silver) times 1, or 2, or 3, etc for the exchange. Once the user has Rands in his Rand asset account, he can trade it with other Rand asset accounts in any amount he wishes, with no minimum amount. The minimum amount is only for exchanging in and out of the basket.
payment - Create a payment plan (like WRITING a cheque). plan - Activate a payment plan (like DEPOSITING a cheque).
offer - Put an Offer onto a Market.
setnymname - Set a Nym's name (merely a client-side label.)
setaccountname - Set an Asset Account's name (merely a client-side label.)
signcontract - Allows you to input a contract and sign it with the current Nym.
decode - Decodes base64-encoded data at the command line.
encode - Base64-encodes data at the command line.
decrypt - If you have already loaded your Nym, you can use this to decrypt messages at the command line.
clear - Clears all of the transaction numbers from a Nym. Low-level tool!
clearreq - Clears all the request numbers from a Nym. Low-level tool!
Deprecated: (happens automatically now)
load -- Load wallet.xml from the data_folder. (Do this first.)
NOTE: The below commands are for TCP / SSL mode only. (You can IGNORE them.)
connect - Connect to the first server on the wallet's list.
- - Sends a type 1 header command to the server, with no payload.
- - Sends a deliberately-malformed command to the server.
- - Sends a signed XML message in the payload, but with no XML requests.