Tables Programming - Discussion

Apparently you have a problem with eosio contracts, please check if you have access to this projects, there should be deployed in the eosio account so it can be able to create new accounts.

In case you dont have those projects, you might have to reset the entire app:

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

Carlos Z.

I checked and all the projects showed up like the picture you had, so I’m not sure what the problem is.

1 Like

Mmmm, last solution could be to reinstall the EOS Studio, if you install all the modules that is need it at the beginning properly, it should deploy the eosio contracts to the eosio account.

Carlos Z

I deleted and reinstalled EOS sand got the same error when I try to deploy it I get the same error Unknown action setcode in contract eosio. i can’t make a new account either.

1 Like

Have you tried to deploy the “eosio” contracts yourself?

If my memory does not fail me, the “eosio.system” contract should be deployed in order to use some functionalities of eosio, like creating new accounts.

What I use is virtual machine for linux, ubuntu 18.04, then I have installed all the tools I need for EOS programming, EOS studio works pretty well on ubuntu. You might wanna try to install a virtual machine for it maybe.

Carlos Z.

Hello.
I have 2 questions about Part 1 - Create Pet Table.

  1. Why do we use “const”:

    • on the class constuctor parameters?
    • on the statements of the getters?
    • on the statement of the primary key?
  2. Why on the constructor parameters of type eosio::name
    we use “const &” and not just “const”?

Thanks.

1 Like

const in my own words: declaration of a variable with a constant (immutable or non-changeable) value.

https://www.geeksforgeeks.org/const-keyword-in-cpp/

Syntax rules to work with friends operators.
https://developers.eos.io/manuals/eosio.cdt/latest/structeosio_1_1name#friend-operator

Here you can read how to work with friends in C++:
https://en.cppreference.com/w/cpp/language/friend

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

Carlos Z.

This is the error message I get after adding 'require_auth(owner);

transaction declares authority ‘{“actor”:“michael”,“permission”:“active”}’, but does not have signatures for it.

Do i just need to redo the key?

thanks ahead of time!

I keep experiencing the same problem again and again. I keep getting a message: transaction declares authority '{"actor":"phillip","permission":"active"}', but does not have signatures for it.

{
```I do not comprehend where to get the signature. If I add a pet on a table and is under my contract name which is defaulted then I can add, modify, and delete an entry. When the lecture changes into coding to ensure only Phillip can modify and access the table, then the problem happens again. If I change the author name the error comes out. If I use the contract name there was no problem, but anyone can and could change data on the table regardless who the owner of the pet is. I like to learn how to change that.
1 Like

Hey @jjusanchez, hope you are well.

Probably you just forgot to add the permissions on the account.
Take a look into this guide i made long ago to follow the process to deploy and run each command properly :nerd_face:

Carlos Z

Hello all who may read this post, I like to ask about output from the editor working with Docker and EOS Studio. I am at part 4 -Check and Authorization of working with tables.- as I followed the lecture, I kept doing what the instructor did, save the code compile it and deploy it. However, an interesting output window came out from Docker. I could not deploy the work. The message read: “Deploy Failed. Unknown action in contract eosio.” It happened soon after coding “require_auth” and this code deployed with no problem. A problem came when I tested the input in the table. I tried to add a pet with index,0; owner, name, type, and so on. When I click the button, it showed an error of -the actor being active, but there is no permission key or authority signature for it. So, I could not check for the validity of the owner and others who may have access to pets. tables. The input table did not work. The following code compiles, yet it did not deploy and the previously mentioned message was sent. What or how should this problem be resolved?

Hey @jjusanchez

Could you please share your code so we can review it together?
You can share it in the following way: FAQ - How to post code in the forum

Carlos Z

image This is my screen. I also have another problem. When following the lecturer, I build and it builds successfully and when I click deploy, it does not succeed. I would share the screenshot.

This is my screen:image After coding “require_auth” it compiled, but it did not deploy.

Phillip, I experience a similar problem and as I was reading looking for my reply - I came across this one in which the problem persists. I stopped and followed the suggestion from your previous video, yet it did not work. I kept turning off the studio and turn it back on and the problem persisted. I could not get the contract deployed…

Is your EOS Studio installed locally on your computer or you are using the online version?

Carlos Z

I have my EOS studio installed locally. There is an icon from the GitHub account which I signed in thinking to sign in to docker. Even before login in to docker without GitHub I had the same problem.

Did you install the eosio contract SDK from the EOS Studio installation process?

I know there are many problems with EOS Studio which related to the sdk version and compiler version, so it could be a challenge by now to make it work properly.

Carlos Z

Hello everyone! I like to ask about the “require_auth” function. I experienced that using the function does not work for my purpose. In previous attempts to implement the code, it compiled and deployed it. Yet, when I am on the pets table and I want to create a pet with the “require_auth()”, function it always showed me that signature is required for the name of the owner I use. I tested various times by creating new contracts and it was the same output. Finally, I got results, but only if I commented on the “require_auth()” function. Then I could add data to the tokens table. I made no mistake in following the lecture and code, the result I got was not easy. I finish the course and that function, “require_auth()”, I left it commented so I could continue without stopping and asking about it waiting for a response. Now, I like to ask how could I do better? I have no clue where I could get the signature for the authorized owner on the contract.

@filip
I have “pet” table, there is eosio::indexed_by “byowner”, it works fine. But, I want to add another indexed_by “bytype”, how to do? My pet table below:

    TABLE pet {
    private:
        uint64_t id;
        name owner;
        name pet_name;
        uint64_t age;
        name type;

    public:

        pet(){}

        pet(
        uint64_t const _id, 
        name const & _owner,
        name const & _pet_name,
        uint64_t const  _age, 
        name const & _type) :
            id(_id), 
            owner(_owner), 
            pet_name(_pet_name), 
            age(_age), 
            type(_type)
            {}

            uint64_t get_id() const { return id;}
            name get_owner() const {return owner;}
            uint64_t get_owner_value() const {return owner.value;}
            name get_pet_name() const {return pet_name;}
            uint64_t get_age() const {return age;}
            name get_type() const {return type;}
            
            uint64_t primary_key() const {return get_id();}

            EOSLIB_SERIALIZE(pet, (id)(owner)(pet_name)(age)(type) )
    };

    eosio::indexed_by<name("byowner"), eosio::const_mem_fun<pet, uint64_t, &pet::get_owner_value>>
    > pets_table;