-
Notifications
You must be signed in to change notification settings - Fork 33
CLI Commands
To use the CLI:
cd mmx-node
source ./activate.sh
The node needs to be running, see Getting Started for how to start it.
To check your balance: mmx wallet show
To show wallet activity: mmx wallet log
To send coins: mmx wallet send -a 1.234 -t <address>
To show the first 10 addresses: mmx wallet show 10
To get a specific receiving address: mmx wallet get address <index>
To show wallet activity since height: mmx wallet log <since>
To show wallet activity for last N heights: mmx wallet log -N
To get the seed value from a wallet: mmx wallet get seed
To use a non-default wallet specify -j <index>
with above commands (at the end).
To check on the node: mmx node info
To check on the peers: mmx node peers
To check on a transaction: mmx node tx <txid>
To check the balance of an address: mmx node balance <address>
To check the history of an address: mmx node history <address> [since]
To dump a contract: mmx node get contract <address>
To dump a transaction: mmx node get tx <txid>
To dump a block: mmx node get block <height>
To dump a block header: mmx node get header <height>
To force a re-sync: mmx node sync
To get connected peers: mmx node get peers
To check on the farm: mmx farm info
To get total space in bytes: mmx farm get space
To show plot directories: mmx farm get dirs
To reload plots: mmx farm reload
Some tokens can be minted by staking another currency over time. This is the case with MMT
, an example token on testnet, it has a stake factor of 1/10000 per block for MMX
. So if you stake 1000 MMX
you will create 0.1 MMT
per block.
To start staking you first create a mmx.contract.Staking
contract as follows:
{
"__type": "mmx.contract.Staking",
"owner": "mmx1nn8u9etvnghq7x8atj2y55he76z9yvxalc9t3nx8ym0xqr4yuzvsdf8jp8",
"currency": "mmx1qyhvjyeumwzc6wfpkhg5cd936eprlmju3d5tj6zyyfdvrx7g2xrs6tvg3e",
"reward_addr": "mmx1nn8u9etvnghq7x8atj2y55he76z9yvxalc9t3nx8ym0xqr4yuzvsdf8jp8"
}
Where currency
is the token contract address, above example is for MMT
.
Make sure to replace owner
and reward_addr
with addresses that you control and save the file with a .json
extension somewhere.
Once you have written the contract you can deploy it on the blockchain:
mmx wallet deploy path/to/contract.json
You will see that the contract has been deployed together with it's address:
Deployed mmx.contract.Staking as mmx1t3x52rh3wt3h5vllhfsj24gpudmn5zud7j7dkf0p52ux8hlc53tsj7xr0u
Note: You need some MMX to perform this step, around 0.01 MMX should be enough.
After deploying the contract you should be able to see it in mmx wallet show
:
Contract: mmx1t3x52rh3wt3h5vllhfsj24gpudmn5zud7j7dkf0p52ux8hlc53tsj7xr0u (mmx.contract.Staking)
Note: The address will be different for you.
Now you can send MMX
to this contract via:
mmx wallet send -a 10 -t mmx1t3x52rh3wt3h5vllhfsj24gpudmn5zud7j7dkf0p52ux8hlc53tsj7xr0u
Make sure to replace the address with your contract address.
The rewards will be sent to reward_addr
when you remove the balance from this contract again. However there is a minimum period the coins have to be residing in the contract, on testnet it's currently just 18 blocks. You can withdraw before that time, but you wont get any rewards.
To withdraw balance from the contract and trigger a minting reward:
mmx wallet send_from -a 10 -s mmx1t3x52rh3wt3h5vllhfsj24gpudmn5zud7j7dkf0p52ux8hlc53tsj7xr0u -t mmx1nn8u9etvnghq7x8atj2y55he76z9yvxalc9t3nx8ym0xqr4yuzvsdf8jp8
Make sure to replace the source -s
with your contract address and target -t
with your destination address.
After withdrawing the balance you should see the reward being sent to your reward_addr
within the same transaction:
[9759] RECEIVE + 0.33 MMT (330000) -> mmx1nn8u9etvnghq7x8atj2y55he76z9yvxalc9t3nx8ym0xqr4yuzvsdf8jp8
[9759] RECEIVE + 10 MMX (10000000) -> mmx1nn8u9etvnghq7x8atj2y55he76z9yvxalc9t3nx8ym0xqr4yuzvsdf8jp8
You can also send the funds right back to the contract.