Comments (3)
What version of python are you using? Using the below code and python 3.7 I can see all all the transactions being pushed to the chain. The issue is that some of the transactions are the same so 2 fail as duplicate. I also noticed some incorrect parameters in the payload.
import eospy.cleos
import concurrent.futures
import time
ce = eospy.cleos.Cleos(url='http://api.pennstation.eosnewyork.io:7001')
def send_tx():
arguments = {
"from": "eosio", # sender
"to": "bob123451234", # receiver
"quantity": '0.1000 EOS', # In EOS
"memo": "this is fake names",
}
payload = {
"account": "eosio.token",
"name": "transfer",
"authorization": [{
"actor": "eosio",
"permission": "active",
}],
}
# Converting payload to binary
data = ce.abi_json_to_bin(
payload['account'], payload['name'], arguments)
# Inserting payload binary form as "data" field in original payload
payload['data'] = data['binargs']
# final transaction formed
trx = {"actions": [payload]}
# trx['expiration'] = str(
# (dt.datetime.utcnow() + dt.timedelta(seconds=60)).replace(tzinfo=pytz.UTC))
# use a string or EOSKey for push_transaction
key = "some key"
resp = ce.push_transaction(trx, key, broadcast=True)
return resp
def main():
t0 = time.time()
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
futures = [executor.submit(send_tx) for _ in range(4)]
for trx in concurrent.futures.as_completed(futures):
try:
data = trx.result()
except Exception as e:
print(f'exception: {e}')
else:
print(data)
t1 = time.time()
print(f'duration: {t1 - t0}')
if __name__ == "__main__":
main()
OUTPUT:
{'transaction_id': '0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'processed': {'id': '0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'receipt': {'status': 'executed', 'cpu_usage_us': 602, 'net_usage_words': 18}, 'elapsed': 602, 'net_usage': 144, 'scheduled': False, 'action_traces': [{'receipt': {'receiver': 'eosio.token', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 903, 'recv_sequence': 58, 'auth_sequence': [['eosio', 810]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 336, 'console': '', 'trx_id': '0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': [{'receipt': {'receiver': 'eosio', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 904, 'recv_sequence': 735, 'auth_sequence': [['eosio', 811]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 19, 'console': '', 'trx_id': '0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': []}, {'receipt': {'receiver': 'bob123451234', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 905, 'recv_sequence': 6, 'auth_sequence': [['eosio', 812]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 6, 'console': '', 'trx_id': '0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': []}]}], 'except': None}}
{'transaction_id': '5dda72c4c08387cb3e00da9f961375af4a0062a615468080de9ad7cad43769fa', 'processed': {'id': '5dda72c4c08387cb3e00da9f961375af4a0062a615468080de9ad7cad43769fa', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'receipt': {'status': 'executed', 'cpu_usage_us': 592, 'net_usage_words': 18}, 'elapsed': 592, 'net_usage': 144, 'scheduled': False, 'action_traces': [{'receipt': {'receiver': 'eosio.token', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 906, 'recv_sequence': 59, 'auth_sequence': [['eosio', 813]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 311, 'console': '', 'trx_id': '5dda72c4c08387cb3e00da9f961375af4a0062a615468080de9ad7cad43769fa', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': [{'receipt': {'receiver': 'eosio', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 907, 'recv_sequence': 736, 'auth_sequence': [['eosio', 814]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 19, 'console': '', 'trx_id': '5dda72c4c08387cb3e00da9f961375af4a0062a615468080de9ad7cad43769fa', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': []}, {'receipt': {'receiver': 'bob123451234', 'act_digest': 'c7e0251d1e15c1f19d3917525ae422bc70f3fe191a45782aa1dbb5c81b352905', 'global_sequence': 908, 'recv_sequence': 7, 'auth_sequence': [['eosio', 815]], 'code_sequence': 1, 'abi_sequence': 1}, 'act': {'account': 'eosio.token', 'name': 'transfer', 'authorization': [{'actor': 'eosio', 'permission': 'active'}], 'data': {'from': 'eosio', 'to': 'bob123451234', 'quantity': '0.1000 EOS', 'memo': 'this is fake names'}, 'hex_data': '0000000000ea3055408608850c110e3de80300000000000004454f530000000012746869732069732066616b65206e616d6573'}, 'context_free': False, 'elapsed': 5, 'console': '', 'trx_id': '5dda72c4c08387cb3e00da9f961375af4a0062a615468080de9ad7cad43769fa', 'block_num': 569, 'block_time': '2019-03-04T14:28:29.500', 'producer_block_id': None, 'account_ram_deltas': [], 'except': None, 'inline_traces': []}]}], 'except': None}}
exception: Error: {'code': 409, 'message': 'Conflict', 'error': {'code': 3040008, 'name': 'tx_duplicate', 'what': 'Duplicate transaction', 'details': [{'message': 'duplicate transaction 0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'file': 'producer_plugin.cpp', 'line_number': 392, 'method': 'on_incoming_transaction_async'}]}}
exception: Error: {'code': 409, 'message': 'Conflict', 'error': {'code': 3040008, 'name': 'tx_duplicate', 'what': 'Duplicate transaction', 'details': [{'message': 'duplicate transaction 0f7d85fb37dbe34c5b1c3d90ed6bea6eafa17aadb3af8ae4ba32b92c6f49f24c', 'file': 'producer_plugin.cpp', 'line_number': 392, 'method': 'on_incoming_transaction_async'}]}}
duration: 3.1731653213500977
from eospy.
Are you still having issues?
from eospy.
closing as there is no response
from eospy.
Related Issues (20)
- Do you have security problems using abi_json_to_bin in your code? HOT 4
- Internal Service Error, unsatisfied_authorization HOT 2
- Create multisig account HOT 6
- "ImportError: cannot import name ABC" HOT 1
- Set Contract HOT 2
- Deserialize a packed trx offline HOT 5
- Can you please publish [email protected] to pypi? HOT 1
- What are the potential risks using eospy EOSKey for mainnet? HOT 1
- long sign time and eosjs verify HOT 20
- what function is equal to eosjs-ecc's ecc.sign or ecc.signHash HOT 1
- create other eosin.token example HOT 1
- AttributeError in example/push_transaction HOT 6
- Can't sign transaction with key.sign(digest)
- 3.6.5 int/float issue HOT 1
- set_code and set_abi do not work HOT 1
- HTTPConnectionPool(host='api.pennstation.eosnewyork.io', port=7001): Max retries exceeded with url: /v1/chain/abi_json_to_bin (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x75c91050>: Failed to establish a new connection: [Errno 111] Connection refused' HOT 2
- Missing changelog HOT 2
- Get children account list HOT 1
- Getting InvalidKeyFile Error HOT 2
- ImportError: cannot import name 'InvalidKeyFile' from 'eospy.exceptions' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eospy.