1"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[419],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),d=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=d(e.components);return r.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||s;return n?r.createElement(f,o(o({ref:t},l),{},{components:n})):r.createElement(f,o({ref:t},l))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var d=2;d<s;d++)o[d]=n[d];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"},48720:(e,t,n)=>{n.d(t,{D:()=>a.Z,Z:()=>s});var r=n(67294),a=n(75402);const s=function(e){return r.createElement(a.Z.Consumer,null,(t=>{let{syntax:n}=t;return n===e.syntax?e.children:r.createElement(r.Fragment,null)}))}},93514:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905)),s=n(48720);const o={id:"address",title:"Address"},c=void 0,i={unversionedId:"data-types/address",id:"data-types/address",title:"Address",description:"An address on the Tezos blockchain is a string whose suffix is the",source:"@site/../docs/data-types/address.md",sourceDirName:"data-types",slug:"/data-types/address",permalink:"/docs/next/data-types/address",draft:!1,tags:[],version:"current",frontMatter:{id:"address",title:"Address"},sidebar:"docs",previous:{title:"Cryptographic signatures",permalink:"/docs/next/data-types/signature"},next:{title:"Contracts",permalink:"/docs/next/data-types/contracts-type"}},d={},l=[{value:"Sender",id:"sender",level:2},{value:"Source",id:"source",level:2}],p={toc:l};
1function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"An address on the Tezos blockchain is a string whose suffix is the\nhash of the public key of an account."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"If the account is a smart contract (sometimes known as an ",(0,a.kt)("em",{parentName:"p"},"originated account"),"), the address starts with ",(0,a.kt)("inlineCode",{parentName:"p"},"KT1"),".")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"If the account is a user account (sometimes known as an ",(0,a.kt)("em",{parentName:"p"},"implicit account"),"), the address starts with ",(0,a.kt)("inlineCode",{parentName:"p"},"tz1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"tz2"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"tz3"),", or ",(0,a.kt)("inlineCode",{parentName:"p"},"tz4"),"."))),(0,a.kt)("p",null,"For more information about Tezos addresses, see ",(0,a.kt)("a",{parentName:"p",href:"https://docs.tezos.com/architecture/accounts"},"Accounts and addresses")," on docs.tezos.com."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"address")," type represents a well-formed Tezos address.\nHowever, the type being well-formed does not automatically mean that the address is valid and identifies a real account.\nBeware of failures if the address is invalid."),(0,a.kt)("p",null,"To create an address in LIGO, cast a string to the ",(0,a.kt)("inlineCode",{parentName:"p"},"address")," type, as in this example:"),(0,a.kt)(s.Z,{syntax:"cameligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cameligo",metastring:"group=address",group:"address"},'let my_account : address =\n ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)\n'))),(0,a.kt)(s.Z,{syntax:"jsligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-jsligo",metastring:"group=address",group:"address"},'const my_account: address =\n "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" as address;\n'))),(0,a.kt)("p",null,"To get the address of the current contract, see ",(0,a.kt)("a",{parentName:"p",href:"../syntax/contracts"},"Contracts"),"."),(0,a.kt)("h2",{id:"sender"},"Sender"),(0,a.kt)("p",null,"The ",(0,a.kt)("em",{parentName:"p"},"sender")," is the address of the account (smart contract or user account) that initiated the current transaction.\nThe sender can be different from the ",(0,a.kt)("em",{parentName:"p"},"source")," of the transaction."),(0,a.kt)("p",null,"For example, suppose that user account A calls contract B and as a result, contract B calls contract C.\nIn the context of contract C, contract B is the sender because it sent the immediate transaction to contract C.\nConversely, account A is the source because it initiated the current chain of transactions.\nAccount A is the source of all subsequent transactions in the chain, including any transactions that result from the call to contract C."),(0,a.kt)(s.Z,{syntax:"cameligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cameligo",metastring:"group=sender",group:"sender"},"let sender : address = Tezos.get_sender ()\n"))),(0,a.kt)(s.Z,{syntax:"jsligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-jsligo",metastring:"group=sender",group:"sender"},"const sender: address = Tezos.get_sender();\n"))),(0,a.kt)("h2",{id:"source"},"Source"),(0,a.kt)("p",null,"The ",(0,a.kt)("em",{parentName:"p"},"source")," is the address of the user (implicit) account that initiated the current chain of transactions.\nIf there is more than one transaction in the chain, that address is different from the ",(0,a.kt)("em",{parentName:"p"},"sender"),"."),(0,a.kt)(s.Z,{syntax:"cameligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cameligo",metastring:"group=source",group:"source"},"let source : address = Tezos.get_source ()\n"))),(0,a.kt)(s.Z,{syntax:"jsligo",mdxType:"Syntax"},(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-jsligo",metastring:"group=source",group:"source"},"const source: address = Tezos.get_source();\n"))))}u.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.