0

I've searched for the answer on Google to no avail.

I am able to use cleos transfer 2 run the following transactions without an error:

cleos -u <eos ny api url> transfer abcabcabcabc cbacbacbacba '12 EOS' 'action:bet,gameId:122345,item:player,ref:efggfeefggfe'
cleos -u <eos ny api url> transfer abcabcabcabc cbacbacbacba '25 EOS' 'action:bet,gameId:122345,item:player,ref:efggfeefggfe'

Could someone explain how to use cleos push transaction to combine those 2 transfers into one? This would help so as not to have to call cleos repeatedly and just call it once.

1
  • You need to make a abi action that call cbacbacbacba twice. And you have to pass those parameters to that abi action. And inside your new abi action passed those parameters to your cbacbacbacba action. Other wise transfering two transaction using cloes is not possible at same time there should be some delta T time between two transactions Commented Dec 16, 2018 at 6:12

1 Answer 1

1

Cleos Method

You can do it with cleos by creating the json for each transfer, as follows:

cleos transfer from_account, to_account quantity memo -s -d -j

Flags:

-s,--skip-sign              Specify if unlocked wallet keys should be used to sign transaction
-d,--dont-broadcast         don't broadcast transaction to the network (just print to stdout)
-j,--json                   print result as json

This creates json output do this for all the transfers you want to do it for, it should look like this:

{
  "expiration": "2018-10-20T10:54:37",
    "ref_block_num": 92,
    "ref_block_prefix": 276911189,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d0040c85353840ccd102700000000000004454f5300000000046d656d6f"
    }
    ],
    "transaction_extensions": [],
    "signatures": [],
    "context_free_data": []
}

{
  "expiration": "2018-10-20T10:54:42",
    "ref_block_num": 102,
    "ref_block_prefix": 3271438144,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d0080c85353840ccd102700000000000004454f5300000000046d656d6f"
    }
    ],
    "transaction_extensions": [],
    "signatures": [],
    "context_free_data": []
}

{
  "expiration": "2018-10-20T10:54:45",
    "ref_block_num": 109,
    "ref_block_prefix": 718898287,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d00c0c85353840ccd102700000000000004454f5300000000046d656d6f"
    }
    ],
    "transaction_extensions": [],
    "signatures": [],
    "context_free_data": []
}

To make this into one transaction, copy and paste each of the actions into the first json output, as follows:

{
  "expiration": "2018-10-20T10:54:37",
    "ref_block_num": 92,
    "ref_block_prefix": 276911189,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d0040c85353840ccd102700000000000004454f5300000000046d656d6f"
    },{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d0080c85353840ccd102700000000000004454f5300000000046d656d6f"
    },{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
        "actor": "fromaccount",
        "permission": "active"
      }
      ],
      "data": "00f2d4142123e95d00c0c85353840ccd102700000000000004454f5300000000046d656d6f"
    }
    ],
    "transaction_extensions": [],
    "signatures": [],
    "context_free_data": []
}

Finally, save this json file, and execute it as follows:

cleos push transaction ./test.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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