curl -X POST --data-binary '{"method":"wallet_propose","params":[{}]}' http://127.0.0.1:5005
{"result":{"account_id":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","key_type":"secp256k1","master_key":"FROG BIAS AIRY RON PA WHAT SHE WHAM DOLE FELT OFF ILL","master_seed":"ssX5VEps3TpsvBCC8kzst59ESgwX5","master_seed_hex":"3BEA92BFD251DF3BF517439C28EDAA86","public_key":"aB4RjWPr3XjgrewWRaCcCgH2YfcYdDadGYidYy7oZjDt5LUQxnTX","public_key_hex":"023DD5E44F0365075349D318D8AE28364A808E301299076A0D459F8D02E0C70A92","status":"success"}}
{
"result": {
"account_id": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"key_type": "secp256k1",
"master_key": "FROG BIAS AIRY RON PA WHAT SHE WHAM DOLE FELT OFF ILL",
"master_seed": "ssX5VEps3TpsvBCC8kzst59ESgwX5",
"master_seed_hex": "3BEA92BFD251DF3BF517439C28EDAA86",
"public_key": "aB4RjWPr3XjgrewWRaCcCgH2YfcYdDadGYidYy7oZjDt5LUQxnTX",
"public_key_hex": "023DD5E44F0365075349D318D8AE28364A808E301299076A0D459F8D02E0C70A92",
"status": "success"
}
}
该master_key,master_seed和master_seed_hex是各种格式的私钥,所有这些都可以用来签署交易。尽管有前缀master_,但这些密钥不一定是帐户的主密钥。在这种情况下,master_前缀更多地指的是密钥作为私钥的角色。这master_seed是所有其他有关此帐户信息的主要种子。
该public_key和public_key_hex在各种格式的公钥,与public_key_hex是对应于签订该交易的私钥的公钥。无论是public_key与public_key_hex直接从所导出的master_seed。
该account_id是从公共密钥导出并可创建用于XRP账本的账户。重要的是要知道,尽管account_id存在,但在XRP账簿中不存在实际账户,直到account_id收到第一笔XRP付款。此外,account_id只有在收到资金并创建帐户的交易后,才能发送任何交易。
要创建存储在账本中的资金账户时,account_id必须接受Payment交易,提供足够的XRP满足准备金要求。
该字段key_type指示使用什么加密签名算法来生成该密钥对。您可以key_type使用wallet_propose方法指定何时发出请求以生成密钥对
XRP账本在XRP网络中应用了储备金要求,防止恶意使用而导致共享的XRP账本变得过大,限制XRP账本的增长以匹配技术的改进
要提交交易,地址必须在共享的全局分类帐中至少包含XRP。您不能将此XRP发送到其他地址。要为新地址提供资金,您必须发送足够的XRP以满足储备金要求。
当前的最低储备要求为20 XRP
curl -X POST --data-binary '{"method":"sign","params":[{"offline":false,"secret":"ssML2WJpvGYdv8GyK73L49VZ2YabJ","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","TransactionType":"Payment"},"fee_mult_max":10}]}' http://127.0.0.1:5005
{"result":{"deprecated":"This command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.","status":"success","tx_blob":"1200002280000000240031C5ED61400000000000000A68400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100987ACEA28CBA534FD7A9DEC5984A99BCBEEA4FC306DAB5DEDEEAC92AA089D02802206E0D0E2B2F3EB2BB5520A14F84CF83E4718BEFA03371B31E9EFB195D3B124CCE8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261933,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100987ACEA28CBA534FD7A9DEC5984A99BCBEEA4FC306DAB5DEDEEAC92AA089D02802206E0D0E2B2F3EB2BB5520A14F84CF83E4718BEFA03371B31E9EFB195D3B124CCE","hash":"D0033D62AD25FF4DB327F5E6CE2A86CC179E725441B14F2B629863B6C83B3B3F"}}}
注:
curl -X POST --data-binary '{"method":"sign","params":[{"offline":false,"secret":"ssML2WJpvGYdv8GyK73L49VZ2YabJ","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","TransactionType":"Payment"},"fee_mult_max":10}]}' http://127.0.0.1:5005
secret:from地址密钥
Account:from地址
Amount:发送金额(此处单位为滴 1 xrp = 1000000 滴)
Destination:to地址
curl -X POST --data-binary '{"method":"submit","params":[{"tx_blob":"1200002280000000240031C5ED61400000000000000A68400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100987ACEA28CBA534FD7A9DEC5984A99BCBEEA4FC306DAB5DEDEEAC92AA089D02802206E0D0E2B2F3EB2BB5520A14F84CF83E4718BEFA03371B31E9EFB195D3B124CCE8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776"}]}' http://127.0.0.1:5005
{"result":{"accepted":true,"account_sequence_available":3261934,"account_sequence_next":3261934,"applied":true,"broadcast":true,"engine_result":"tecNO_DST_INSUF_XRP","engine_result_code":125,"engine_result_message":"Destination does not exist. Too little XRP sent to create it.","kept":true,"open_ledger_cost":"10","queued":false,"status":"success","tx_blob":"1200002280000000240031C5ED61400000000000000A68400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100987ACEA28CBA534FD7A9DEC5984A99BCBEEA4FC306DAB5DEDEEAC92AA089D02802206E0D0E2B2F3EB2BB5520A14F84CF83E4718BEFA03371B31E9EFB195D3B124CCE8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261933,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100987ACEA28CBA534FD7A9DEC5984A99BCBEEA4FC306DAB5DEDEEAC92AA089D02802206E0D0E2B2F3EB2BB5520A14F84CF83E4718BEFA03371B31E9EFB195D3B124CCE","hash":"D0033D62AD25FF4DB327F5E6CE2A86CC179E725441B14F2B629863B6C83B3B3F"},"validated_ledger_index":3667420}}
注:
使用以下链接查询此笔交易信息
https://devnet.xrpl.org/transactions/D0033D62AD25FF4DB327F5E6CE2A86CC179E725441B14F2B629863B6C83B3B3F
返回参数中有:tecNO_DST_INSUF_XRP,报错含义为:事务接收端上的帐户不存在,事务没有发送足够的XRP来创建它,也就是没有发送20个
具体错误信息可查看:https://xrpl.org/tec-codes.html
再次生成一笔交易签名
curl -X POST --data-binary '{"method":"sign","params":[{"offline":false,"secret":"ssML2WJpvGYdv8GyK73L49VZ2YabJ","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","TransactionType":"Payment"},"fee_mult_max":10}]}' http://127.0.0.1:5005
{"result":{"deprecated":"This command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.","status":"success","tx_blob":"1200002280000000240031C5EE614000000001406F4068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261934,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC","hash":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5"}}}
发送交易
curl -X POST --data-binary '{"method":"submit","params":[{"tx_blob":"1200002280000000240031C5EE614000000001406F4068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776"}]}' http://127.0.0.1:5005
{"result":{"accepted":true,"account_sequence_available":3261935,"account_sequence_next":3261935,"applied":true,"broadcast":true,"engine_result":"tesSUCCESS","engine_result_code":0,"engine_result_message":"The transaction was applied. Only final in a validated ledger.","kept":true,"open_ledger_cost":"10","queued":false,"status":"success","tx_blob":"1200002280000000240031C5EE614000000001406F4068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261934,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC","hash":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5"},"validated_ledger_index":3668081}}
注:
以上交易成功,可通过以下链接查看交易详情:
https://devnet.xrpl.org/transactions/DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5/detailed
此次交易,转账金额为:21 xrp,交易序列号为:3668083,预留金额为:20 xrp
可通过以下链接查看地址余额:https://devnet.xrpl.org/accounts/rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu
注:只有地址中预留金额有20 xrp,才能在浏览器中查到地址信息
curl -X POST --data-binary '{"method":"tx","params":[{"transaction":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","binary":false}]}' http://127.0.0.1:5005
{"result":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261934,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC","hash":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","status":"success","validated":false}}
此接口可获取账户信息
curl -X POST --data-binary '{"method":"account_info","params":[{"account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","strict":true,"ledger_index":"current","queue":true}]}' http://127.0.0.1:5005
{"result":{"account_data":{"Account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Balance":"21000000","Flags":0,"LedgerEntryType":"AccountRoot","OwnerCount":0,"PreviousTxnID":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","PreviousTxnLgrSeq":3668083,"Sequence":3668083,"index":"D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D"},"ledger_current_index":3668365,"queue_data":{"txn_count":0},"status":"success","validated":false}}
curl -X POST --data-binary ‘{“method”:“gateway_balances”,“params”:[{“account”:“rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu”}]}’ http://127.0.0.1:5005
curl -X POST --data-binary '{"method":"account_tx","params":[{"account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu"}]}' http://192.168.212.3:5005
{"result":{"account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","ledger_index_max":3668868,"ledger_index_min":32570,"limit":0,"status":"success","transactions":[{"meta":{"AffectedNodes":[{"ModifiedNode":{"FinalFields":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Balance":"9957999970","Flags":0,"OwnerCount":0,"Sequence":3261936},"LedgerEntryType":"AccountRoot","LedgerIndex":"58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B","PreviousFields":{"Balance":"9978999980","Sequence":3261935},"PreviousTxnID":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","PreviousTxnLgrSeq":3668083}},{"ModifiedNode":{"FinalFields":{"Account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Balance":"42000000","Flags":0,"OwnerCount":0,"Sequence":3668083},"LedgerEntryType":"AccountRoot","LedgerIndex":"D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D","PreviousFields":{"Balance":"21000000"},"PreviousTxnID":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","PreviousTxnLgrSeq":3668083}}],"TransactionIndex":0,"TransactionResult":"tesSUCCESS","delivered_amount":"21000000"},"tx":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261935,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3044022016D14137C75C261048DCE4C10CF5F5979931B87FBB83ACADD82A3AE418E81518022017D2CB8528FA35418F8EE1C447E36F982C49A4BE2F23A0A40035F7A38BAA8959","date":661523892,"hash":"418EE611D27B7EB96BD30E71ADCEBAB89D30B379A002749973EADF7B012F5F37","inLedger":3668861,"ledger_index":3668861},"validated":true},{"meta":{"AffectedNodes":[{"ModifiedNode":{"FinalFields":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Balance":"9978999980","Flags":0,"OwnerCount":0,"Sequence":3261935},"LedgerEntryType":"AccountRoot","LedgerIndex":"58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B","PreviousFields":{"Balance":"9999999990","Sequence":3261934},"PreviousTxnID":"D0033D62AD25FF4DB327F5E6CE2A86CC179E725441B14F2B629863B6C83B3B3F","PreviousTxnLgrSeq":3667422}},{"CreatedNode":{"LedgerEntryType":"AccountRoot","LedgerIndex":"D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D","NewFields":{"Account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Balance":"21000000","Sequence":3668083}}}],"TransactionIndex":0,"TransactionResult":"tesSUCCESS","delivered_amount":"21000000"},"tx":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"21000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Sequence":3261934,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC","date":661521552,"hash":"DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5","inLedger":3668083,"ledger_index":3668083},"validated":true}],"validated":true}}
以下是格式化以后的交易列表
注:一个meta字段,为一个交易,里面是有关交易的各种元数据,tx字段内具体的交易信息
{
"result": {
"account": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"ledger_index_max": 3668868,
"ledger_index_min": 32570,
"limit": 0,
"status": "success",
"transactions": [{
"meta": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq",
"Balance": "9957999970",
"Flags": 0,
"OwnerCount": 0,
"Sequence": 3261936
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B",
"PreviousFields": {
"Balance": "9978999980",
"Sequence": 3261935
},
"PreviousTxnID": "DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5",
"PreviousTxnLgrSeq": 3668083
}
}, {
"ModifiedNode": {
"FinalFields": {
"Account": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"Balance": "42000000",
"Flags": 0,
"OwnerCount": 0,
"Sequence": 3668083
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D",
"PreviousFields": {
"Balance": "21000000"
},
"PreviousTxnID": "DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5",
"PreviousTxnLgrSeq": 3668083
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS",
"delivered_amount": "21000000"
},
"tx": {
"Account": "rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq",
"Amount": "21000000",
"Destination": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 3261935,
"SigningPubKey": "034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF",
"TransactionType": "Payment",
"TxnSignature": "3044022016D14137C75C261048DCE4C10CF5F5979931B87FBB83ACADD82A3AE418E81518022017D2CB8528FA35418F8EE1C447E36F982C49A4BE2F23A0A40035F7A38BAA8959",
"date": 661523892,
"hash": "418EE611D27B7EB96BD30E71ADCEBAB89D30B379A002749973EADF7B012F5F37",
"inLedger": 3668861,
"ledger_index": 3668861
},
"validated": true
}, {
"meta": {
"AffectedNodes": [{
"ModifiedNode": {
"FinalFields": {
"Account": "rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq",
"Balance": "9978999980",
"Flags": 0,
"OwnerCount": 0,
"Sequence": 3261935
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B",
"PreviousFields": {
"Balance": "9999999990",
"Sequence": 3261934
},
"PreviousTxnID": "D0033D62AD25FF4DB327F5E6CE2A86CC179E725441B14F2B629863B6C83B3B3F",
"PreviousTxnLgrSeq": 3667422
}
}, {
"CreatedNode": {
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D",
"NewFields": {
"Account": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"Balance": "21000000",
"Sequence": 3668083
}
}
}],
"TransactionIndex": 0,
"TransactionResult": "tesSUCCESS",
"delivered_amount": "21000000"
},
"tx": {
"Account": "rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq",
"Amount": "21000000",
"Destination": "rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu",
"Fee": "10",
"Flags": 2147483648,
"Sequence": 3261934,
"SigningPubKey": "034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF",
"TransactionType": "Payment",
"TxnSignature": "3045022100E2165B629316779AE9E1CD194FE4A1205B964B999D1B88CD48CBBBB50897401202207124E491EB33036F5CF8C94F36A0D03E3B18EB85163665EB02BFEA2AD65974AC",
"date": 661521552,
"hash": "DA80BE0B16DB2186C56D71D868047E865C2E803DD09949D8480E6388FDCF88C5",
"inLedger": 3668083,
"ledger_index": 3668083
},
"validated": true
}],
"validated": true
}
}
注:
curl -X POST --data-binary '{"method":"sign","params":[{"offline":false,"secret":"ssML2WJpvGYdv8GyK73L49VZ2YabJ","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Memos":[{"Memo":{"MemoData":"33810385"}}],"Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","TransactionType":"Payment"},"fee_mult_max":10}]}' http://127.0.0.1:5005
{"result":{"deprecated":"This command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.","status":"success","tx_blob":"1200002280000000240031C5F161400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100C67AE6ADD3E532AB2CE8B1FC0CDE8FA93D8C8E1F041429096FA79F22A3AB6A250220222E4C5AC83E740CAD467F198E0ADAAB538FD59B061B0212E4D2269B849F24CD8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776F9EA7D0433810385E1F1","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Memos":[{"Memo":{"MemoData":"33810385"}}],"Sequence":3261937,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100C67AE6ADD3E532AB2CE8B1FC0CDE8FA93D8C8E1F041429096FA79F22A3AB6A250220222E4C5AC83E740CAD467F198E0ADAAB538FD59B061B0212E4D2269B849F24CD","hash":"07D6EAAD7D2478E1AD8CCD8D8A4BA57B017540B23A6D50BE2C675738F4478C66"}}}
secret:from地址密钥
Account:from地址
Amount:发送金额(此处单位为滴 1 xrp = 1000000 滴)
MemoData:发送交易时的备注信息,可用作用户的tag
Destination:to地址
TransactionType:交易类型
fee_mult_max:交易手续费的最大值
curl -X POST --data-binary '{"method":"submit","params":[{"tx_blob":"1200002280000000240031C5F261400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF744630440220599DFA3D8414E6BEEDCF9155DC3A1828BBBD0E7CFE22699D327EF20F19CF47BF02201FA5FCA9510497F78D1203B3EE1E9A566A5A25F5B1A3D1C4C0642CFC7314F96A8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776F9EA7D0433810385E1F1"}]}' http://127.0.0.1:5005
{"result":{"accepted":true,"account_sequence_available":3261939,"account_sequence_next":3261939,"applied":true,"broadcast":true,"engine_result":"tesSUCCESS","engine_result_code":0,"engine_result_message":"The transaction was applied. Only final in a validated ledger.","kept":true,"open_ledger_cost":"10","queued":false,"status":"success","tx_blob":"1200002280000000240031C5F261400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF744630440220599DFA3D8414E6BEEDCF9155DC3A1828BBBD0E7CFE22699D327EF20F19CF47BF02201FA5FCA9510497F78D1203B3EE1E9A566A5A25F5B1A3D1C4C0642CFC7314F96A8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776F9EA7D0433810385E1F1","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Memos":[{"Memo":{"MemoData":"33810385"}}],"Sequence":3261938,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"30440220599DFA3D8414E6BEEDCF9155DC3A1828BBBD0E7CFE22699D327EF20F19CF47BF02201FA5FCA9510497F78D1203B3EE1E9A566A5A25F5B1A3D1C4C0642CFC7314F96A","hash":"196226F890143923C2763B16E8D364F897398D647FB54C4E0678BF9A490AE0F9"},"validated_ledger_index":3694584}}
curl -X POST --data-binary '{"method":"tx","params":[{"transaction":"196226F890143923C2763B16E8D364F897398D647FB54C4E0678BF9A490AE0F9","binary":false}]}' http://127.0.0.1:5005
{"result":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Fee":"10","Flags":2147483648,"Memos":[{"Memo":{"MemoData":"33810385"}}],"Sequence":3261938,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"30440220599DFA3D8414E6BEEDCF9155DC3A1828BBBD0E7CFE22699D327EF20F19CF47BF02201FA5FCA9510497F78D1203B3EE1E9A566A5A25F5B1A3D1C4C0642CFC7314F96A","date":661601230,"hash":"196226F890143923C2763B16E8D364F897398D647FB54C4E0678BF9A490AE0F9","inLedger":3694586,"ledger_index":3694586,"meta":{"AffectedNodes":[{"ModifiedNode":{"FinalFields":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Balance":"9937999930","Flags":0,"OwnerCount":0,"Sequence":3261939},"LedgerEntryType":"AccountRoot","LedgerIndex":"58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B","PreviousFields":{"Balance":"9947999940","Sequence":3261938},"PreviousTxnID":"07D6EAAD7D2478E1AD8CCD8D8A4BA57B017540B23A6D50BE2C675738F4478C66","PreviousTxnLgrSeq":3694388}},{"ModifiedNode":{"FinalFields":{"Account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Balance":"62000010","Flags":0,"OwnerCount":0,"Sequence":3668083},"LedgerEntryType":"AccountRoot","LedgerIndex":"D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D","PreviousFields":{"Balance":"52000010"},"PreviousTxnID":"07D6EAAD7D2478E1AD8CCD8D8A4BA57B017540B23A6D50BE2C675738F4478C66","PreviousTxnLgrSeq":3694388}}],"TransactionIndex":0,"TransactionResult":"tesSUCCESS","delivered_amount":"10000000"},"status":"success","validated":true}}
通过rpc生成交易签名(DestinationTag)
curl -X POST --data-binary '{"method":"sign","params":[{"offline":false,"secret":"ssML2WJpvGYdv8GyK73L49VZ2YabJ","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","DestinationTag": "33810385","TransactionType":"Payment"},"fee_mult_max":10}]}' http://127.0.0.1:5005
{"result":{"deprecated":"This command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.","status":"success","tx_blob":"1200002280000000240031C5F32E0203E7D161400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","DestinationTag":33810385,"Fee":"10","Flags":2147483648,"Sequence":3261939,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E","hash":"DF489C826E33D6042209054DA8E57DA7100A8D4C6D0AA30548A6C4C8DD805375"}}}
secret:from地址密钥
Account:from地址
Amount:发送金额(此处单位为滴 1 xrp = 1000000 滴)
DestinationTag:发送交易时的备注信息,可用作用户的tag
Destination:to地址
TransactionType:交易类型
fee_mult_max:交易手续费的最大值
curl -X POST --data-binary '{"method":"submit","params":[{"tx_blob":"1200002280000000240031C5F32E0203E7D161400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776"}]}' http://127.0.0.1:5005
{"result":{"accepted":true,"account_sequence_available":3261940,"account_sequence_next":3261940,"applied":true,"broadcast":true,"engine_result":"tesSUCCESS","engine_result_code":0,"engine_result_message":"The transaction was applied. Only final in a validated ledger.","kept":true,"open_ledger_cost":"10","queued":false,"status":"success","tx_blob":"1200002280000000240031C5F32E0203E7D161400000000098968068400000000000000A7321034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF74473045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E8114110F977BA74AD65F113664B8D55FA076F1D2601B831490F0D979FF554D5F5910F8D3808F27873CBB0776","tx_json":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","DestinationTag":33810385,"Fee":"10","Flags":2147483648,"Sequence":3261939,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E","hash":"DF489C826E33D6042209054DA8E57DA7100A8D4C6D0AA30548A6C4C8DD805375"},"validated_ledger_index":3695565}}
curl -X POST --data-binary '{"method":"tx","params":[{"transaction":"DF489C826E33D6042209054DA8E57DA7100A8D4C6D0AA30548A6C4C8DD805375","binary":false}]}' http://127.0.0.1:5005
{"result":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Amount":"10000000","Destination":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","DestinationTag":33810385,"Fee":"10","Flags":2147483648,"Sequence":3261939,"SigningPubKey":"034E3C12CEDC7FB75F7119A9E099346971D29ED57A22BB656CC2F00C6511AE7AAF","TransactionType":"Payment","TxnSignature":"3045022100F337344E89702E4229DA6DC75A8BE39A53BD1D363A4B292705DF7C5E7D4F534D02206DF7E478252EA75A4579433DE58B4FB9401C0927E2D4321B38FB1BFEFDB95A4E","date":661604180,"hash":"DF489C826E33D6042209054DA8E57DA7100A8D4C6D0AA30548A6C4C8DD805375","inLedger":3695567,"ledger_index":3695567,"meta":{"AffectedNodes":[{"ModifiedNode":{"FinalFields":{"Account":"rpZDwbR6L62gtBuaexCJKVr8jFYhfGcVGq","Balance":"9927999920","Flags":0,"OwnerCount":0,"Sequence":3261940},"LedgerEntryType":"AccountRoot","LedgerIndex":"58F1FF81DEB6CD07BDF957FB0BD67EE9F54D8B89C9D78C7CC8D3FA34B329541B","PreviousFields":{"Balance":"9937999930","Sequence":3261939},"PreviousTxnID":"196226F890143923C2763B16E8D364F897398D647FB54C4E0678BF9A490AE0F9","PreviousTxnLgrSeq":3694586}},{"ModifiedNode":{"FinalFields":{"Account":"rND4q9UqAJkYjzCiLi94eJUmS6xy7zMahu","Balance":"72000010","Flags":0,"OwnerCount":0,"Sequence":3668083},"LedgerEntryType":"AccountRoot","LedgerIndex":"D5A881644AC5B1C29375D8AE589F5CC2544D382F1394BFEBBB2934732220B57D","PreviousFields":{"Balance":"62000010"},"PreviousTxnID":"196226F890143923C2763B16E8D364F897398D647FB54C4E0678BF9A490AE0F9","PreviousTxnLgrSeq":3694586}}],"TransactionIndex":0,"TransactionResult":"tesSUCCESS","delivered_amount":"10000000"},"status":"success","validated":true}}
注:为什么ripple转账需要tag?
目标标记是分配给每个Ripple(XRP)帐户的唯一9位数字数字.它用于识别Ripple事务中的接收方。发送XRP时,需要提供以下信息:
所以为了确保xrp交易的准确及有效性,应该在接收XRP时向发送方提供目标地址标签。发送XRP时,请接收方提供他们的目标地址标签。
首先,请理解destination tag的含义:如A对B进行XRP转账,若B提供destination tag,则A需要在转账页面填写该tag字段。tag的格式必须是大于0的整数,且没有固定长度,目前见过的最大的是10位。
其次,关于tag的使用场景:
当个人转账给个人钱包地址,如对方未提供给您tag,则无需填写,若对方提供了,请务必填写。但一般情况下,个人钱包地址很少有tag。
当个人转账至交易所等机构的地址,该机构可能是作为中间商,这样需把源头用tag区分。机构通常提供tag,当tag漏填时,用户的币可能就找不到了。发生此情况时,请及时联系机构。
当用户从交易所等机构提币至钱包地址,一般个人钱包地址不提供tag,但类似gate.io将RequireDest字段设置成true的情形,不填tag用户无法提币,此时用户只需填写一个大于0的任意整数(如1234),即可提币成功。
取消或忽略一笔交易
XRP Ledger的一个重要且有意的特征是,一旦交易被打包进到经过验证的账本中,交易就是最终的(不可更改)。
但是,如果交易尚未打包进已验证的账本中,则可以通过将其设置为无效来有效取消该交易。通常,这意味着从同一帐户发送具有相同序列值(Sequence)的另一个交易。如果不想替换交易执行任何操作,发送没有选项的AccountSet的交易.
例如,如果尝试提交序列号(sequence)为11,12和13的三笔交易,但序号为11的交易以某种方式丢失或者没有足够的成本(手续费)广播到p2p网络上, 然后,可以通过提交没有选项和序列号11的AccountSet的交易来取消序号为11的交易。此交易除了破坏序号为11的交易成本外不会起任何作用, 但它间接的允许交易12和13可执行。
这种方法优于重新编号和重新提交12和13的交易,因为它可以防止交易在不同的序列号下有效地复制。
通过这种方式,没有选项的AccountSet交易是规范的“no-op”交易。