I am trying to send a full block with a transaction payload to the Shimmer Testnet through this endpoint.
The payload has a transaction essence with one UTXO Input and creates a Basic Output.
The Basic Output has a sender and a metadata feature.
The resulting block I want to send to the nodes by using this API is the following:
{
"nonce": "6917529027641084997",
"parents": [
"0x44dce422284cdb0362eebcc23071ab607cd9df23fcbe397de98c9e587c90b4d6",
"0x6c2ad13c4cdd354d4ee09887163e8ab9074968080e6a4692524f2f0860518e8a",
"0x886429be5444321d87eeb73727ea5e397052416048d7f24dfa165f432f9b41ac",
"0xffdf2181ba2b9fa1d8f3d03638e0545b7c411efdc227b3fda7713a648cb1de70"
],
"payload": {
"essence": {
"inputs": [
{
"transactionId": "0x96bcc148d0bbb054705af748e65be7c3b48682736d791a4cf15994f03e462cc6",
"transactionOutputIndex": 0,
"type": 0
}
],
"inputsCommitment": "0x22d8eb5dc1f632414b3af3f5299f94b38970db10388a104e4172e429ab314130",
"networkId": "8342982141227064571",
"outputs": [
{
"amount": "1000000000",
"features": [
{
"sender": {
"pubKeyHash": "0x34d6c6e1ba34fdfc802d6b3642eeaf5ce47b90f918c039811318301ae91ab727",
"type": 0
},
"type": 0
},
{
"data": "0x646174612066726f20494f54412d5154",
"type": 2
}
],
"type": 3,
"unlockConditions": [
{
"address": {
"pubKeyHash": "0x34d6c6e1ba34fdfc802d6b3642eeaf5ce47b90f918c039811318301ae91ab727",
"type": 0
},
"type": 0
}
]
}
],
"payload": null,
"type": 1
},
"type": 6,
"unlocks": [
{
"signature": {
"publicKey": "0x34d6c6e1ba34fdfc802d6b3642eeaf5ce47b90f918c039811318301ae91ab727",
"signature": "0x7a551706826ce89df9ddf3576c027745bb1a27f280aa73154b7a11b31db0d752ccdca91c48332716eabc5aa18a136dd8a896dddc51649d12cc355a9f9f3f4f0a",
"type": 0
},
"type": 0
}
]
},
"protocolVersion": 2
}
So I want to create and output of 1000000000 smr by consuming an input that holds that amount of smr. The output to be created has to be unlocked with the same keys that the consumed input. My intention is to store some custom metadata in the generated output. I have been able to send Tagged data payloads and fulfill PoW. Edited: Also I have been able to send a Transaction payload with metadata and tag features. This error only happens when adding a sender feature.
The problem is that when i send this block to the node the node return error 500 with message
"internal server error. error: runtime error: invalid memory address or nil pointer dereference".
If someone knows what it is wrong with this procedure and block please let me know. Thank you for your time.
More on the procedure:
"parents" are obtained by /api/core/v2/tips
"transactionId" and "transactionOutputIndex" are obtained by /api/indexer/v1/outputs/basic?address=rms1qq6dd3hphg60mlyq944nvshw4awwg7uslyvvqwvpzvvrqxhfr2mjwxq7n33 and then api/core/v2/outputs/0x96bcc148d0bbb054705af748e65be7c3b48682736d791a4cf15994f03e462cc60000
"inputsCommitment" is the result of serializing the "output" field from api/core/v2/outputs/0x96bcc148d0bbb054705af748e65be7c3b48682736d791a4cf15994f03e462cc60000 and getting the hash by Blake2b_256. Edited Note: You need to hash twice
"signature" is the ed25519 signature of the Blake2b_256 hash of the serialized essence using the keypairs from the address rms1qq6dd3hphg60mlyq944nvshw4awwg7uslyvvqwvpzvvrqxhfr2mjwxq7n33.
"networkId" is the first 8 bytes of the Blake2b_256 hash of "testnet"
"nonce" is calculated to produce a curlp81 hash with more than 13 zeros to get a pow score greater than 1500