nervosnetwork / nervosnetwork/ckb

`get_cell` to reoslve `OutPoint`

Open
#4,658 8 comments 0 reactions 0 assignees View on GitHub
b:rpc s:discussion-needed stale t:enhancement
Dominant language
Rust
Stars
1.2k
Forks
266
Avg merge
10d 5h
Merged PRs (30d)
4

Description

## Feature Request

In some dApp scenarios, it's necessary to resolve a cell even if the cell has already been consumed. This is needed for tasks such as analyzing the purpose of a transaction and rendering transaction records that include both the sender and recipient.

Developers currently have to resolve an `OutPoint` by fetching an entire transaction and then extracting the corresponding cell from its `outputs`. This becomes challenging when the pointed transaction is large

#### Is your feature request related to a problem? Please describe.

#### Describe the solution you'd like

Add a new RPC similar to `get_live_cell` without the status of the cell

##### Request

```json5
{
"id": 42,
"jsonrpc": "2.0",
"method": "get_cell",
"params": [
// out point
{
"index": "0x0",
"tx_hash": "0xa4037a893eb48e18ed4ef61034ce26eba9c585f15c9cee102ae58505565eccc3"
},
// with data
true
]
}
```

##### Response
```json
{
"id": 42,
"jsonrpc": "2.0",
"result": {
"data": {
"content": "0x...",
"hash": "0x28e83a1277d48add8e72fadaa9248559e1b632bab2bd60b27955ebc4c03800a5"
},
"output": {
"capacity": "0x802665800",
"lock": {
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"hash_type": "data",
"args": "0x"
},
"type": null
}
}
}

```

#### Describe alternatives you've considered

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing get_live_cell RPC and the code that resolves an OutPoint from a transaction. Define get_cell against the request and response examples, including optional data and consumed cells, then add coverage for resolving an OutPoint without returning cell status.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, rust
Domain
api, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.