User guide for Metaverse ETP Wallet server
The Metaverse Wallet is built on Libbitcoin.
The use of rpc is similar to bitcoin’s, but they have different interfaces.
The default port for RPC initiation is 8820. Https is not supported for now.
You can configure to other ports on mvs.conf.
Please visit: https://github.com/ViewBTC/mvs-exchange-tools for code samples of PHP linking to ETP wallets. Sample codes in other languages will be available soon.
Mvs-cli also invokes port 8820 by default to execute RPC.
Hence, the data retrieved from the user explorer is the same as the call of mvs-cli.
Checking help information
All commands support the “help” command.
Mvs-cli can also be an operating console within the user explorer.
1. # Check all commands
2. mvs-cli help
3. # Check specific command parameters and descriptions
4. mvs-cli help send
5. # or
6. mvs-cli send -h
Commands traversing blocks
1. # Inquire the block hash corresponding to a block height
2. ./mvs-cli fetch-header -t $block_height
3. # Check the previous block structure for a corresponding block hash
4. ./mvs-cli getblock $block_hash --json=true
Creation of HD accounts and address management
Metaverse discarded the idea of using random keys since the beginning of its design process. All transactions are managed by sub-private keys of a master private key.
The master private key + index generates corresponding sub-private keys.
Your account number and password belong to the Wallet and is stored locally rather than as on-chain data. Hence, it cannot be imported using the mnemonic passphrase provided together with your Wallet (the 24-word or Mandarin character mnemonic passphrase provides a human-readable phrase to backup your Wallet in case you need to recover your it at a later date).
If you log in to a new wallet, you may not reuse your previous account name and password. A new account must be created. Lost account details are retrievable as long as you have a backup of the mnemonic passphrase.
1. # Create a new account
2. mvs-cli getnewaccount $name $password
3. # Use this account to generate addresses; these addresses absolutely belong to the account.
4. mvs-cli getnewaddress $name $password
5. # Check my account’s address
6. mvs-cli listaddresses $name #password
An account’s name and password are equivalent to the main private key’s alias within a specified wallet. Account names have a one-to-one relationship with main private keys, and using an account’s name and password is equivalent to using its corresponding main private key. Hence, the commands listed above illustrate how a main private key can be used to generate new addresses.
The total number of indexes for a main private key is about 4 billion. By default this increases from zero, so you only need to back up the main private key and should not create a backup for your account name and password.
If you have lost or forgotten your login details, you may retrieve it using your mnemonic passphrase. Using the “importaccount” command, input the size of your designated index; the Wallet will then generate a corresponding digital address. For more details, please check “help”.
On Metaverse, the only certificate of all personal assets (including assets issued by oneself) is the master private key’s mnemonic passphrase.
Metaverse Wallet has yet to make file-level backups, so please make sure to keep a backup of the mnemonic passphrase for your master private key (the 24-word phrase).
Backing up this phrase ensures that you will not lose any of your assets. There is no way to retrieve the mnemonic passphrase using your account’s username and password.
Sending transactions (key points)
1. # “send” command
2. mvs-cli send $name $password $target_address $amount
3. # “sendfrom” command
4. mvs-cli send $name $password $from_address $target_address $amount
Detailed explanation for “send” command (key points):
The “send” command has been optimized for users. It supports regular transactions, breaks up the change into multiple outputs then sends those outputs to randomly chosen addresses belonging to the user. We do not recommend using this command on the back-end.
Application of the “send”command on the server side: when small change needs to be organized or entire amounts sent to other addresses. To send change with certainty, please use the “sendfrom” command instead.
Detailed explanation for “sendfrom” command:
The “sendfrom” command supports sending change to a specific address. It is very similar to implementations of this command in other wallets.
QA about assets and transaction management
- How do I check assets using transaction history?
Transaction histories contain an attachment which has “type”. If the type is etp, it was an ETP transaction. If an asset was issued, the transaction is labeled with some other symbol. Currently there are some test tokens. To view these, use “listassets” without any added parameters.
- How should I regard the relationship between ETP and other assets?
ETP is equivalent to Ethereum’s ETH, and other assets are equivalent to tokens.
- What if someone obtains my account
Fail to get the private key of designated address. If the designated address issues transaction, we have “sendfrom” command to support the address, then the address belongs to the account.
How to create a raw transaction through transfer record? It is similar to the createrawtransaction of bitcoin.
For rawtransaction, it belongs to component transaction, which is supported by the native command, libbitcoin. We retain the function, but it is not recommended to use. For more details, please visit: https://github.com/libbitcoin/libbitcoin-explorer/wiki/How-to-Spend-Bitcoi. Replace the bitcoin part to the address and utxo of Metaverse, which remains valid.
How to use private key to sign the raw transaction?
As above, it is recommended to use HD address.
How to generate an address via HD?
/mvs-cli getnewaddress $account_name $account_password
Username and password are equivalent to alias of your main private key in the Wallet. Username and the main private key are one-to-one corresponding relations. The use of username and password is equivalent to the call of corresponding main private key, thus the command mentioned above is to use some main private key to generate a new address.