-
Scenario DescriptionA developer wants to migrate an NFT contract from Godwoken v0 to Godwoken v1. By querying the contract in v0, the developer has a list of addresses (a.k.a godwoken_short_address, which is calculated from short_address = blake2b(script.as_slice())[0..20]). Now the developer wants to find out the corresponding eth_address of each godwoken_short_address. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
SolutionLet's say you have a godwoken_short_address 1. gw_get_script_hash_by_short_addresscurl -X POST https://mainnet.godwoken.io/rpc \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"gw_get_script_hash_by_short_address","params": ["0xaa61ffa7c181bd3e23cb62c91291178e70c7b311"], "id":1}' Result-> 0xaa61ffa7c181bd3e23cb62c91291178e70c7b311715511e299776a199f9f9c72 2. gw_get_scriptcurl -X POST https://mainnet.godwoken.io/rpc \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"gw_get_script","params": ["0xaa61ffa7c181bd3e23cb62c91291178e70c7b311715511e299776a199f9f9c72"], "id":1}'
# Result
-> {"jsonrpc":"2.0","id":1,"result":{
"code_hash":"0x1563080d175bf8ddd44a48e850cecf0c0b4575835756eb5ffd53ad830931b9f9",
"hash_type":"type",
"args":"0x40d73f0d3c561fcaae330eabc030d8d96a9d0af36d0c5114883658a350cb9e3bb67689858f88b58eeea9324a52a934b59f2beb22"
}} 3. The eth_address of the account is the last 20 bytes of
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Solution
Let's say you have a godwoken_short_address
0xaa61ffa7c181bd3e23cb62c91291178e70c7b311
.1. gw_get_script_hash_by_short_address
Result
-> 0xaa61ffa7c181bd3e23cb62c91291178e70c7b311715511e299776a199f9f9c72
2. gw_get_script