Skip to content

Instantly share code, notes, and snippets.

@suryapratap1
Last active December 14, 2018 07:34
Show Gist options
  • Save suryapratap1/3b9757d6ffe5ffb2b89c8500ffff6af0 to your computer and use it in GitHub Desktop.
Save suryapratap1/3b9757d6ffe5ffb2b89c8500ffff6af0 to your computer and use it in GitHub Desktop.
EOS working for creation of TOKEN
for this we have to install firstly -->>
1)-follow the link
https://github.com/EOSIO/eosio.cdt.git
2)-follow the link
https://github.com/EOSIO/eos.git
cleos wallet create -n mobiloitte --to-console
Creating wallet: mobiloitte
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5JXtP9mxdXwdL1DvLB5uXJpLMq853PKPtTPjjbWA3jwsTjG87CU"
cleos create key --to-console
Private key: 5JJkkSfp5dbNEA3p2PncTcHYVTeYvchnqb4XPc6RW3uQh92RLGX
Public key: EOS5KHPPCzZjppMJQYBXJSx4c5TaAQszhuda6DSzuMJhZqJbyjFLE
surya@SYS-48:/opt/EOSIO/eos/build/programs/cleos$ cleos create key --to-console
Private key: 5Kk4W6zK1t6xTnHxYEEsYhFtLKGxXrF3taTqktsxx5SYgBzTMeK
Public key: EOS5MpeP83U14owyeoQ6t9MMiFXLRpZg9dWBWZ2yQr5eLEbdbkTwU
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -n mobiloitte
imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -n mobiloitte
imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
surya@SYS-48:/opt/EOSIO/eos/build/programs/cleos$ cleos wallet import --private-key 5JJkkSfp5dbNEA3p2PncTcHYVTeYvchnqb4XPc6RW3uQh92RLGX -n mobiloitte
imported private key for: EOS5KHPPCzZjppMJQYBXJSx4c5TaAQszhuda6DSzuMJhZqJbyjFLE
surya@SYS-48:/opt/EOSIO/eos/build/programs/cleos$ cleos wallet import --private-key 5Kk4W6zK1t6xTnHxYEEsYhFtLKGxXrF3taTqktsxx5SYgBzTMeK -n mobiloitte
imported private key for: EOS5MpeP83U14owyeoQ6t9MMiFXLRpZg9dWBWZ2yQr5eLEbdbkTwU
cleos create account eosio mobiloitte.1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
executed transaction: c63e0fd0a546bd581c3db3e9d5a53272589ac08d0349668cfc18c5c4def293f0 200 bytes 372 us
# eosio <= eosio::newaccount {"creator":"eosio","name":"mobiloitte.1","owner":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYc...
warning: transaction executed locally, but may not be confirmed by the network yet ]
cleos create account eosio mobiloitte21 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
executed transaction: 995e3630f7bcadb3d74963a35f0a40ac35363ce669d53329c838383f6b720554 200 bytes 409 us
# eosio <= eosio::newaccount {"creator":"eosio","name":"mobiloitte21","owner":{"threshold":1,"keys":[{"key":"EOS6MRyAjQq8ud7hVNYc...
warning: transaction executed locally, but may not be confirmed by the network yet ]
./cleos set contract mobiloitte.1 /home/surya/Desktop/mobiloitte -p mobiloitte.1@active
Reading WASM from /home/surya/Desktop/mobiloitte/mobiloitte.wasm...
Publishing contract...
executed transaction: c2906b9544600cfbcea1a865dce218f0ee888fcb95020b5e13479216bf4d06b3 8112 bytes 29576 us
# eosio <= eosio::setcode {"account":"mobiloitte.1","vmtype":0,"vmversion":0,"code":"0061736d010000000186011660037f7e7f0060037...
# eosio <= eosio::setabi {"account":"mobiloitte.1","abi":"0e656f73696f3a3a6162692f312e300000000000000000"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
cleos push action mobiloitte.1 hi '["bob"]' -p mobiloitte.1@active
executed transaction: 085a13adc3049e837106b557ba0a71872d6947f3ac793d96f6b3241f028cfb29 104 bytes 13342 us
# mobiloitte.1 <= mobiloitte.1::hi {"user":"bob"}
>> Hello, bob
warning: transaction executed locally, but may not be confirmed by the network yet ]
cleos get accounts EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
{
"account_names": [
"interseoseos",
"intersteleos",
"mobiloitte.1",
"mobiloitte12",
"mobiloitte21"
]
}
cleos push action mobiloitte.1 create '[ "eosio", "1000000000.0000 SYS"]' -p mobiloitte.1@active
executed transaction: 01af2ab9a009927a56006d4df5da410c9b20615713625d5577812b9411fd9e0a 120 bytes 438 us
# mobiloitte.1 <= mobiloitte.1::create {"issuer":"eosio","maximum_supply":"1000000000.0000 SYS"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
cleos push action mobiloitte.1 create '[ "eosio", "1000000000.0000 MOBI"]' -p mobiloitte.1@active
executed transaction: 0415efb7eb52b5913adec5c28b46574a39f167c5822924755ac4da427c8eefa1 120 bytes 379 us
# mobiloitte.1 <= mobiloitte.1::create {"issuer":"eosio","maximum_supply":"1000000000.0000 MOBI"}
warning: transaction executed locally, but may not be confirmed by the network yet
========>>>This command created a new token MOBI with a precision of 4 decimals and a maximum supply of 1000000000.0000 MOBI. To create this token requires the permission of the mobiloitte.1 contract. For this reason, -p mobiloitte.1@active was passed to authorize the request.
cleos push action mobiloitte.1 issue '[ "mobiloitte12", "100.0000 SYS", "urgency" ]' -p eosio@active
executed transaction: 190aafb2f9d641fcf9a65bc9178d961b7dda6edbc32095665275b0f36db405cb 128 bytes 920 us
# mobiloitte.1 <= mobiloitte.1::issue {"to":"mobiloitte12","quantity":"100.0000 SYS","memo":"urgency"}
# mobiloitte.1 <= mobiloitte.1::transfer {"from":"eosio","to":"mobiloitte12","quantity":"100.0000 SYS","memo":"urgency"}
# eosio <= mobiloitte.1::transfer {"from":"eosio","to":"mobiloitte12","quantity":"100.0000 SYS","memo":"urgency"}
# mobiloitte12 <= mobiloitte.1::transfer {"from":"eosio","to":"mobiloitte12","quantity":"100.0000 SYS","memo":"urgency"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
cleos get currency balance mobiloitte.1 mobiloitte12
974101.0000 SYS
Note- we can perform task of transfering token only when our one account has been set (means publish on the network) and
one will be of normal account where i can checked out the things.normal account will be that account which will be just a
kind of where we will send token from the account which is set as Token.
cleos push action mobiloitte.1 transfer '[ "mobiloitte12", "mobiloitte.1", "25999.0000 SYS", "m" ]' -p mobiloitte12@active
executed transaction: 29db43b210d88fa9d71b4161e07af1820e42115d4e3538a6cafda02cd5992fea 128 bytes 539 us
# mobiloitte.1 <= mobiloitte.1::transfer {"from":"mobiloitte12","to":"mobiloitte.1","quantity":"25999.0000 SYS","memo":"m"}
# mobiloitte12 <= mobiloitte.1::transfer {"from":"mobiloitte12","to":"mobiloitte.1","quantity":"25999.0000 SYS","memo":"m"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
================>> Randomization in contracts
openssl rand 32 -hex
6c5327b15594358694be415277519e26fdbdf6fc6824ad5b7ba733a9314f78f3
openssl rand 32 -hex
da77c5e3b58c8877f59bedbca8c7842578a8d45c0a4b8d77c825892afdd903e6
echo -n '28349b1d4bcdc9905e4ef9719019e55743c84efa0c5e9a0b077f0b54fcd84905' | xxd -r -p | sha256sum -b | awk '{print $1}'
d533f24d6f28ddcef3f066474f7b8355383e485681ba8e793e037f5cf36e4883
echo -n '28349b1d4bcdc9905e4ef9719019e55743c84efa0c5e9a0b077f0b54fcd84905' | xxd -r -p | sha256sum -b | awk '{print $1}'
d533f24d6f28ddcef3f066474f7b8355383e485681ba8e793e037f5cf36e4883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment