3

In contracts/eosio.system/eosio.system.cpp, the following function has the owner and active authority parameters commented:

   void native::newaccount( account_name     creator,
                            account_name     newact
                            /*  no need to parse authorities
                            const authority& owner,
                            const authority& active*/ ) {

Note the block commenting around owner/active parameters.

For the ABI, I think the BOOST_PP_SEQ_FOR_EACH macro has some magic here to add these fields to the ABI input even though they are commented.

My question is: how do the owner and active authorities get established if the smart contract doesn't do anything with them? Cleos seems to only call this 1 action (looking at the -d output) so I don't think there is a second action called that sets owner/active separately.

Any general pointers in the right direction are appreciated, my C++ experience is somewhat sparse and is apparently some macro-voodoo going on here I'm not familiar with.

1

I don't know exactly how this is wired together (I'm new to C/C++), but the system contract has some parts that run in the WASM side (smart contract, which is what you found) and some that run on the nodeos compiled binary which is like the underlying layer. Specifically, you'll find where the newaccount action gets handled in that layer in this file:

https://github.com/EOSIO/eos/blob/master/libraries/chain/eosio_contract.cpp#L70

You'll notice that it unpacks the action data (including the missing parameters that you were asking about) and that it operates on the DB in a different way than in smart contracts. This is the lower-level access that only this platform layer can access.

-2

Hmm owner is basically an account and you don't need any smart contract to create and account. you just need an existing account as creator for your account and it will use its resources and charge you for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.