Convenient script for quickly generating transactions containing data

Hello!
I’m hoping to timestamp data on Rootstock at relatively low latency, ideally via Python. The most straightforward mechanism would seem to be to include the hashes as data in the sending of a raw transaction. There are Ethereum libraries which appear to make this fairly straightforward, but it’s less obvious for Rootstock.

The following code, based around pip’s web3.js returns “ValueError: {‘code’: -32603, ‘message’: ‘Internal server error’}”.

Any feedback would be appreciated. I would, of course, like to ultimately deploy on mainnet.

from web3 import Web3
from eth_account import Account

my_provider = Web3.HTTPProvider(‘https://public-node.testnet.rsk.co’)
w3 = Web3(my_provider)

private_key = ‘4110ee084c208e8f3c9fd7203c4194e35db519a64c2e9c36b005e425b1356c73’
acct = Account.from_key(private_key)

signed_txn = w3.eth.account.sign_transaction(dict(
nonce=w3.eth.get_transaction_count(w3.toChecksumAddress(acct.address.lower())),
maxFeePerGas=3000000000,
maxPriorityFeePerGas=2000000000,
gas=100000,
to=‘0x0000000000000000000000000000000000000000’,
value=12345,
data=b’',
chainId=31,
),
acct.key,
)
w3.eth.send_raw_transaction(signed_txn.rawTransaction)

Hi Ortho - Did you discuss this with the Discord community? Or are you still looking for help?

Thank you for responding! Apologies for the latency in my response; I was working on another component of the project :smiley:

I was in a hurry for a python-native library for easily generating transactions from a private key with little configuration and overhead. I found a solution which suited me; issuing a token using brownie.

If there’s a default Python library for interacting with Rootstock, now would be a good time for me to switch over. May I ask whether there any commonly used Python-based solutions?

Cool! Did you check out the developer portal? It recently had a big redesign and the AI support tool is great for questions like this.

Web3.py is great for interacting with Rootstock: Deploy and Interact with a Smart Contract using Web3.py | Rootstock Developers Portal

Thank you very much!

I apologise again for the delayed response. I was waiting for confirmation on the shipment of a key piece of equipment. Unfortunately, the optics were unavailable due to a force majeure, causing a multi-month delay.

The silver lining is that this gave me the opportunity to rebuild my code from scratch in a cleaner environment, free of conflicting dependencies. It’s all running much more smoothly now.

The final component has just arrived in the EU and will be in Ireland next week, allowing me to finally release the demo.

Thank you again for your understanding and attention. I hesitated to make predictions earlier due to the unavoidable delays, but we’re now on track.