NEAR Indexer 和 2FA 安全钱包交易
NEAR Indexer and 2FA secured wallet transactions
在 Near,受 2FA 保护的钱包签署的交易以特殊方式(合同确认)完成,与常规交易不同。
签名者和接收者 id 相同的钱包。
样本交易:
https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
如何正确使用它们,在 Indexer 中哪里可以找到它们?
如何正确获取数据,用户签什么合同,签什么方式?
此处为 Explorer 核心贡献者和维护者的 NEAR 索引器。
查看您在问题中提供的交易 https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY 它是方法 confirm
的 FUNCTION CALL
我相信您担心的是,您无法通过使用散列查询 transactions
table 在 public NEAR Indexer for Explorer database 中看到交易结果。
并且说 2FA 交易“不像常规交易”是指涉及 cross-contract 调用的性质。
了解正在发生的事情的方法如下
- 首先,让我们查找您的初始交易及其转换后的收据 ID。
SELECT transaction_hash, converted_into_receipt_id FROM transactions WHERE transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
transaction_hash | converted_into_receipt_id
----------------------------------------------+----------------------------------------------
9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY | FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
根据您发送的这笔交易是对某些 ft_transfer
调用的确认,我们预计会对 gems.l2e.near
合约进行跨合约调用。
我们要查找执行收据id后产生的所有收据FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
(我们在步骤1中找到了)
- 搜索在初始收据执行期间创建的所有收据
SELECT produced_receipt_id FROM execution_outcome_receipts WHERE executed_receipt_id = 'FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN';
produced_receipt_id
----------------------------------------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
(2 rows)
- 所以我们还有另外两张收据,但我们实际上并不知道它们包含什么操作。让我们一探究竟。
SELECT receipt_id, action_kind, receipt_predecessor_account_id, receipt_receiver_account_id, args FROM action_receipt_actions WHERE receipt_id IN ('9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU', '3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3');
receipt_id | action_kind | receipt_predecessor_account_id | receipt_receiver_account_id | args
----------------------------------------------+---------------+--------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | TRANSFER | system | shishkerin.near | {"deposit": "12306467158537048105440"}
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | FUNCTION_CALL | shishkerin.near | gems.l2e.near | {"gas": 220000000000000, "deposit": "1", "args_json": {"amount": "2970000", "receiver_id": "hot1.l2e.near"}, "args_base64": "eyJyZWNlaXZlcl9pZCI6ImhvdDEubDJlLm5lYXIiLCJhbW91bnQiOiIyOTcwMDAwIn0=", "method_name": "ft_transfer"}
(2 rows)
这里我们可以看到 Receipt 9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
实际上是由 shishkerin.near
签署的 FUNCTION_CALL
to gems.l2e.near
我们也可以查看args,发现调用的方法是ft_transfer
,参数是{"amount": "2970000", "receiver_id": "hot1.l2e.near"}
(另一张收据 3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
是由 system
签署的转账,基本上是 cash-back 附加气体)
- 为了理智起见,我们想知道收据的执行状态
SELECT receipt_id, status FROM execution_outcomes WHERE receipt_id = '9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU';
receipt_id | status
----------------------------------------------+---------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | SUCCESS_VALUE
希望这能回答您的问题。
- Shared Public Access to NEAR Indexer for Explorer PostgreSQL database
- 决定要查询什么 table 和要获取什么列时要考虑 Database structure image
除了@khorolets 已经提到的内容之外,receipts
table 有 originated_from_transaction_hash
列可以帮助您获取归因于交易的所有收据:
SELECT * FROM receipts WHERE originated_from_transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
receipt_id | included_in_block_hash | included_in_chunk_hash | index_in_chunk | included_in_block_timestamp | predecessor_account_id | receiver_account_id | receipt_kind | originated_from_transaction_hash
----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------+-----------------------------+------------------------+---------------------+--------------+----------------------------------------------
DiL4YA5iyKpsgkwdjdZkuiCatvKHmbVKPGAKpYJV1qS7 | AyX7umWGpR3RgQGnz4LAgTRnRGbF42krvAAjmXo4s4EV | 9VkhZdALu1EY6D2czKaKSV7qQZsLR6vxfAPXqBkgmAGg | 2 | 1644263681934508460 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 3 | 1644263680552610497 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 2 | 1644263680552610497 | shishkerin.near | gems.l2e.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN | 5zvPFNeVytBNWfTzvmBaeCQtDrLuHfujKQqZ7qHhY4di | 4JngM4mhJnM9em6x8e7kJhyiSdPj1A9ZBzze9ZqJM8DP | 0 | 1644263679256841002 | shishkerin.near | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
(4 rows)
在 Near,受 2FA 保护的钱包签署的交易以特殊方式(合同确认)完成,与常规交易不同。 签名者和接收者 id 相同的钱包。 样本交易: https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
如何正确使用它们,在 Indexer 中哪里可以找到它们? 如何正确获取数据,用户签什么合同,签什么方式?
此处为 Explorer 核心贡献者和维护者的 NEAR 索引器。
查看您在问题中提供的交易 https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY 它是方法 confirm
FUNCTION CALL
我相信您担心的是,您无法通过使用散列查询 transactions
table 在 public NEAR Indexer for Explorer database 中看到交易结果。
并且说 2FA 交易“不像常规交易”是指涉及 cross-contract 调用的性质。
了解正在发生的事情的方法如下
- 首先,让我们查找您的初始交易及其转换后的收据 ID。
SELECT transaction_hash, converted_into_receipt_id FROM transactions WHERE transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
transaction_hash | converted_into_receipt_id
----------------------------------------------+----------------------------------------------
9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY | FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
根据您发送的这笔交易是对某些 ft_transfer
调用的确认,我们预计会对 gems.l2e.near
合约进行跨合约调用。
我们要查找执行收据id后产生的所有收据FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
(我们在步骤1中找到了)
- 搜索在初始收据执行期间创建的所有收据
SELECT produced_receipt_id FROM execution_outcome_receipts WHERE executed_receipt_id = 'FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN';
produced_receipt_id
----------------------------------------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
(2 rows)
- 所以我们还有另外两张收据,但我们实际上并不知道它们包含什么操作。让我们一探究竟。
SELECT receipt_id, action_kind, receipt_predecessor_account_id, receipt_receiver_account_id, args FROM action_receipt_actions WHERE receipt_id IN ('9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU', '3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3');
receipt_id | action_kind | receipt_predecessor_account_id | receipt_receiver_account_id | args
----------------------------------------------+---------------+--------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | TRANSFER | system | shishkerin.near | {"deposit": "12306467158537048105440"}
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | FUNCTION_CALL | shishkerin.near | gems.l2e.near | {"gas": 220000000000000, "deposit": "1", "args_json": {"amount": "2970000", "receiver_id": "hot1.l2e.near"}, "args_base64": "eyJyZWNlaXZlcl9pZCI6ImhvdDEubDJlLm5lYXIiLCJhbW91bnQiOiIyOTcwMDAwIn0=", "method_name": "ft_transfer"}
(2 rows)
这里我们可以看到 Receipt 9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
实际上是由 shishkerin.near
FUNCTION_CALL
to gems.l2e.near
我们也可以查看args,发现调用的方法是ft_transfer
,参数是{"amount": "2970000", "receiver_id": "hot1.l2e.near"}
(另一张收据 3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
是由 system
签署的转账,基本上是 cash-back 附加气体)
- 为了理智起见,我们想知道收据的执行状态
SELECT receipt_id, status FROM execution_outcomes WHERE receipt_id = '9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU';
receipt_id | status
----------------------------------------------+---------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | SUCCESS_VALUE
希望这能回答您的问题。
- Shared Public Access to NEAR Indexer for Explorer PostgreSQL database
- 决定要查询什么 table 和要获取什么列时要考虑 Database structure image
除了@khorolets 已经提到的内容之外,receipts
table 有 originated_from_transaction_hash
列可以帮助您获取归因于交易的所有收据:
SELECT * FROM receipts WHERE originated_from_transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
receipt_id | included_in_block_hash | included_in_chunk_hash | index_in_chunk | included_in_block_timestamp | predecessor_account_id | receiver_account_id | receipt_kind | originated_from_transaction_hash
----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------+-----------------------------+------------------------+---------------------+--------------+----------------------------------------------
DiL4YA5iyKpsgkwdjdZkuiCatvKHmbVKPGAKpYJV1qS7 | AyX7umWGpR3RgQGnz4LAgTRnRGbF42krvAAjmXo4s4EV | 9VkhZdALu1EY6D2czKaKSV7qQZsLR6vxfAPXqBkgmAGg | 2 | 1644263681934508460 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 3 | 1644263680552610497 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 2 | 1644263680552610497 | shishkerin.near | gems.l2e.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN | 5zvPFNeVytBNWfTzvmBaeCQtDrLuHfujKQqZ7qHhY4di | 4JngM4mhJnM9em6x8e7kJhyiSdPj1A9ZBzze9ZqJM8DP | 0 | 1644263679256841002 | shishkerin.near | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
(4 rows)