Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add safety for broadcast when detected invalid ft transfer rules #3

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

atomicals
Copy link
Owner

@atomicals atomicals commented Oct 18, 2023

Purpose of this feature is to add safety checks for when broadcasting a tx to ensure the format of the ARC20 input and output balances correctly.

WARNING: It still does not work for mempool txs. Only attempt with confirmed UTXOs.

The broadcast method blockchain.transaction.broadcast is now protected with the logic and will throw the same error as the new validation method method blockchain.atomicals.validate if it's detected the inputs and outputs will not balance correctly.

Examples:

Successfully validated:

https://eptestnet.atomicals.xyz/proxy/blockchain.atomicals.validate?params=[%220200000000010382676c8767a0903a1e252809dd00220c39f5dda82a3b1be9dbc0207c9b6466560000000000ffffffff82676c8767a0903a1e252809dd00220c39f5dda82a3b1be9dbc0207c9b6466560100000000ffffffff2e23e1cd06a396afaf674bcb2b89b66f95a958cbeef8d8292446947955b927190200000000ffffffff01d007000000000000225120c2529c35bacd75646eb3135ca1270325ba2bab5d473b7c8a1eab54b21deea86e0140cb195f49a51b3406114202d54ec0b7b8d832a6d5ecefa0682de714850fa66f5f1677c3543ec9e89b94f9e71076a1ccf5f778ce4423ad8fdce4836e992f0221b301403af2f03dcfd52f758a35f7fb370722545356386a6c33d2489935966545cc7c2064320ec28984002232e4b48ef12b7a10a3d6efb40872668e1de0871789496abb0140e4062a408a65a0d0867349405e0780f6493fc64d071630d8361fc7dbd8d65013285a99e0c1091213135d4a152bbae7f3935be3742bbb8adb2be9146431f647b900000000%22]&pretty

Error validation:

https://eptestnet.atomicals.xyz/proxy/blockchain.atomicals.validate?params=[%2202000000000102f53eff1c70b342676fb320ea50a371bfb0b7d6d528294a608a4aa3a7dfde3db70000000000ffffffffbd1e98390db784e02274db66db224b65ab60eb1be8d5f5afbdde87311d1aa8c60200000000ffffffff015704000000000000225120c2529c35bacd75646eb3135ca1270325ba2bab5d473b7c8a1eab54b21deea86e0140afcdce9cc2245699875611414bc380efa5eceabc10439ceb3e2bb9bf4a3f3b01db330b532ff7a5668973c24cd0280e190fca0b76ddd949dab1f982313a9d003401403d87d88305d122b483454e8ce39033c05e98e0e9c74ee0d71da1fe892147fa021857cea0c4c01be363652ad5951c905cfb48fdbf1534e3c0b9026f5312b15ac600000000%22]&pretty

Also added helper method:

blockchain.atomicals.validate which takes the rawtx to test if it's validated for ARC20 (inputs and outputs balance).

Future Action

  • Add mempool tracking of Atomicals so tx's which are not yet confirmed, but which may contain Atomicals do not get accidentally spent incorrectly.

@atomicals atomicals force-pushed the validatedbroadcast branch 2 times, most recently from 4fc35d1 to 49adec7 Compare October 18, 2023 13:57
@atomicals atomicals merged commit a861508 into master Oct 18, 2023
@ndcc5 ndcc5 mentioned this pull request Dec 29, 2023
@atomicals atomicals deleted the validatedbroadcast branch April 10, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant