Payable Functions - Discussion

Thanks Carlos.

You are correct. When I ran cleos wallet private_keys (Step 1), it returned two keypairs instead of one.

So I went to Step 2 and removed the incorrect second keypair that I had in my wallet.

Now I have the correct keypair in my wallet, like yours:

EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Step 3:

I ran cleos wallet import and pasted the 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 private key. I get an error because the key already exists and is already in the wallet:

It makes sense, because 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 is the private key I already have in my wallet. So I moved forward to Step 4.

Step 4

I repeated Step 1, and yes I have the same imported public key & private key as you:

Now it is true that the public key I have on the eosio.token account looks incorrect:

But now when I want to change the keys on the eosio.token account, by using your command:
cleos set account permission eosio.token owner EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV -p eosio.token@owner
… I cannot do it, because I get the same Error 3090003 than I had previously:

So I cannot complete Step 4 and change the keys on the eosio.token account. :roll_eyes:

Thank you for your assistance!

Ok, in order to change the permission keys in for eosio.token account, you must have the old public/private key imported into your wallet (those that start with EOS8j77h… from your picture that shows the account info about eosio.token account). Just import it into your wallet, and try the Step 4 again. (you must have the old public/private key and the new and correct ones into the wallet).

I hope you have a backup about your private keys, i just show you one of my keys, not all of them, just to show you the correct public and private key that you must have imported into your wallet in order to later change the permissions of the eosio.token account.

If not, you have to start from scratch at least from the data that is saved into your OS (it happens to me many times, that is the reason that took me to create my own notes, to speed up my process every time i mess up with something)

2. Manually deleting the eosio blockchain data folder.

Open a Terminal window, we have to navigate to the “.local” folder

cd ~/.local/share/eosio/nodeos/

Manually delete the “data” folder

sudo rm -vrf data

rm is the command to delete any file/folder on linux, -vrf means [v = verbose to explain what is being done, r= remove directory and content recursively, f= force to ignore nonexistent files and arguments]

You will be promted with somethin like this thanks to the verbose option:

removed 'data/somethingFile'
removed 'data/otherFile'
removed directory 'data'

Now you can close this terminal window and start again the blockchain with the script “nodeos_start” that you have created before.

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

1 Like

Thank you for your instructions. This time, the permission step worked! :+1: I was able to change the permission keys for the eosio.token account.

So, Step 4 and Step 5 OK!

However, issuing tokens in Step 6 still doesn’t work. I got the same error as before:

The same error I had several times previously:

ERROR: ExtrasError: [“1000 DOGCOIN”, “memo”]’]
Push a transaction with a single action

Thank you very much Carlos for your help, this is very helpful, and I am learning a lot with all this time typing on my terminal :wink: But since I have been trying issuing tokens for a week now, maybe @filip can help?

In the meantime, I will check on EOS dev forums if they encountered the same ExtrasError message.

1 Like

Glad to know that you made it work! :muscle:

I think you have an issue with your quotation marks. Why there are curvy instead of normal?

This is my example:

cleos push action eosio.token issue '["dogctrissuer", "1000 DOGCOIN", "memo"]' -p dogctrissuer@active

And my screenshot, see that my quotation marks are not curvy at all.

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

This is right, you spotted correctly that the quotation marks were not OK (I don’t know why they were curvy in my terminal). So I replaced them with normal quotation marks, as follows:

cleos push action eosio.token issue '["swisseos", "1000 DOGCOIN", "memo"]' -p swisseos@active

However, I got another error:

ABI for contract eosio.token not found.
Action data will be shown in hex only. error 2020-05-28T12:24:21.748 cleos main.cpp:4013 main ]
Failed with error: Assert Exception (10) abis.valid(): No ABI found for eosio.token

I looked for a solution on EOS dev forums. I tried to use the command cleos set abi eosio.token, but it got things messed up, and now I cannot even do Steps 4 and 5 anymore, I am getting errors again.

I am going to start all over again, I think this is the best thing to do.

1 Like

You probably forgot to add the command to create the ABI file for the eosio.token contract.

Take a look on my notes from this point: Payable Funtions/Token Creation setup.

The last command to deploy the contract should look like this:

cleos set contract eosio.token ~/contracts/eosio.contracts/contracts/eosio.token ./eosio.token.wasm --abi eosio.token.abi -p eosio.token@active

The “–abi eosio.token.abi” must be included in order to create or read the ABI file, but go step by step through my notes, i promise that following them will not give you any issue in the path.

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

1 Like

Hurrah! I finally succeeded in issuing tokens and completing the Token Creation section in the course! :sweat_smile: :smiley:

Thank you Carlos for your Github notes, I could check them along the videos.

About the ABI file, well, this was surprising to me, because I thought I had included the --abi command when I had deployed the contract, but as I had to go back and forth several times, I probably omitted it at some point.

As things had gotten messed up, I had to go back in the beginning of my wallet and accounts setup, and I see now it was the right thing to do to start again with a clean start. I removed the keys from my wallet, started with new keys and went through the steps of the course again.

I created a new account that I called “gemeos”:

I could get account with my new keypair:

I compiled the contract:

Then I created the eosio.token account:

Then I deployed the contract to the eosio.token account (with --abi :grin:)

I successfully created tokens:

And I successfully issued tokens, finally!! :grinning:

Lastly, I could check the account balance:

Thank you Carlos for your help and your patience!! :+1:

1 Like

Congratulations sir! I know that EOS programming course is really hard to achieve, so be very proud of yourself! Welcome to the club of students that has been able to finish one of the most challenged course in the Academy! :partying_face:

Carlos Z.

1 Like

You’re welcome Carlos.

Well, the EOS 201 course is not completely finished yet, but the Token Creation section is completed. That was a big milestone! :smile:

1 Like

I do not understand this error msg:

cherrybluemoon@Markandrews-MacBook-Pro eosio.token % cleos create account permission redruby active eosio.code EOS5kkQdeGrCiguLhyiLpNUpKWW6GsKFGi3J3YnkVts3SFb9zzm1x

Warning: Failed to set locale category LC_NUMERIC to en_NO.

Warning: Failed to set locale category LC_TIME to en_NO.

Warning: Failed to set locale category LC_COLLATE to en_NO.

Warning: Failed to set locale category LC_MONETARY to en_NO.

Warning: Failed to set locale category LC_MESSAGES to en_NO.
ERROR: ExtrasError: [EOS5kkQdeGrCiguLhyiLpNUpKWW6GsKFGi3J3YnkVts3SFb9zzm1x]
cherrybluemoon@Markandrews-MacBook-Pro eosio.token % cleos set contract eosio.token /Users/cherrybluemoon/eos-contracts/eosio.contracts/contracts/eosio.token ./eosio.token.wasm --abi eosio.token.abi -p eosio.code@active
Publishing contract...

Error 3090003: Provided keys, permissions, and delays do not satisfy declared authorizations

Ensure that you have the related private keys inside your wallet and your wallet is unlocked.

Error Details:

transaction declares authority '{"actor":"eosio.code","permission":"active"}', but does not have signatures for it.

Hello sir, the first error you are facing is because that’s not the proper way to create an account.

Command syntax is:

cleos create account eosio [accountNameHere] [ownerKey] [activeKey]

accounts name must contain 12 words.

The second error, you are trying to deploy the eosio.token contract right? the issue is on the permission account, you should use eosio.token account, not eosio.code.

last command should be:

-p eosio.token@active

Remember you can use my notes to guide you on the process for the commands.
thecil/github/EOSIO CLI commands.

Hope you find this useful.
If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

@thecil Thanks Carlos. I am following your steps in thecil/github. I’ve seen this error msg. some where in chat before.

password: Error 3120007: Already unlocked
Error Details:
Wallet is already unlocked: redruby

cherrybluemoon@Markandrews-MacBook-Pro eosio.token % cleos create account eosio eosio.token EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas

Error 3090003: Provided keys, permissions, and delays do not satisfy declared authorizations

Ensure that you have the related private keys inside your wallet and your wallet is unlocked.

Error Details:

transaction declares authority '{"actor":"eosio","permission":"active"}', but does not have signatures for it.

