The Last Launch Step - how the community takes over from eosio

in eos •  6 years ago  (edited)

How do we propose / approve / execute actions after launch without eosio?

Recently we've been testing different approaches to deploy, validate and stress a chain,but little attention was paid to the last steps, how to give up central control, and how to continue administration without central control.
The Main Steps of Launching are these:

  • Run Bios node with fresh genesis and eosio key
  • Deploy BIOS contract with initial producers
  • Create system accounts
  • Deploy eosio.token and eosio.msig contracts
  • Create and issue tokens
  • Deploy system contract and add privileges for eosio.msig
  • Provide distribution RC20 tokens
  • Resign eosio

Resigning eosio means changing rights for account eosio and all other system accounts.

That means that for user eosio, we set permission to eosio.prods@active . This is a system account with a list of active producers. You can check it with

/cleos.sh get account eosio.prods

For all system accounts (eosio.bpay, eosio.msig, eosio.names, eosio.ram, eosio.ramfee, eosio.saving, eosio.stake, eosio.token, eosio.vpay) set permission active and owner permission to account eosio.

Example of resign script: https://github.com/CryptoLions/EOS-Boot-Steps-dawn4/blob/master/08_RESIGN.sh

After resignation, any changes, transfers, and contract updates can be done by community approval.

photo_2018-06-04_16-10-31.jpg

How to make a proposal for action without eosio

Lets do this with an example transaction, proposing to send a tranfer to user “someuser”.

To make the proposal we will use cleos and multisig propose command.

This command has these parameters:

proposal_name TEXT          proposal name (string) (required)
requested_permissions TEXT  The JSON string or filename defining requested permissions (required)
rx_permissions TEXT        he JSON string or filename defining transaction permissions (required)
contract TEXT               contract to wich deferred transaction should be delivered (required)
action TEXT                 action of deferred transaction (required)
data TEXT                   The JSON string or filename defining the action to propose (required)
proposer TEXT               Account proposing the transaction
proposal_expiration         Proposal expiration interval in hours

Since it will be transfer from eosio we need to include all active producers in requested_permissions. To do this lets create simple bash script which will create a list automatically from

./cleos.sh get account eosio.prods –j

(Note: We were NOT able to simply use eosio.prods with requested_permissions. We had to generate the list with get account.)

requestedPermissions="";
#Get list active producers from eosio.prods and building requestedPermissions
PRODUCERS=$(./cleos.sh get account eosio.prods -j)

for row in $(echo "${PRODUCERS}" | jq -r '.permissions[] | @base64'); do
    _jq() {
     echo ${row} | base64 --decode | jq -r ${1}
    }

    perm_name=$(_jq '.perm_name')
    if [ "$perm_name" == "active" ]; then

        data_=$(_jq '.required_auth')
        for accs in $(echo "${data_}" | jq -r '.accounts[] | @base64'); do
                _jq() {
                echo ${accs} | base64 --decode | jq -r ${1}
            }
            account=$(_jq '.permission.actor')
            permission=$(_jq '.permission.permission')

            #bp="$account@$permission"

            # Building requestedPermissions
            requestedPermission='{"actor": "'$account'", "permission": "'$permission'"}'
            if [ "$requestedPermissions" != "" ]; then
                requestedPermissions+=", "
            fi
            requestedPermissions+="$requestedPermission"
        done
        requestedPermissions="[$requestedPermissions]"
        #echo $requestedPermissions
    fi
done

Next, we will make a proposal for transfer (it can be any action to any contract):

CONTRACT="eosio.token"
ACTION="transfer"
DATA='{"from": "eosio", "to": "someuser", "quantity": "123.0000 EOS", "memo": "compensation"}'

 
The full command will be:

./cleos.sh multisig propose "$proposalName" "$requestedPermissions" "$trxPermissions" $CONTRACT $ACTION "$DATA" $proposer $EXPIRATION_IN_H -p $proposer

 
The full example script which does all of the above is found here: https://github.com/CryptoLions/EOS-Boot-Steps-dawn4/blob/master/16_1_MSIG_TRANSFER_PROPOSE.sh

Approval

After a proposal is made, block producers from list need to approve this transaction. The number of approvals required is determined by the threshold.

The approval command is:

./cleos.sh multisig approve $proposer $proposalName "$permissions" -p $ACCOUNT

Full example: https://github.com/CryptoLions/EOS-Boot-Steps-dawn4/blob/master/16_2_MSIG_TRANSFER_APPROVE.sh

Execution

After sufficient approvals are made, the transfer can be executed:
./cleos.sh multisig exec $proposer "$proposalName" -p $proposer

Example: https://github.com/CryptoLions/EOS-Boot-Steps-dawn4/blob/master/16_3_MSIG_TRANSFER_EXEC.sh

List Proposals and approvals

You can list all proposals:

./cleos.sh get table eosio.msig $ACCOUNT proposal

And all approvals:

./cleos.sh get table eosio.msig $ACCOUNT approvals

🦁🦁🦁

We hope this manual was useful for you.

All our Bootsteps examples can be found here: https://github.com/CryptoLions/EOS-Boot-Steps-dawn4

Lastly, we welcome everyone to Jungle testnetwok, to learn and test together: http://jungle.cryptolions.io/

🦁🦁🦁

http://cryptolions.io/
https://github.com/CryptoLions
https://busy.org/@cryptolions
https://steemit.com/@cryptolions
https://twitter.com/EOS_CryptoLions
https://www.youtube.com/channel/UCB7F-KO0mmZ1yVBCq0_1gtA
Jungle Testnet Monitor: http://jungle.cryptolions.io/
General CryptoLions Chat: https://t.me/block_producer_candidate
Testnet Chat: https://t.me/jungletestnet

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thanks for the post about EOS

wow, some impressive work done here!