Quick start

Installing the library

For quick-start, you may also like to try out our template/boilerplate app here

The following instructions assume you have a project already created, and you have npm installed and operable.

npm install @taquito/taquito

Import the library in your project

You can access Tezos Toolkit in one of two ways.

Import Tezos (a singleton object) from @taquito/taquito

import { Tezos } from '@taquito/taquito';

Import TezosToolkit from @taquito/taquito and instantiate it

This approach is only required if you need to instantiate more than one toolkit.

import { TezosToolkit } from '@taquito/taquito';
const tezos = new TezosToolkit();

Configuration

Changing the underlying rpc

import { Tezos } from '@taquito/taquito';
Tezos.setProvider({ rpc: 'your_rpc' });

Changing the underlying signer

import { Tezos } from '@taquito/taquito';
import { TezBridgeSigner } from '@taquito/tezbridge-signer';
Tezos.setProvider({ signer: new TezBridgeSigner() });

Example

Get balance

Live Editor
Result

Get balance history

Live Editor
Result

Import a key

This will import your private key in memory and sign operations using this key.

Private key

Tezos.importKey('p2sk2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1');

Faucet Key

A faucet key can be generated at https://faucet.tzalpha.net/

const FAUCET_KEY = {
"mnemonic": [
"cart",
"will",
"page",
"bench",
"notice",
"leisure",
"penalty",
"medal",
"define",
"odor",
"ride",
"devote",
"cannon",
"setup",
"rescue"
],
"secret": "35f266fbf0fca752da1342fdfc745a9c608e7b20",
"amount": "4219352756",
"pkh": "tz1YBMFg1nLAPxBE6djnCPbMRH5PLXQWt8Mg",
"password": "Fa26j580dQ",
"email": "jxmjvauo.guddusns@tezos.example.org"
};
Tezos.importKey(
FAUCET_KEY.email,
FAUCET_KEY.password,
FAUCET_KEY.mnemonic.join(' '),
FAUCET_KEY.secret
);

Transfer

The transfer operation requires a configured signer. In this example we will use a private key that we will get from a service that was implemented for demonstration purposes and should only be used for testing and development.

Live Editor
Result

Interact with a smart contract

Calling smart contract operations require a configured signer, in this example we will use a faucet key. The source for the smart contract KT1LjpCPTqGajeaXfLM3WV7csatSgyZcTDQ8 used in this example can be found in a Ligo Web IDE.

Live Editor
Result