Does the mean I need create eosio.code?

The correct way to create an account eosio.token with eosio is as follows:

cleos system newaccount eosio eosio.token EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas --stake-net "1 EOS" --stake-cpu "1 EOS" --buy-ram-kbytes 4

The second error you have is because you don’t have the key for eosio stored in your wallet, add it with:
cleos wallet import
And then paste the private key for eosio into the wallet

The amounts for stake-net and stake-cpu determine how much starting CPU and NET bandwidth will be available.

The amount of RAM you buy will affect the ability to set a contract on the account. 4 KB is the minimum to create an account, and then you need more to set a contract. If you are doing it on a local testnet I would just assign 1000KB for each account that needs RAM to create a smart contract

2 Likes

@Phillip_Hamnett Welcome to the community. I had imported the key into wallet:

cherrybluemoon@Markandrews-MacBook-Pro eosio.token % cleos wallet private_keys -n redruby
Warning: Failed to set locale category LC_NUMERIC to en_NO.
Warning: Failed to set locale category LC_TIME to en_NO.
Warning: Failed to set locale category LC_COLLATE to en_NO.
Warning: Failed to set locale category LC_MONETARY to en_NO.
Warning: Failed to set locale category LC_MESSAGES to en_NO.
password: [[
    "EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas",
    "5JzQxARbUcdLERCZGKVwCgNqJSW38tNPjfdaWSUYYGZDfw1mVFm"
  ]
]

and when I ran
`leos system newaccount eosio eosio.token EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas

I received
ERROR: RequiredError: --stake-net
RROR: RequiredError: --stake-cpu
But resolved with and tried both:

cleos system newaccount --stake-net 1 --stake-cpu 1 creator redruby  eosio eosio.token EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas
ERROR: ExtrasError:

and

cleos system newaccount --stake-net 1 --stake-cpu 1 creator redruby  eosio eosio.token EOS8J867tVruU99vExJWbWGzMVCZN1VDVuJ3xs7SRa7K8E9qRYxas
ERROR: ExtrasError:

I edited my post, please check it again. Sorry I forgot the additional options that were required

2 Likes

@Phillip_Hamnett
It worked after I used the keys from default wallet instead of the wallet I created with different name. Thank you for helping me get through that step.

I final step has got me stump. I was able to create token:
# eosio.token <= eosio.token::create {"issuer":"redruby","maximum_supply":"1000 REDCOIN"}

However I am stuck on trying to issue token:

cleos push action eosio.token issue '["redruby","1000 REDCOIN","Memo"]' -p *eosio@active*

or

cleos push action eosio.token issue '["redruby","1000 REDCOIN","Memo"]' -p *eosio.token@active*

or

cleos push action eosio.token issue '["redruby","1000 REDCOIN","Memo"]' -p ***redruby@active***
Error 3090004: Missing required authority

Ensure that you have the related authority inside your transaction!;

If you are currently using 'cleos push action' command, try to add the relevant authority using -p option.

Error Details:

missing authority of redruby

Don’t use asterix in the permission.
The permission must be eosio.token.
You must issue to eosio.token and then transfer from eosio.token to redruby

1 Like
I’m using @thecil EOSIO CLI commands:

Issue the tokens to an account
cleos push action eosio.token issue '["accountNameHere","XXXXXXNAMECOINHERE","WriteAMemoHere"]' -p <account>@active

Mine is:
cleos push action eosio.token issue ‘[“redruby”,“1000 REDCOIN”,“Memo”]’ -p eosio.token@active

I checked my account which is eosio <= eosio::setcode {"account":"eosio.token"
and issue by:
eosio.token <= eosio.token::create {"issuer":"redruby"

But still receive as mentioned previously `Error 3090004: Missing required authority
Ensure that you have the related authority inside your transaction!;
If you are currently using ‘cleos push action’ command, try to add the relevant authority using -p option.

I have used option -p
I do not understand missing authority when there is -p

Can you show me the issue action from the eosio.token contract that you are using? Perhaps there is a dodgy require_auth in there?

1 Like

@filip
Can I have one account with many contracts? I mean, can I push two different contracts into the same account?