2

I am trying to write a python script to call my test network and create accounts and push transactions.

Is there any good RPC examples of creating and pushing transactions. The examples I found stop short of making the whole transaction.

Example code. I get invalid packed transaction when calling this:

tx_test ="{\"actions\": [{\"account\": \"eosio\", \"name\": \"test\", \"authorization\": [{\"actor\": \"eosio\", \"permission\": \"active\"}], \"data\": { \"creator\": \"eosio\", \"name\": \"test\", \"owner\": { \"threshold\": 1, \"keys\": [{ \"key\": \"EOS7Zw9q1J6VpSf7wFXnxPSUH3Pbgj2LiX3woKCWvxU6VerE3tCVX\", \"weight\": \"1\" }], \"accounts\": [], \"waits\": []}, \"active\": { \"threshold\": \"1\", \"keys\": [{ \"key\": \"EOS7Zw9q1J6VpSf7wFXnxPSUH3Pbgj2LiX3woKCWvxU6VerE3tCVX\", \"weight\": \"1\" }], \"accounts\": [], \"waits\": [] }}}]}"

tx_test = "[" + tx_test + ", [\"" + public_key + "\"]," + "\"" + chain_id + "\"]"


surl="sign_transaction"

payload = tx_test
print(tx_test)

response = requests.request("POST", wurl + surl, data=payload)
print(response.text)
  • you can try eosnewyork's eospy – Jimmy Guo Oct 10 '18 at 2:01
  • @JimmyGuo I have put code together. I am running this in my own test net. I know get this error: Error', 'error': {'code': 3050000, 'name': 'action_validate_exception', 'what': 'Action validate exception', 'details': [{'message': 'Unknown action buyrambytes in contract eosio', 'file': 'chain_plugin.cpp', 'line_number': 1643, 'method': 'abi_json_to_bin'}, {'message': 'code: eosio, action: buyrambytes, args: {"payer":"eosio","receiver":"testtesttest","bytes":8192}', 'file': 'chain_plugin.cpp', 'line_number': 1654, 'method': 'abi_json_to_bin'}]}} – btclibertarian Oct 10 '18 at 21:32
  • @btclibertarian check out that if your test net have added the eosio system contract – Jimmy Guo Oct 11 '18 at 7:23
  • @JimmyGuo Yes. I do the following when building my system: cd /eos/contracts/eosio.system && eosiocpp -o eosio.system.wast eosio.system.cpp I can create accounts with my cleos command line so I know everything is in the system. However, I do not stake EOS in my cleos command line test system. Just like the training site. – btclibertarian Oct 11 '18 at 12:50

Your Answer

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

Browse other questions tagged or ask your own question.