EOSIO create 2 currencies on single wallet and Transfer funds
Recently EOSIO been on everyone's lips, they have provided rapidly build and deploy high-performance and high-security blockchain-based applications platform. As there new version has been updated on GIT-Hub page.
Today we'll take the topic of creation of wallet, create different type of currencies in the wallet, create user accounts and then transfer created coins from one account to another.
Basic EOSIO Environment setup :
Before we start anything we should have a freshly installed EOSIO setup on our machine. Here I am using Ubuntu-16.04.
Follow the installation steps on Ubuntu machine from Developers portal for EIOSIO
Create wallet and accounts
After completing the setup simply start the nodeos and make sure your wallet is unlocked and then follow these steps,
- Create wallet - (lets use wallet name = flowers )
cleos wallet create --name flowers
- now create owner and active keys for the wallet (execute the following command twice)
cleos wallet create key
- generated first public-private key pair is Owner kyes
- generated second public-private key pair is Active keys
- Now import the generated keys into wallet
- import private Active key
cleos wallet import --name flowers $(generated_private_active_key)
- import private Owner key
cleos wallet import --name flowers $(generated_private_owner_key)
- import private EOSIO key
cleos wallet import --name flowers $(generated_private_eosio_key)
- import private Active key
- Now create the currency account (lets create 2 currencies bitcoin and ripple )
cleos create account eosio bitcoin $(owner_public_key$) $(active_public_key)
cleos create account eosio ripple $(owner_public_key$) $(active_public_key)
- Create an account (lets create 2 accounts rose and periwinkle
cleos create account eosio rose $(owner_public_key$) $(active_public_key)
cleos create account eosio periwinkle $(owner_public_key$) $(active_public_key)
Lets do the actual transactions
- load the Bios contracts into Ripple currency account
cleos set contract ripple ~eos/build/contracts/eosio.bios -p ripple
- Here first ripple is the currency account name in which you wish to load the contract
- -p ripple the the account which will gonna allow all the transaction related permissions
- similarly load the Bios contract into Bitcoin currency account
cleos set contract bitcoin ~eos/build/contracts/eosio.bios -p bitcoin
- After loading the contract into the account, check the hash code for that account, it must have changed from a string of zeros.
cleos get code bitcoin
- Now deploy the token contract on your Ripple account which will gonna create the XRP currency
cleos set contract ripple eos/build/contracts/eosio.token -p ripple
- Here first ripple is the currency account name in which you wish to load the contract
- -p ripple the the account which will gonna allow all the transaction related permissions
- Now deploy the token contract on your Bitcoin account which will gonna create the BTC currency
cleos set contract ripple eos/build/contracts/eosio.token -p ripple
- Lets create the currency with some fixed amount and coin symbol
cleos push action ripple create '[ "ripple", "1000000000.0000 XRP"]' -p ripple
- here "ripple" is the account name which will gonna have this initial amount of tokens
- and XRP is the coin symbol we wish to use for our currency
- 1000000000.0000 ⇒ maximum_supply provided with upto 4 decimal scale/points only
- Similarly lets create the initial amount of 1 billion tokens for Bitcoin currency
cleos push action bitcoin create '[ "bitcoin", "1000000000.0000 XRP"]' -p bitcoin
- Now issue those tokens/currency in any of the user account we created (e.g lets issue 100 ripple in rose account )
cleos push action ripple issue '["rose", "100.0000 XRP", "memo"]' -p ripple
- rose is the account name which will gonna issue
- after this command, it'll gonna transfer 100 ripple coins from ripple account to rose account
- Similarly transfer 20 bitcoins to the periwinkle account
cleos push action bitcoin issue '["periwinkle", "20.0000 BTC", "memo"]' -p bitcoin
- Also you can send/transfer coins from one user account to other user account
cleos push action ripple transfer '[ "rose", "periwinkle", "51.0000 XRP", "my first transfer" ]' -p rose
- here -p rose is the name of the account whose permission required to transfer the fund
- Now you can validate if transfer is actually happened or not, by checking the balance
cleos get table ripple periwinkle accounts
Thanks for your patience to checking it out, Please add comments for suggestion as Its my first Blog ... :)
Congratulations @amolm! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes received
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard!
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes
Congratulations @amolm! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!