Come ottenere un grande valore di mappa su Babylon
2 risposta
- voti
-
-
2019-10-16
Lanuova CLI e RPC perbig map hash di un'espressione di script,invece dell'espressionegrezza. Per ottenere l'hashpuoi adesempio:
tezos-client hash data '"tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys"' of type address
Questo stamperàgli hashin moltiformati diversi: vuoi quello con l'etichetta
Script-expression-ID-Hash
,ades.exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN
.Quindipuoi usarlo con la CLI:
tezos-client get element exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN of big map 22
e RPC su:
/chains/main/blocks/head/context/big_maps/22/exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN
Modifica:
È stato aggiunto unnuovo comando CLIper un accessopiù semplice allamappagrande:
tezos-client get big map value for '"tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys"' of type address in <src>
dove
<src>
puòessere un alias,una chiave o un valore letterale (neltuo casoKT1DT9YwHdSbZuVuZDjd1SMUcfXm57R5bE9v
).The new CLI and RPC for big map expect hash of a script expression, instead of the raw expression. To obtain the hash you can e.g.:
tezos-client hash data '"tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys"' of type address
This will print hashes in bunch of different formats - you want the one with the label
Script-expression-ID-Hash
, e.g.exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN
.Then you can use this with the CLI:
tezos-client get element exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN of big map 22
and RPC at:
/chains/main/blocks/head/context/big_maps/22/exprv6UsC1sN3Fk2XfgcJCL8NCerP5rCGy1PRESZAqr7L2JdzX55EN
Edit:
A new CLI command has been added for simpler big map access:
tezos-client get big map value for '"tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys"' of type address in <src>
where
<src>
can be an alias, a key, or a literal (in your caseKT1DT9YwHdSbZuVuZDjd1SMUcfXm57R5bE9v
).-
Potrebbe valere lapenamenzionareilmotivoper cui questo è cambiato.1) L'uso di GETinvece di POSTper questa query è semanticamentepiù valido,questa query richiede solo datie non cambianulla sulbackend.2) Prima di Carthagenet,un contrattopoteva avere solo unagrandemappa,orapuò averepiùmappegrandi.Ciascuna di questegrandimappe ha una chiave diidentificazione univoca.It might be worth mention why this has changed. 1) Using GET instead of POST for this query is semantically more sound, this query only requests data and does not change anything on the backend. 2) Before Carthagenet, a contract could only have one big map, now it can have multiple big maps. Each of those big maps have a unique identifying key.
-
0
2020-06-18
-
MCH
-
-
-
-
2019-10-15
Il comando cli è
tezos-client get big map value for <key> of type <type of the key> in <contract>
.Aggiungendo l'opzione-l
,otteniamo anche l'RPC:/chains/main/blocks/head/context/contracts/<contract address>/big_map_get
.In realtà,non ènecessario conoscere l'indice dellamappagrande,se vengonomemorizzatepiùmappegrandi con lo stessotipo di chiavi,verrà ricercata la chiave.
The cli command is
tezos-client get big map value for <key> of type <type of the key> in <contract>
. By adding the-l
option, we also get the RPC:/chains/main/blocks/head/context/contracts/<contract address>/big_map_get
.Actually, you do not need to know the big map index, if several big_maps with the same type of keys are stored, they will all be searched for the key.
-
`getbig map value` èelencato come deprecato ora=(`get big map value` is listed as deprecated now =(
-
0
2020-03-02
-
Justin
-
-
Dirò che "ottenere ungrande valore dellamappa" èmoltopiù sempliceperilprocesso di sviluppo.Vedo ancoramolti contrattiprogettatiin modotale dapoter continuare a utilizzare questo comando anche se èelencato come deprecato.Ovviamentefunziona soloper unagrandemappa che sitrova sul lato sinistro di una coppianellaparte superiore di un archivio di contratti.I will say `get big map value` is much easier for the development process. I still see a lot of contracts designed such that they can continue using this command even though it is listed as deprecated. Of course, it only works for a big map that is in the left side of a pair at the top of a contracts storage.
-
0
2020-06-18
-
MCH
-
-
Babylon avrà unnuovo RPCperinterrogareil valore dellamappagrandein base a questo link http://tezos.gitlab.io/babylonnet/api/rpc.html#get-block-id-context-big-maps-big -map-id-script-expr
Hoprovato a utilizzarlo con unnuovo contratto. Ho distribuito questo contratto https://babylonnet.tzscan.io/KT1DTbPDjd1SMUcfXm57R5bE9v" rel="noreferrer"> https://babylonnet.tzscan.io/KT1DZDBYwHdm
Se ho capitobene,l'ID dellamiamappagrande dovrebbeessere
22
Sapendo che lamiagrandemappa è statainizializzata con una chiave
tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys
Qual èilmodo correttoper ottenereil valore utilizzando cli o rpc?
Hoprovato:
tezos get element tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys of big map 22
http://babylonnet-node.tzscan.io/chains/main/blocks/head/context/big_maps/22/tz1bwsEWCwSEXdRvnJxvegQZKeX5dj6oKEys
Entrambinonfunzionano. Se ho capitobene,probabilmente avròbisogno di codificare lamia chiave. Non sono sicuro di quale sia la codifica richiestae non riesco atrovare unesempio chefunzioni.