Skip to content

Instantly share code, notes, and snippets.

@shaojunda
Created August 21, 2019 05:43
Show Gist options
  • Save shaojunda/82e7cf899d5a0f4714d2ddd644dc1caa to your computer and use it in GitHub Desktop.
Save shaojunda/82e7cf899d5a0f4714d2ddd644dc1caa to your computer and use it in GitHub Desktop.
b = api.get_block_by_number(200)
# block 的结构
#<CKB::Types::Block:0x00007fb54980e0c0
@header=
#<CKB::Types::BlockHeader:0x00007fb54980e138
@dao="0x01000000000000004411a07ccde123000066b4450b1804000063324fbf6a0000",
@difficulty="0x100",
@epoch="0",
@hash="0x9cb72acc3098b3f5f873a4815779dd90b494b5d24246a2c79c049fed9e990a84",
@number="200",
@parent_hash="0xe9cf30ea4d1cdf91172f05059c57afd6dd4413b974ce4e19af0a1275774f135f",
@proposals_hash="0x0000000000000000000000000000000000000000000000000000000000000000",
@seal=#<CKB::Types::Seal:0x00007fb54980e1b0 @nonce="4436004082106328420", @proof="0x">,
@timestamp="1566360869047",
@transactions_root="0xf36276533993cae71f08f3139a612847888579b902f9f7d7be08199f1ed8cccc",
@uncles_count="0",
@uncles_hash="0x0000000000000000000000000000000000000000000000000000000000000000",
@version="0",
@witnesses_root="0xc928814c121acb6aa64b4f256dfaefd6e21c58b52e854da4addea37d0b591e3e">,
@proposals=[],
@transactions=
[#<CKB::Types::Transaction:0x00007fb54980e228
@cell_deps=[],
@hash="0xf36276533993cae71f08f3139a612847888579b902f9f7d7be08199f1ed8cccc",
@header_deps=[],
@inputs=
[#<CKB::Types::Input:0x00007fb54980e458
@previous_output=
#<CKB::Types::OutPoint:0x00007fb54980e4d0
@index="4294967295",
@tx_hash="0x0000000000000000000000000000000000000000000000000000000000000000">,
@since="200">],
@outputs=
[#<CKB::Types::Output:0x00007fb54980e340
@capacity="131118223255",
@data="0x",
@lock=
#<CKB::Types::Script:0x00007fb54980e3b8
@args=["0x3954acece65096bfa81258983ddb83915fc56bd8"],
@code_hash="0x664b03c55410dd7d694a73779fa86edd7f069ee17fd79b0fef4c4fec0377b9a6",
@hash_type="Data">,
@out_point=nil,
@type=nil>],
@outputs_data=["0x"],
@version="0",
@witnesses=
[#<CKB::Types::Witness:0x00007fb54980e2a0
@data=
["0x664b03c55410dd7d694a73779fa86edd7f069ee17fd79b0fef4c4fec0377b9a600",
"0x3954acece65096bfa81258983ddb83915fc56bd8"]>]>],
@uncles=[]>
script = CKB::Types::Script.new(code_hash: "0x664b03c55410dd7d694a73779fa86edd7f069ee17fd79b0fef4c4fec0377b9a6",args: "0x3954acece65096bfa81258983ddb83915fc56bd8")
script.to_hash # "0x5bd9f9ee8ff06bd7681e67a1efeca021703dbc98d8c36481afb49fc2e04b7ea1"
echo '{
"id": 2,
"jsonrpc": "2.0",
"method": "get_cells_by_lock_hash",
"params": [
"0x5bd9f9ee8ff06bd7681e67a1efeca021703dbc98d8c36481afb49fc2e04b7ea1",
"170",
"210"
]
}' \
| tr -d '\n' \
| curl -H 'content-type: application/json' -d @- \
http://18.162.80.155:8118
# {"jsonrpc":"2.0","result":[],"id":2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment