Giter Site home page Giter Site logo

Comments (10)

cffls avatar cffls commented on July 30, 2024 1

Closing this issue as it is not reproducible now. @robinboening If you encounter this problem again, please feel free to reopen this issue.

from pycardano.

cffls avatar cffls commented on July 30, 2024

Hi Robin, the code looks correct to me. Could you provide the CBOR, which can help debugging? It will be great if you can also provide the code that submits the transaction cbor.

from pycardano.

robinboening avatar robinboening commented on July 30, 2024

Hey Jerry,

the cbor looks like this

84a400818258207c806478ff2de0c970523870cd57f508c0634c0dd0005ef835c16ef7a9c8001800018282583900b5b7e62899719388be48d412e1384311a68e44a01633d5185b203a643a746b909de8d2e7747ccb76125b25d98d198b9950f39fd70eb335611b0000000253bf98c082583900b56bb1f70feb383207c926af89ede6934f2faca85037f3d982801e5a4b1ab3fccc016ccdebd20006fe167d4e40bd1a12f934fdc4dd7574571a0049b9c3021a0002917d031a00acb03ca100818240584056be2bf9c7c3a6f8d429bfe31febb794b6ec4ccd64139dc179f15688330105c4cb8bb886da54f3fff3b7e342d856b688396c597d226ed6ff5d2a553ecb029408f5f6

and the submission is simple as this

tx = builder.build_and_sign([payment_signing_key], change_address=address)
CHAIN_CONTEXT.submit_tx(tx.to_cbor())

from pycardano.

cffls avatar cffls commented on July 30, 2024

Thanks, this is very helpful. What I found is that the verification key in the witness of cbor is empty.

echo 84a400818258207c806478ff2de0c970523870cd57f508c0634c0dd0005ef835c16ef7a9c8001800018282583900b5b7e62899719388be48d412e1384311a68e44a01633d5185b203a643a746b909de8d2e7747ccb76125b25d98d198b9950f39fd70eb335611b0000000253bf98c082583900b56bb1f70feb383207c926af89ede6934f2faca85037f3d982801e5a4b1ab3fccc016ccdebd20006fe167d4e40bd1a12f934fdc4dd7574571a0049b9c3021a0002917d031a00acb03ca100818240584056be2bf9c7c3a6f8d429bfe31febb794b6ec4ccd64139dc179f15688330105c4cb8bb886da54f3fff3b7e342d856b688396c597d226ed6ff5d2a553ecb029408f5f6 | xxd -r -p | base64 | python3 -m cbor2.tool -d | jq
[
  {
    "0": [
      [
        "|\\x80dx\\xff-\\xe0\\xc9pR8p\\xcdW\\xf5\b\\xc0cL\r\\xd0\u0000^\\xf85\\xc1n\\xf7\\xa9\\xc8\u0000\u0018",
        0
      ]
    ],
    "1": [
      [
        "\u0000\\xb5\\xb7\\xe6(\\x99q\\x93\\x88\\xbeH\\xd4\u0012\\xe18C\u0011\\xa6\\x8eD\\xa0\u00163\\xd5\u0018[ :d:tk\\x90\\x9d\\xe8\\xd2\\xe7t|\\xcbv\u0012[%ٍ\u0019\\x8b\\x99P\\xf3\\x9f\\xd7\u000e\\xb35a",
        9995000000
      ],
      [
        "\u0000\\xb5k\\xb1\\xf7\u000f\\xeb82\u0007\\xc9&\\xaf\\x89\\xed\\xe6\\x93O/\\xac\\xa8P7\\xf3ق\\x80\u001eZK\u001a\\xb3\\xfc\\xcc\u0001l\\xcd\\xeb\\xd2\u0000\u0006\\xfe\u0016}N@\\xbd\u001a\u0012\\xf94\\xfd\\xc4\\xddutW",
        4831683
      ]
    ],
    "2": 168317,
    "3": 11317308
  },
  {
    "0": [
      [
        "",    <-------- This is the problem
        "V\\xbe+\\xf9\\xc7æ\\xf8\\xd4)\\xbf\\xe3\u001f뷔\\xb6\\xecL\\xcdd\u0013\\x9d\\xc1y\\xf1V\\x883\u0001\u0005\\xc4ˋ\\xb8\\x86\\xdaT\\xf3\\xff\\xf3\\xb7\\xe3B\\xd8V\\xb6\\x889lY}\"n\\xd6\\xff]*U>\\xcb\u0002\\x94\b"
      ]
    ]
  },
  true,
  null
]

The verification key was created and added to witness set by this line, which calls to_verification_key that yielded an empty vkey. Could you call to_verification_key from signing key directly and check if it is empty?

from pycardano.

robinboening avatar robinboening commented on July 30, 2024

Calling to_verification_key on the signing_key returns a proper key

{"type": "PaymentVerificationKeyShelley_ed25519", "description": "PaymentVerificationKeyShelley_ed25519", "cborHex": "5820ae60924a2a814453c0fc57a9a3e685643ed5a6f5af227298cb5105a12f25092e"}

from pycardano.

robinboening avatar robinboening commented on July 30, 2024

I tried using v0.6.3 and 0.7.0 by the way

from pycardano.

cffls avatar cffls commented on July 30, 2024

Thanks Robin. Could you try constructing the signed transaction manually like this and share the output? This will help us understand which step went wrong.

...
tx_body = builder.build(change_address=address)
signature = payment_signing_key.sign(tx_body.hash())
vk = payment_signing_key.to_verification_key()
print(vk)
vk_witnesses = [VerificationKeyWitness(vk, signature)]
print(vk_witnesses)
tx = Transaction(tx_body, TransactionWitnessSet(vkey_witnesses=vk_witnesses))
print(tx)
tx_cbor = tx.to_cbor()
print(tx_cbor)

from pycardano.

robinboening avatar robinboening commented on July 30, 2024

Thanks for your support Jerry!

This is the entire printed output.

{"type": "PaymentVerificationKeyShelley_ed25519", "description": "PaymentVerificationKeyShelley_ed25519", "cborHex": "5820ae60924a2a814453c0fc57a9a3e685643ed5a6f5af227298cb5105a12f25092e"}
[{
  'signature': b'\xfbwE\xfd\xa1Y\xf2YUN\xd3)\x1d\xfd\x80\xdaA\xbf\x8aY\x9d\xbdG\x8eml\xc1\x06;\xc8N\xfb\x88\x17L\xf3\xb2\xe6\xa0\x11\xbb>\x84\x99\x92\xc7\xa9r\xa6\x03\x03W~\n\xa5q\xb6*l\xc8\x01.v\r',
  'vkey': {"type": "PaymentVerificationKeyShelley_ed25519", "description": "PaymentVerificationKeyShelley_ed25519", "cborHex": "5820ae60924a2a814453c0fc57a9a3e685643ed5a6f5af227298cb5105a12f25092e"},
}]
{
  'auxiliary_data': None,
  'transaction_body': {
    'auxiliary_data_hash': None,
    'certificates': None,
    'collateral': None,
    'collateral_return': None,
    'fee': 168317,
    'inputs': [
      {
        'index': 0,
        'transaction_id': TransactionId(hex='7c806478ff2de0c970523870cd57f508c0634c0dd0005ef835c16ef7a9c80018'),
      },
    ],
    'mint': None,
    'network_id': None,
    'outputs': [
      {
        'address': addr_test1qz6m0e3gn9ce8z97fr2p9cfcgvg6drjy5qtr84gctvsr5ep6w34ep80g6tnhglxtwcf9kfwe35vchx2s7w0awr4nx4sstap56q,
        'amount': {'coin': 10000000, 'multi_asset': {}},
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1qz6khv0hpl4nsvs8eyn2lz0du6f57tav4pgr0u7es2qpukjtr2elenqpdnx7h5sqqmlpvl2wgz735yhexn7ufht4w3tsqx0vgv,
        'amount': {'coin': 9989831683, 'multi_asset': {}},
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
    ],
    'reference_inputs': None,
    'required_signers': None,
    'script_data_hash': None,
    'total_collateral': None,
    'ttl': 11392138,
    'update': None,
    'validity_start': None,
    'withdraws': None,
  },
  'transaction_witness_set': {
    'bootstrap_witness': None,
    'native_scripts': None,
    'plutus_data': None,
    'plutus_v1_script': None,
    'plutus_v2_script': None,
    'redeemer': None,
    'vkey_witnesses': [
      {
        'signature': b'\xfbwE\xfd\xa1Y\xf2YUN\xd3)\x1d\xfd\x80\xdaA\xbf\x8aY\x9d\xbdG\x8eml\xc1\x06;\xc8N\xfb\x88\x17L\xf3\xb2\xe6\xa0\x11\xbb>\x84\x99\x92\xc7\xa9r\xa6\x03\x03W~\n\xa5q\xb6*l\xc8\x01.v\r',
        'vkey': {"type": "PaymentVerificationKeyShelley_ed25519", "description": "PaymentVerificationKeyShelley_ed25519", "cborHex": "5820ae60924a2a814453c0fc57a9a3e685643ed5a6f5af227298cb5105a12f25092e"},
      },
    ],
  },
  'valid': True,
}
84a400818258207c806478ff2de0c970523870cd57f508c0634c0dd0005ef835c16ef7a9c8001800018282583900b5b7e62899719388be48d412e1384311a68e44a01633d5185b203a643a746b909de8d2e7747ccb76125b25d98d198b9950f39fd70eb335611a0098968082583900b56bb1f70feb383207c926af89ede6934f2faca85037f3d982801e5a4b1ab3fccc016ccdebd20006fe167d4e40bd1a12f934fdc4dd7574571b000000025370bc03021a0002917d031a00add48aa10081825820ae60924a2a814453c0fc57a9a3e685643ed5a6f5af227298cb5105a12f25092e5840fb7745fda159f259554ed3291dfd80da41bf8a599dbd478e6d6cc1063bc84efb88174cf3b2e6a011bb3e849992c7a972a60303577e0aa571b62a6cc8012e760df5f6

from pycardano.

cffls avatar cffls commented on July 30, 2024

Thanks Robin! This cbor looks correct. If you submit this transaction, it will go through. It is still a mystery to me why build_and_sign resulted in an empty verification key. Is this issue consistently reproducible?

from pycardano.

robinboening avatar robinboening commented on July 30, 2024

Yeah, the tx went through.
Correct, I was consistently getting this error. I've tried about 5-6 times yesterday.

I just put build_and_sign back in, so it is now as it was when I got the error. I tried another transaction and it succeeded! To be honest, now I am completely lost.

from pycardano.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.