failure to submitting using ogmios #413
reitcircles
started this conversation in
General
Replies: 2 comments 1 reply
-
@nielstron : could you pls check ...probably you are able to find the problem fast. thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
-
It seems like something when wrong in deriving the verification key. What does it show when you print the following?
Also, are you certain that |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here is the code:
``
import pycardano as pyc
network = pyc.Network.TESTNET
Read keys to memory
psk = pyc.PaymentExtendedSigningKey.load("payment.skey")
ssk = pyc.StakeExtendedSigningKey.load("stake.skey")
pvk = pyc.PaymentVerificationKey.from_signing_key(psk)
svk = pyc.StakeVerificationKey.from_signing_key(ssk)
Derive an address from payment verification key and stake verification key
address = pyc.Address(pvk.hash(), svk.hash(), network)
print(address)
Create an Ogmios chain context. In this example, we will use preprod network.
context = pyc.OgmiosV6ChainContext("localhost", 1337)
Create a transaction builder
builder = pyc.TransactionBuilder(context)
Tell the builder that transaction input will come from a specific address, assuming that there are some ADA and native
assets sitting at this address. "add_input_address" could be called multiple times with different address.
builder.add_input_address(address)
Get all UTxOs currently sitting at this address
utxos = context.utxos(address)
print(utxos)
We can also tell the builder to include a specific UTxO in the transaction.
Similarly, "add_input" could be called multiple times.
builder.add_input(utxos[0])
builder.ttl = 3600
output_address = pyc.Address.from_primitive("addr_test1qrwcxmlx56njze57fjypt2f6q2ctpv2tvx2gf2mf866ajsasqj43gyduezd0crpju8l9ps4fuu94z0rp86t00c4m3nzs8yf0nd")
output_value = pyc.Value.from_primitive([2000000,])
txout = pyc.TransactionOutput(output_address, output_value)
builder.add_output(txout)
Create final signed transaction
signed_tx = builder.build_and_sign([psk], change_address=address)
print(signed_tx)
Submit signed transaction to the network
context.submit_tx(signed_tx)
get_mempool_contents()
``
Here is the error:
raise ResponseError(f"Ogmios responded with error: {response}") ogmios.errors.ResponseError: Ogmios responded with error: {'jsonrpc': '2.0', 'method': 'submitTransaction', 'error': {'code': -32602, 'message': "Invalid transaction; It looks like the given transaction wasn't well-formed. Note that I try to decode the transaction in every possible era and it was malformed in ALL eras. Yet, I can't pinpoint the exact issue for I do not know in which era / format you intended the transaction to be. The 'data' field, therefore, contains errors for each era.", 'data': {'babbage': "invalid or incomplete value of type 'Transaction': decodeVerKeyDSIGN: wrong length, expected 32 bytes but got 0", 'conway': "invalid or incomplete value of type 'Transaction': decodeVerKeyDSIGN: wrong length, expected 32 bytes but got 0", 'alonzo': "invalid or incomplete value of type 'Transaction': decodeVerKeyDSIGN: wrong length, expected 32 bytes but got 0", 'mary': "invalid or incomplete value of type 'Transaction': Size mismatch when decoding Object / Array. Expected 4, but found 3.", 'allegra': "invalid or incomplete value of type 'Transaction': Size mismatch when decoding Object / Array. Expected 4, but found 3.", 'shelley': "invalid or incomplete value of type 'Transaction': Size mismatch when decoding Object / Array. Expected 4, but found 3."}}, 'id': None}
Have followed this: https://ogmios-python.readthedocs.io/en/stable/examples/build_tx_pycardano.html
Any help appreciated
Beta Was this translation helpful? Give feedback.
All reactions