Hot answers tagged

17 votes

How to create a database out of the Tezos node?

You could modify Conseil in order to support the extraction of voting related info. Another approach is to use the tzscan codebase, which also fills a database with information from the Tezos node. ...
user avatar
  • 4,409
14 votes
Accepted

How to query rewards of a specific KT1 account?

Unfortunately there is no way to directly query just the delegator's reward from TzScan API. But you can easily use this API call with some extra calculations: //This is what the baker got var ...
user avatar
  • 2,327
12 votes
Accepted

How do I query the Balance of a KT1 account Cycle by Cycle?

<block_id> - is a hash or a level of the block at which you ask for balance. If you want to get a simple balance at the specific point in the cycle: (this is pseudocode, I hope you figure it ...
user avatar
  • 2,327
10 votes

What are the best practices for hosting Tezos nodes with exposed RPCs?

What we do for TezRPC (which powers TezBox) is run a proxy on each server. Within this proxy, you can then block, restrict and customize public facing endpoints. We currently use a light proxy built ...
user avatar
10 votes
Accepted

How to create a transaction

There are multiple references online which provide material to understand the steps involved in this. You can check this or that. Some elements are also provided in this other question Basically the ...
user avatar
  • 6,006
9 votes
Accepted

How to make a tezos node set CORS headers

You need to start the node with these options: --cors-header='content-type' --cors-origin='*'. Once you’ve started the node with these options the response headers should allow a JavaScript ...
user avatar
9 votes
Accepted

Binding the node to any address, not just localhost

If you are using a configuration file, there are two different ports : the "listen-addr" option can be used both in the "p2p" section and in the "rpc" section. You can use "0.0.0.0:8732" for example ...
user avatar
  • 3,278
8 votes

How do I query the Balance of a KT1 account Cycle by Cycle?

You can use TzScan API for this: /v3/balance_history/KT1..., the documentation is here: balance history doc. For example https://api6.tzscan.io/v3/balance_history/KT1GgUJwMQoFayRYNwamRAYCvHBLzgorLoGo
user avatar
  • 194
8 votes
Accepted

How to get big map value on Babylon

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&...
user avatar
7 votes

What are all of the operation types supported in Tezos?

$ ./tezos-client rpc schema post /chains/main/blocks/head/helpers/forge/operations | jq '.input.definitions."operation.alpha.contents".oneOf | .[] | .properties.kind.enum | .[0]' "endorsement" "...
user avatar
7 votes
Accepted

What are the best practices for hosting Tezos nodes with exposed RPCs?

Either: don't expose the RPC at all (!), or put a proxy in front with a maximally restrictive whitelist. Of course, for a whitelist to help, you must not include potentially harmful endpoints in ...
user avatar
  • 2,526
7 votes
Accepted

How do I get a list of baking rights for a wallet address using the RPC API?

GET ../<block_id>/helpers/baking_rights?(level=<block_level>)*&(cycle=<block_cycle>)*&(delegate=<pkh>)*&[max_priority=<int>]&[all] Retrieves the list ...
user avatar
7 votes

How i can get the header of an uncle block using rpc?

A node does not keep the former alternative heads. You can only query the current heads: tezos-client -A mainnet-node.tzscan.io rpc help /chains/main/blocks Old ones are removed when their fitness ...
user avatar
  • 3,278
6 votes

What are the best practices for hosting Tezos nodes with exposed RPCs?

When you only need the RPC for yourself you could also use ssh local port forwarding to forward the RPC from the localhost of your remote machine to the localhost of your local machine. For instance, ...
user avatar
  • 893
6 votes

What are the best practices for hosting Tezos nodes with exposed RPCs?

One of the alternatives i could think of, is using Conseil: https://github.com/Cryptonomic/Conseil In my humble understanding what Conseil does, is provide an extended API on top of a tezos-node/rpc. ...
user avatar
6 votes
Accepted

Tezos alpha node cors

You are sending your query to the wrong address - it should be (note you are missing "chain/main/"): https://alphanet-node.tzscan.io/chains/main/blocks/head/context/contracts/<contract_id>/...
user avatar
6 votes
Accepted

How to use rpc parse operations endpoint

The problem is that /parse/operations expects signed operations. You can just add 64 zero bytes to the end: { "operations": [ { "data": "...
user avatar
  • 2,526
6 votes

How to get big map value on Babylon

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/...
user avatar
5 votes
Accepted

How is chain_id computed?

The chain_id is computed from the genesis block hash as follows. First, in pseudocode: tezosB58CheckEncode('Net', firstFourBytes( blake2b(msg = tezosB58CheckDecode('B', genesisBlockHash), ...
user avatar
  • 2,526
5 votes
Accepted

is it possible for tezos-node RPC to authenticate clients with SSL?

This is currently not supported. You can use an nginx proxy to secure it with HTTP Basic Authentication with the following configuration that uses a https connection on standard port: server { ...
user avatar
  • 422
5 votes

How do I get the contents of a big_map through the RPC interface?

As of 004_Pt24m4xi: You can use the big_map_get RPC to get individual values out. There is also a tezos-client command for this. (By passing -l we can see how it works through the RPC.) $ tezos-...
user avatar
  • 2,526
4 votes
Accepted

How to call a smart contract method with params with eztz?

You can use the contract send method: eztz.contract.send(contract, keys, amount, parameter, fee, gasLimit, storageLimit) For parameter, you just enter in the raw Michelson input (the same you would ...
user avatar
4 votes

How to create a transaction

helpers/scripts/run_operation is useful to simulate an operation without signing it (you may use zero bytes for the signature), in order to estimate the gas and storage requirements. You will see ...
user avatar
  • 2,526
4 votes
Accepted

Gas consumption in a chain of internal transfers

You cannot exceed the hard_gas_limit_per_operation = 400000. It will probably be increased in future protocols, though (see e.g. the "Athens" proposals). Internal transfers can use up a lot of gas. ...
user avatar
  • 2,526
4 votes
Accepted

Can /context/constants change apart from a protocol change?

No it is not. Constants are set in the genesis block and then changed only by amendments. They are stored in the context, which is the state passed to and returned by the protocol when it validates a ...
user avatar
4 votes

which rpc endpoint is used to find the roll snapshot which was used for determining baking/endorsing rights at a certain cycle?

You can get information about snapshot for a given cycle from the raw context: var cycle = 100; var level = cycle * 4096 + 1; var snapshot = get('/chains/main/blocks/{level}/context/raw/json/...
user avatar
  • 2,327
4 votes

Tezos RPC doesn't respond with blocks below the current checkpoint

The blog post you referenced says that: A node running in full-mode stores the full chain data for all blocks, even the ones older than the current checkpoint. More precisely, it keeps the headers ...
user avatar
  • 141
4 votes
Accepted

Current level of block-chain

You can request the current head of your node using ./tezos-client rpc get /chains/main/blocks/head (and look for the level and hash information). Then, use your favorite block explorer to know the ...
user avatar
  • 691
4 votes
Accepted

How do you discover the indexes of the big maps of a contract?

The tezos-client and tezos-node RPC have no such feature. If you don't mind using an API other then the node RPC you can find this in the new version of the tzstats indexer (GET /explorer/contract/{...
user avatar
  • 434
4 votes

Find balance of an address/contract at a given block / date

You can use the HTTP-RPC interface on your local node. http://localhost:8732/chains/main/blocks/{BLOCK}/context/contracts/{ADDRESS}/balance On a default node, this is only good for the previous 5 ...
user avatar
  • 3,364

Only top scored, non community-wiki answers of a minimum length are eligible