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

[Rosetta][Construction-API][Feature] memo handling for transactions #752

Closed
shermanxiong opened this issue Sep 9, 2021 · 1 comment · Fixed by #753
Closed

[Rosetta][Construction-API][Feature] memo handling for transactions #752

shermanxiong opened this issue Sep 9, 2021 · 1 comment · Fixed by #753

Comments

@shermanxiong
Copy link

Feature Request

Support optional memos in transactions when using Rosetta Construction API to build and submit transactions. I think the best place to put this would be in the metadata field when constructing a transaction. It could look something like this:

Example Flow

construction/preprocess

----------------------------------------------------------------
REQUEST
{
  "network_identifier": {
    "blockchain": "stacks",
    "network": "testnet"
  },
  "operations": [
    {
      "operation_identifier": {
        "index": 0
      },
      "type": "fee",
      "account": {
        "address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK"
      },
      "amount": {
        "value": "-180",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    },
    {
      "operation_identifier": {
        "index": 1
      },
      "type": "token_transfer",
      "account": {
        "address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK"
      },
      "amount": {
        "value": "-10000",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    },
    {
      "operation_identifier": {
        "index": 2
      },
      "related_operations": [
        {
          "index": 1
        }
      ],
      "type": "token_transfer",
      "account": {
        "address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J"
      },
      "amount": {
        "value": "10000",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    }
  ],
  "metadata": {
    "memo": "SAMPLE MEMO"
  },
  "max_fee": [
    {
      "value": "200",
      "currency": {
        "symbol": "STX",
        "decimals": 6
      },
      "metadata": {}
    }
  ],
  "suggested_fee_multiplier": 0
}

----------------------------------------------------------------
RESPONSE
{
  "options": {
    "fee": "-180",
    "sender_address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK",
    "type": "token_transfer",
    "token_transfer_recipient_address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J",
    "amount": "10000",
    "symbol": "STX",
    "decimals": 6,
    "max_fee": "200",
    "size": 180,
    "memo": "SAMPLE MEMO"
  },
  "required_public_keys": [
    {
      "address": "SPZ8XG58T080YJ54TCHQ5D6ZTVYMMTWCDVA8VREK"
    }
  ]
}

construction/metadata

----------------------------------------------------------------
REQUEST
{
  "network_identifier": {
      "blockchain": "stacks",
      "network": "testnet"
  },
  "options": {
    "fee": "-180",
    "sender_address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK",
    "type": "token_transfer",
    "token_transfer_recipient_address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J",
    "amount": "10000",
    "symbol": "STX",
    "decimals": 6,
    "max_fee": "20",
    "size": 180,
    "memo": "SAMPLE MEMO"
  }
}
----------------------------------------------------------------
RESPONSE
{
  "metadata": {
    "fee": "-180",
    "sender_address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK",
    "type": "token_transfer",
    "token_transfer_recipient_address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J",
    "amount": "10000",
    "symbol": "STX",
    "decimals": 6,
    "max_fee": "200",
    "size": 180,
    "account_sequence": 0,
    "recent_block_hash": "0x7f53710ec3494a7dfa4681b1638f3defaa217c6d7dafa221a8bd74e4cbfec6fa",
    "memo": "SAMPLE MEMO"
  },
  "suggested_fee": [
    {
      "value": "180",
      "currency": {
        "symbol": "STX",
        "decimals": 6
      }
    }
  ]
}

construction/payloads

----------------------------------------------------------------
REQUEST
{
  "network_identifier": {
    "blockchain": "stacks",
    "network": "testnet"
  },
  "operations": [
    {
      "operation_identifier": {
        "index": 0,
        "network_index": 0
      },
      "related_operations": [],
      "type": "fee",
      "account": {
        "address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK"
      },
      "amount": {
        "value": "-180",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    },
    {
      "operation_identifier": {
        "index": 1
      },
      "type": "token_transfer",
      "account": {
        "address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK"
      },
      "amount": {
        "value": "-10000",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    },
    {
      "operation_identifier": {
        "index": 2
      },
      "related_operations": [
        {
          "index": 1
        }
      ],
      "type": "token_transfer",
      "account": {
        "address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J"
      },
      "amount": {
        "value": "10000",
        "currency": {
          "symbol": "STX",
          "decimals": 6
        }
      }
    }
  ],
  "public_keys": [
    {
      "hex_bytes": "<PUBLIC KEY>",
      "curve_type": "secp256k1"
    }
  ],
  "metadata": {
    "fee": "-180",
    "sender_address": "ST3HNYGWJDF7BJ5A7BHS3YJK1A8Y8M2G4XGRV7CZK",
    "type": "token_transfer",
    "token_transfer_recipient_address": "STRZBNYT2MAH5Q1F3WJBP21CNY7YX5F89R6ZPF3J",
    "amount": "10000",
    "symbol": "STX",
    "decimals": 6,
    "max_fee": "200",
    "size": 180,
    "account_sequence": 0,
    "recent_block_hash": "0x7f53710ec3494a7dfa4681b1638f3defaa217c6d7dafa221a8bd74e4cbfec6fa",
    "memo": "SAMPLE MEMO"
  },
}
----------------------------------------------------------------
RESPONSE
the response will have the memo in the metadata field in the unsigned_transaction 

One question is: could a stack-stx transaction also have a memo attached to it? if so then, we would like to allow optionality to include it as well as token_transfer

@zone117x
Copy link
Member

We can add memo to the token_transfer operation, but not the others. There's no memo (or other free form field) that can be used for a stack-stx contract call.

@zone117x zone117x assigned zone117x and unassigned zone117x Sep 10, 2021
blockstack-devops pushed a commit that referenced this issue Sep 16, 2021
# [0.67.0](v0.66.1...v0.67.0) (2021-09-16)

### Bug Fixes

* **rosetta:** use coinbase txs hash instead of stx_lock for forged unlock_transaction [#760](#760) ([37adcc7](37adcc7))
* disable http keep-alive for stacks-node /v2 proxied endpoints ([cebeda0](cebeda0))
* increase the 10 second cap on prometheus http metric reporting ([735874e](735874e))
* replicate query optimizations to other asset txs queries ([05c9931](05c9931))

### Features

* automatically generate postman collection from the openapi spec ([5f07d74](5f07d74))
* **rosetta:** support memos in stx token transfer operations [#752](#752) ([6f4f3e2](6f4f3e2))
wileyj added a commit that referenced this issue Nov 16, 2021
* develop: (40 commits)
  feat: added execution cost to block response #735
  feat: ability to configure multiple tx broadcast endpoints #765
  fix: return the latest name by address #714
  fix(rosetta): use coinbase txs hash instead of stx_lock for forged unlock_transaction #760
  feat: automatically generate postman collection from the openapi spec
  fix: disable http keep-alive for stacks-node /v2 proxied endpoints
  fix: increase the 10 second cap on prometheus http metric reporting
  chore: update typescript to 4.4.2
  feat(rosetta): support memos in stx token transfer operations #752
  fix: replicate query optimizations to other asset txs queries
  fix: optimize query that retrieves txs with asset transfers
  fix(rosetta): do not assume encoding of delegate-stx `pox_addr` data #732
  feat: added a new endpoint fee_rate #729
  chore(release): 0.65.0 [skip ci]
  fix: sql optimizations to speed up various tx queries
  feat: add execution cost data to transactions
  feat: token metadata
  fix: short summaries for BNS endpoints
  feat: emit prometheus metrics for socket.io
  fix: added types for search endpoint #645
  ...
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 a pull request may close this issue.

2 participants