- return to IOTA Rebased Useful Links
Snippets for the IOTA Rebased CLI
Quick notes on this essential tool for building and deploying IOTA Rebased Smart Contracts. Please use with caution and always check anything important with the very good official IOTA help.
[A] Installing the IOTA Rebased CLI onto a new Macbook
December 2024. This method has many missing steps and is a personal note. You should definitely refer back to the official IOTA Rebased Blog - see Useful Links page.
[1] Install 'homebrew'
to check version: brew --version
I have: Homebrew 4.4.10
[2] Install Rust and Cargo
to check version: rustc --version AND cargo --version
I have: rustc 1.83.0 (90b35a623 2024-11-26) AND cargo 1.83.0 (5ffbef321 2024-10-29)
[3] My main IOTA download was via this page (rel. Nov 2024)
https://github.com/iotaledger/iota/releases/tag/v0.7.3-rc
[4] Success was proven by the CLI entry: iota —version
gave: iota 0.7.3-rc-34da09d2684e
[B] IOTA Address to Coin structure
One fundamental idea is that an IOTA address can own many coins as shown in the extract below. This is the CLI command:
Not sure what your address is?
% iota client addresses
Have more than one address and wish to switch between them?
% iota client switch --address goofy-amber
This is how to see the balance of your address, including the specific coinIDs associated with it.
% iota client balance --with-coins
This is an extract from a typical listing, in this case from Testnet. The address already has attracted 25 coins.
Balance of coins owned by this address
│
├────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ╭────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ IOTA: 25 coins, Balance: 51281135000 (51.28 IOTA IOTA) │ │
│ ├────────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ coinId balance (raw) balance │ │
│ ├────────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ 0x034010c356652f1f28e41ef45831aa983f920cbdb799c974fa69ced276454922 2995000000 2.99 IOTA │ │
│ │ 0x0d8a372e1afd6cfa7cad51377007a8e4e983f37288703db652f854d3085498a6 2000000000 2.00 IOTA │ │
│ │ 0x10318ec7c30ebbdc05c119d38c68bfe370f74d529f082cd14b357e016204f05b 2000000000 2.00 IOTA │ │
│ │ 0x1a4f000e315f4c0fd422bd82881e8b3ed59de202e1e477daa97d5704bc9ffd61 3000000000 3.00 IOTA │ │
│ │ 0x284a318dbc43ed71b098cb77f54ea1759a2e18f0fe98db006a751b2f8dc27901 294222800 0.29 IOTA │ │
│ │ 0x2d7c5b1d894577ce530a3f634b2f7844e0bcc2a8804f7167e9374d5ba38555f9 2000000000 2.00 IOTA │ │
So if you were to simply ask for the balance of this address you would get 51.28:
% iota client balance
If you don't have any coins to start with then:
% iota client faucet
[C] Merging and Splitting IOTA Coins
If in doubt:
% iota client help
When you transfer an amount of IOTA elsewhere then sometimes you are actually transferring ownership of one of these coins. if there isn't already one for the correct value, you may need to create one though there are some transfer commands that do this for you automatically.
On the CLI you can choose to first merge iota coins until you have one that is large enough, and then split an iota coin so that you have one of the desired size.
This is how to MERGE COINS, leading to the merge coin vanishing, and the primary one being left with the total value of the two together. Gas costs are also payable but the coin they are to come from does not have to be specified.
% iota client merge-coin \
--primary-coin 0x4ef27dacdd974f9aecd3209d6bc3591286c285a5e5f1574db5bf7f9daed16087 \
--coin-to-merge 0x2f6d95488e0ba8a0f4b1bc4da0df64640ddc3e68218edb8c54efeca12d9b9aea \
--gas-budget 10000000
This is how to SPLIT A COIN, leading to a new coin with value 3 IOTA.
% iota client split-coin \
--gas-budget 10000000 \
--gas 0xf2492ec9f2c2ce71be3e576845ea6abb92b3bb2dd73380d3cd91cb3bcc7f3420 \
--coin-id 0xc4b9ca78ac29d9a0175b211d3704a14f8fa15dd5caf1f0ba740f0f8eb7692958 \
--amounts 3000000000
You can also transfer IOTA using this version which will transfer the whole coin with its value, less gas:
iota client transfer-iota \
--to 0x598fc799d1c455bb73a1b09693bf7096fefe0f2ac03af9dfbf328754063c358b \
--iota-coin-object-id 0x1a4f000e315f4c0fd422bd82881e8b3ed59de202e1e477daa97d5704bc9ffd61 \
--gas-budget 10000000
Or this version which will SPLIT a specific amount from the specified coin and send that new coin to the desired destination.
iota client transfer-iota \
--to 0x598fc799d1c455bb73a1b09693bf7096fefe0f2ac03af9dfbf328754063c358b \
--iota-coin-object-id 0x36a63f51e2e34f4dd3286b6297c63e7a914fbc20e61a88f4ad671dce5f3d13b7 \
--gas-budget 10000000 \
--amount 2000000000
Please see other pages on this site for CLI calls to contracts etc.