1

Can someone please add code example or describe how to only bill first authorizer?

I have tried but can't get it to work.

enter image description here Thanks!

  • when you put two actions in one transaction, it will only bill the first action's authorizer – Jimmy Guo Oct 9 '19 at 1:54
  • Thanks. I tried putting two actions in one transaction, where the first action's authorizer is the contract account. But still, the second action's authorizer is billed. I also tried to add two authorizers for the second action, where the first authorizer is the contract account. And again - the second authorizer is billed for cpu and net. – Bjørn Omsland Oct 9 '19 at 9:04
  • because the feature has not been activated yet, wait for the bps' proposal – Jimmy Guo Oct 9 '19 at 14:21
  • @bjørn-omsland can share your code? – tvrc4m Oct 19 '19 at 12:45
  • I need Code examples for ONLY_BILL_FIRST_AUTHORIZER, very thankful. – 张志洋 Oct 24 '19 at 2:58
2

The ONLYBILL1ST proposal has now been approved by 15 Block producers. I have tested and OnlyBillFirstAuthorizer is working now.

I'm using eos-sharp. But it's very similar to eos-js. It's very simple. Just add the account you want to bill for the transaction first in the 'authorization'-part.

    //Add the private keys 
    List<string> lstSignProviders = new List<string>();
    lstSignProviders.Add("privateKeyForOnlyBillFirstAuthorizer"); //ONLY_BILL_FIRST_AUTHORIZER
    lstSignProviders.Add("privateKeyForTheAccountExecuting");

    Eos eos = new Eos(new EosConfigurator()
    {
        HttpEndpoint = eosHttpEndpoint,
        ChainId = eosChainId,
        ExpireSeconds = 20,
        SignProvider = new EosSharp.Core.Providers.DefaultSignProvider(lstSignProviders)
    });

    var result = eos.CreateTransaction(new Transaction()
    {
        actions = new List<EosSharp.Core.Api.v1.Action>(){
            new EosSharp.Core.Api.v1.Action()
            {
                account = "eosio.token",
                authorization = new List<PermissionLevel>()
                {
                    new PermissionLevel() {actor = "accountToBillForCpuNet", permission = "active" },
                    new PermissionLevel() {actor = fromAccount, permission = "active" }
                },
                name = "transfer",
                data = new { from = fromAccount,
                                to = toAccount,
                                quantity = "1.0000 EOS",
                                memo = ""}
            }
        }
    }).Result;`enter code here`
|improve this answer|||||
  • While correct, your original question asked to provide code example. If you are going to answer your original question you should at least provide a code example for future readers. – netuoso - EOS Titan Oct 28 '19 at 8:56
  • Yes, I agree. I have added code example now. – Bjørn Omsland Oct 29 '19 at 10:50

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.