Send Raw Transactions
POST /transactions
It's possible send raw transactions to the mainnet. This API supports two kinds of address: mainnet address and the multisig address.
Transfer to a Mainnet Address
Transfer to a specified mainnet address.
API 端点 URL
https://api.mixin.one/transactions
请求体
{
"asset_id": "the asset's asset_id which you are transferring",
"opponent_id": "the mainnet address which you are transferring",
"amount": "e.g.: "0.01", supports up to 8 digits after the decimal point",
"pin_base64": "Encrypted PIN",
"trace_id": "Used to prevent duplicate payment, optional",
"memo": "Maximally 140 characters, optional",
}
TIP Pin 结构
"TIP:TRANSACTION:CREATE:" + assetId + counterUserId + amount + traceId + memo
pin_base64 是上面值的 sha256-256 的结果
请求示例
curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/transactions --data '{"amount":"10","asset_id":"43d61dcd-e413-450d-80b8-101d5e903357","opponent_key":"XINDEhAA8ArWDJBF5fJQvrtKdZQ4X28KmkScm5FtwdJGx9CiB1Hjadk4baMLMRjsGY5L8QDbVKuC7jvep1m8k4zZN7BGvvXP","memo":"hello","pin":"F39IsJmUaZW03VMV/01lHyY2RCoZ7/X764akX+EmthIc4uVsWAWQTM/IxX5Z9C1y","trace_id":"7c67e8e8-b142-488b-80a3-61d4d29c90bf"}'
Response
{
"data":{
"type": "raw",
"snapshot_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"opponent_key": "XINDEhAA8ArWDJBF5fJQvrtKdZQ4X28KmkScm5FtwdJGx9CiB1Hjadk4baMLMRjsGY5L8QDbVKuC7jvep1m8k4zZN7BGvvXP",
"opponent_receivers": ["43d61dcd-e413-450d-80b8-101d5e903357", "43d61dcd-e413-450d-80b8-101d5e903357" ...],
"opponent_threshold": 2,
"asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "-10",
"opening_balance": "20",
"closing_balance": "10",
"trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo": "hello",
"state": "pending",
"created_at": "2018-05-03T10:08:34.859542588Z",
"transaction_hash": "d3db988a102f017bf386af85ef4b77bd213b708263d9b408ade62296674dcb5a",
"snapshot_hash": "d3db988a102f017bf386af85ef4b77bd213b708263d9b408ade62296674dcb5a",
"snapshot_at": "2018-05-03T10:08:34.859542588Z"
}
}
Transfer to a Multi-signature Address
Transfer to a specified multisig address.
API 端点 URL
https://api.mixin.one/transactions
请求体
{
"asset_id": "the asset's asset_id which you are transferring",
"opponent_multisig": "the multi-signature object, identify the address which you are transferring",
"amount": "e.g.: "0.01", supports up to 8 digits after the decimal point",
"pin": "Encrypted PIN",
"trace_id": "Used to prevent duplicate payment, optional",
"memo": "Maximally 140 characters, optional",
}
opponent_multisig
{
"receivers": [
"user_id",
"user_id",
...
],
"threshold": 3
}
请求示例
curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/transactions --data '{"amount":"10","asset_id":"43d61dcd-e413-450d-80b8-101d5e903357","opponent_multisig":{"receivers": ["00c5a4ae-dcdc-48db-ab8e-a7eef69b441d","087e91ff-7169-451a-aaaa-5b3297411a4b","105f6e8b-d249-4b4d-9beb-e03cefaebc37"], "threshold": 2},"memo":"hello","pin":"F39IsJmUaZW03VMV/01lHyY2RCoZ7/X764akX+EmthIc4uVsWAWQTM/IxX5Z9C1y","trace_id":"7c67e8e8-b142-488b-80a3-61d4d29c90bf"}'
Response
{
"data":{
"type": "raw",
"snapshot_id": "ab56be4c-5b20-41c6-a9c3-244f9a433f35",
"opponent_key": "XINDEhAA8ArWDJBF5fJQvrtKdZQ4X28KmkScm5FtwdJGx9CiB1Hjadk4baMLMRjsGY5L8QDbVKuC7jvep1m8k4zZN7BGvvXP",
"opponent_receivers": ["43d61dcd-e413-450d-80b8-101d5e903357", "43d61dcd-e413-450d-80b8-101d5e903357" ...],
"opponent_threshold": 2,
"asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "-10",
"opening_balance": "20",
"closing_balance": "10",
"trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo": "hello",
"state": "pending",
"created_at": "2018-05-03T10:08:34.859542588Z",
"transaction_hash": "d3db988a102f017bf386af85ef4b77bd213b708263d9b408ade62296674dcb5a",
"snapshot_hash": "d3db988a102f017bf386af85ef4b77bd213b708263d9b408ade62296674dcb5a",
"snapshot_at": "2018-05-03T10:08:34.859542588Z"
}
}