tag:blogger.com,1999:blog-90147302853862598232024-03-14T00:49:26.330+05:30Prasanna Kumar PattamA dairy of my Programming NotesPrasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.comBlogger140125tag:blogger.com,1999:blog-9014730285386259823.post-26956468539432564442020-06-10T21:22:00.001+05:302020-06-10T21:22:44.781+05:30Azure Web App Custom Domain<div class="separator"><span><a name='more'></a></span><a href="https://1.bp.blogspot.com/-ttzQM2DJ46A/XuD4XQrJhGI/AAAAAAAAgLk/4ATaSi2W5NwAfba2Xet5Mdtjz_9z0zWeQCK4BGAsYHg/s589/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="254" data-original-width="589" height="276" src="https://1.bp.blogspot.com/-ttzQM2DJ46A/XuD4XQrJhGI/AAAAAAAAgLk/4ATaSi2W5NwAfba2Xet5Mdtjz_9z0zWeQCK4BGAsYHg/w640-h276/image001.png" width="640" /></a></div><br /><p class="MsoNormal">To map a custom domain for web app, the App Service Plan
should be Shared or above. You cannot define a custom domain for a free web
app.</p><p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">I am going to create a subdomain for my practice web app, I
am using for the AZ-304 Azure certification. I will be creating a subdomain
called az-304 in my Nootus domain. The domain address of this web service will
be <a href="http://az-304.nootus.com/">http://az-304.nootus.com</a>. Here are
the steps to create a custom domain for your web app hosted on Azure.</p><p class="MsoNormal"></p><ol style="text-align: left;"><li><span style="text-indent: -18pt;">Navigate to the Custom Domain section of your Web
App in Azure portal</span></li><p></p><p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt;"><o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-MgUV6Kjy4qI/XuD429pf1mI/AAAAAAAAgL4/wk4aptQqpD4xsohg7Ut1Bh8RsHNgi4FsgCK4BGAsYHg/s970/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="553" data-original-width="970" height="228" src="https://1.bp.blogspot.com/-MgUV6Kjy4qI/XuD429pf1mI/AAAAAAAAgL4/wk4aptQqpD4xsohg7Ut1Bh8RsHNgi4FsgCK4BGAsYHg/w400-h228/image002.png" width="400" /></a>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>2.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Note the IP Address and Custom Domain
Verification ID mentioned in the Custom Domains section of the Azure portal<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>3.<span style="font: 7pt "times new roman";"> </span></span></span>Then, go to your domain provider. In my case
GoDaddy is the domain provider for my domain, Nootus.com<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>4.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Go to the DNS Management of the domain<o:p></o:p></p>
<div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-WzhAlGN62tk/XuD5K0ZFaoI/AAAAAAAAgMQ/Xd7tsM_FPNQCOz2rbGbSWebdC0mPivU4wCK4BGAsYHg/s1053/image004.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="649" data-original-width="1053" height="246" src="https://1.bp.blogspot.com/-WzhAlGN62tk/XuD5K0ZFaoI/AAAAAAAAgMQ/Xd7tsM_FPNQCOz2rbGbSWebdC0mPivU4wCK4BGAsYHg/w400-h246/image004.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>5.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->I am creating a custom domain, az-304, hence
this will be my configuration at GoDaddy using the settings from Azure portal<o:p></o:p></p>
<div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-3GHBGB51xn8/XuD5emvGXNI/AAAAAAAAgMk/lu8712IgeSANM_KR2-QhJ_LpLFk8kPqLwCK4BGAsYHg/s567/image006.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="128" data-original-width="567" height="90" src="https://1.bp.blogspot.com/-3GHBGB51xn8/XuD5emvGXNI/AAAAAAAAgMk/lu8712IgeSANM_KR2-QhJ_LpLFk8kPqLwCK4BGAsYHg/w400-h90/image006.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>6.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Now let’s go back to the Azure Portal<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>7.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Click on Add custom domain</p><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-XjJ8SXnTj08/XuD5l9Z3wzI/AAAAAAAAgMw/kMz8Qw7g-0kAGHqGZU7kNvmNn2hNxpTBQCK4BGAsYHg/s549/image007.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="297" data-original-width="549" height="216" src="https://1.bp.blogspot.com/-XjJ8SXnTj08/XuD5l9Z3wzI/AAAAAAAAgMw/kMz8Qw7g-0kAGHqGZU7kNvmNn2hNxpTBQCK4BGAsYHg/w400-h216/image007.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>8.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Provide the subdomain created at GoDaddy</p><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-7Cv9ZhjApW4/XuD5uSct-iI/AAAAAAAAgNA/8F5FUTV1SXMfabVPlCGjQeDfFx01_wgYQCK4BGAsYHg/s298/image009.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="214" data-original-width="298" height="287" src="https://1.bp.blogspot.com/-7Cv9ZhjApW4/XuD5uSct-iI/AAAAAAAAgNA/8F5FUTV1SXMfabVPlCGjQeDfFx01_wgYQCK4BGAsYHg/w400-h287/image009.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>9.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Select A record option and click Add Custom
Domain</p><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-uIKRqFmiNZ0/XuD56CUm-kI/AAAAAAAAgNU/BbBxqXhp0ZUJ_vOjhvNsLysPUriui8UmQCK4BGAsYHg/s398/image010.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="335" data-original-width="398" height="336" src="https://1.bp.blogspot.com/-uIKRqFmiNZ0/XuD56CUm-kI/AAAAAAAAgNU/BbBxqXhp0ZUJ_vOjhvNsLysPUriui8UmQCK4BGAsYHg/w400-h336/image010.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>10.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->You will see the custom domain added to the list
of assigned custom domains</p><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-lFbRX-O3pCA/XuD6EHL114I/AAAAAAAAgNk/cRa9Z30UrF8GzStA5Wfbqe54ivan5P4GgCK4BGAsYHg/s869/image011.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="213" data-original-width="869" height="98" src="https://1.bp.blogspot.com/-lFbRX-O3pCA/XuD6EHL114I/AAAAAAAAgNk/cRa9Z30UrF8GzStA5Wfbqe54ivan5P4GgCK4BGAsYHg/w400-h98/image011.png" width="400" /></a></div>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>11.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Optionally you can add a SSL binding. In my
scenario, I don’t need ssl binding, hence skipping this step<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span><span>12.<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->The custom domain, <a href="http://az-304.nootus.com/">http://az-304.nootus.com</a> is now available
to browse</p>
</ol><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-znFqioh5WWQ/XuD6S6MayKI/AAAAAAAAgN4/BrZJYKthp3o5N3Gq6_HYyATklV6fKkpTgCK4BGAsYHg/s805/image013.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="703" data-original-width="805" height="349" src="https://1.bp.blogspot.com/-znFqioh5WWQ/XuD6S6MayKI/AAAAAAAAgN4/BrZJYKthp3o5N3Gq6_HYyATklV6fKkpTgCK4BGAsYHg/w400-h349/image013.png" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div>
<p class="MsoNormal">With these steps I was able to create a custom domain for my
App Service Web App in Azure.</p><p class="MsoNormal"><br /></p>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-1351694233164594162020-05-10T19:43:00.002+05:302020-05-10T19:45:35.228+05:30Custom Domain for Azure Active Directory<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-t5Qnr1rm_cc/XrgKpJ2pmsI/AAAAAAAAgFQ/pB1Kl-Kk3ag-7UNl3uyHdZBXAugqfmexwCK4BGAsYHg/image001.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="254" data-original-width="840" height="194" src="https://1.bp.blogspot.com/-t5Qnr1rm_cc/XrgKpJ2pmsI/AAAAAAAAgFQ/pB1Kl-Kk3ag-7UNl3uyHdZBXAugqfmexwCK4BGAsYHg/w640-h194/image001.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><p class="MsoNormal"><o:p></o:p></p>
<h1>What is Azure Active Directory<o:p></o:p></h1>
<p class="MsoNormal">Azure Active Directory (Azure AD) is Microsoft’s cloud-based
identity and access management service, which helps employees sign in and
access resources in:</p><p class="MsoNormal"></p><ul style="text-align: left;"><li><span style="text-indent: -18pt;">External resources, such as Microsoft Office
365, the Azure portal, and thousands of other SaaS applications.</span></li><li>Internal resources, such as apps on your
corporate network and intranet, along with any cloud apps developed by your own
organization.</li></ul><p></p><p class="MsoListParagraphCxSpLast" style="text-indent: -18pt;"><o:p></o:p></p>
<h1>Custom Domain for Users<o:p></o:p></h1>
<p class="MsoNormal">Every user in Azure Active Directory has a username. This
user name must have a domain name. Having our own domain name is more memorable
and branding than using a generic domain name created by Azure. Our own domain
name should be registered in Active Directory. If we don’s have own domain name
to register in Active Directory, then we can use a generic domain name created
by Azure AD. <o:p></o:p></p>
<p class="MsoNormal">Azure creates an initial domain as nootus.onmicrosoft.com
(nootus is the name of your active directory). To add a custom domain the domain
name has to be verified in Azure. We need to verify that we own the domain
name. The administrator can add more than one domain to the Azure Active
Directory.<o:p></o:p></p>
<p class="MsoNormal">Adding Custom Domain<o:p></o:p></p>
<p class="MsoNormal">We can associate a domain name we own with Azure AD. This
enables users identified by our organization. Here are the steps to register a
domain name in Azure AD.</p><p class="MsoNormal" style="text-align: left;"><span style="font-family: symbol; text-indent: -24px;">·</span><span style="font: 7pt "times new roman"; text-indent: -24px;"> </span><span style="text-indent: -18pt;">Go to the Azure Active and choose then to the
custom domain name</span><span style="text-indent: -18pt;"> </span></p><p class="MsoListParagraph" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-RB-B2Nc0kh8/XrgLMtZkVxI/AAAAAAAAgFk/3rje9m3uyXgOtEPNUYiLT6PyakpWbFA5QCK4BGAsYHg/image003.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="449" data-original-width="1059" height="272" src="https://1.bp.blogspot.com/-RB-B2Nc0kh8/XrgLMtZkVxI/AAAAAAAAgFk/3rje9m3uyXgOtEPNUYiLT6PyakpWbFA5QCK4BGAsYHg/w640-h272/image003.png" width="640" /></a><br />
<p class="MsoListParagraphCxSpFirst" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Click Add Custom Domain and provide the domain
name you own and click Add Domain<o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-Yl_5lOOJRBc/XrgLY5gNYvI/AAAAAAAAgGQ/6lseH-gvGxgL_yXxDxmb82Rn_SP18slXACK4BGAsYHg/image005.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="349" data-original-width="321" height="400" src="https://1.bp.blogspot.com/-Yl_5lOOJRBc/XrgLY5gNYvI/AAAAAAAAgGQ/6lseH-gvGxgL_yXxDxmb82Rn_SP18slXACK4BGAsYHg/w368-h400/image005.png" width="368" /></a><br />
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->This takes to the verification page, which shows
the configuration to make in our domain registration<o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-MvCqJvONWwo/XrgLZeVf7mI/AAAAAAAAgGU/DPbvm-CfMHodvmkI3BmWtq7SkhhgwNqVQCK4BGAsYHg/image006.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="559" data-original-width="591" height="379" src="https://1.bp.blogspot.com/-MvCqJvONWwo/XrgLZeVf7mI/AAAAAAAAgGU/DPbvm-CfMHodvmkI3BmWtq7SkhhgwNqVQCK4BGAsYHg/w400-h379/image006.png" width="400" /></a>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Copy the configuration to setup in our domain
registration<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Now head over to the domain registrar. In my
case my domain is registered with GoDaddy<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Create the TXT record in domain management as
shown above<o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-OG9yJjfzNJg/XrgLZkIJc3I/AAAAAAAAgGY/LGgsJo-HrqcVFV-16rp5avhG7xZqiRScwCK4BGAsYHg/image007.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="294" data-original-width="891" height="133" src="https://1.bp.blogspot.com/-OG9yJjfzNJg/XrgLZkIJc3I/AAAAAAAAgGY/LGgsJo-HrqcVFV-16rp5avhG7xZqiRScwCK4BGAsYHg/w400-h133/image007.png" width="400" /></a><br />
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt;"><o:p> </o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Once the TXT record is created in our domain
registration, let’s return to the Azure and click Verify<o:p></o:p></p>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Azure AD verified the domain name ownership and
add the Domain name in the Active Directory<o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-IsdA8RrRlPg/XrgLZ0L-mRI/AAAAAAAAgGc/avomnwxLHUswJd6No2W96Z4XrMJzC0ShgCK4BGAsYHg/image009.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="423" data-original-width="685" height="396" src="https://1.bp.blogspot.com/-IsdA8RrRlPg/XrgLZ0L-mRI/AAAAAAAAgGc/avomnwxLHUswJd6No2W96Z4XrMJzC0ShgCK4BGAsYHg/w640-h396/image009.png" width="640" /></a>
<p class="MsoListParagraphCxSpMiddle" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->We can make this Domain name as our primary
domain name</p>
<p class="MsoListParagraphCxSpLast" style="margin-left: 18pt; text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: symbol;"><span>·<span style="font: 7pt "times new roman";">
</span></span></span><!--[endif]-->Now we can see our custom domain name in the
Azure AD domain names<o:p></o:p></p>
<a href="https://1.bp.blogspot.com/-Pv0WCbp9pE4/XrgLaIP-1HI/AAAAAAAAgGg/KDbfT_JPWWk964aTfftyPxFcXwqMFyBzQCK4BGAsYHg/image011.png" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="242" data-original-width="624" height="248" src="https://1.bp.blogspot.com/-Pv0WCbp9pE4/XrgLaIP-1HI/AAAAAAAAgGg/KDbfT_JPWWk964aTfftyPxFcXwqMFyBzQCK4BGAsYHg/w640-h248/image011.png" width="640" /></a><br />
<p class="MsoNormal">With these steps, we can add our own domain name to the
Azure Active Directory. After adding the custom domain, we can then add users
in this domain to the Active Directory. Please see my other blog on adding
users to the Active Directory.<o:p></o:p></p><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-47331101116616109822020-03-29T12:29:00.000+05:302020-04-19T17:47:06.335+05:30Creating Azure Active Directory<br />
<h1>
What is Azure Active Directory<o:p></o:p></h1>
<div class="MsoNormal">
Azure Active Directory (Azure AD) is Microsoft’s cloud-based
identity and access management service, which helps employees sign in and
access resources in:<br />
<br />
<ul>
<li><span style="text-indent: -18pt;">External resources, such as Microsoft Office
365, the Azure portal, and thousands of other SaaS applications.</span></li>
<li><span style="text-indent: -18pt;">Internal resources, such as apps on your
corporate network and intranet, along with any cloud apps developed by your own
organization.</span></li>
</ul>
</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<o:p></o:p></div>
<h1>
Identity and Access Management as a service (IDaaS)<o:p></o:p></h1>
<div class="MsoNormal">
Azure Active Directory is an Identity and Access Management
as a service (IDaaS) solution that extends your on-premises directories into
the cloud and provides single sign-on to Azure, Office 365 and thousands of
cloud (SaaS) apps and access to web apps you run on-premises.<o:p></o:p></div>
<div class="MsoNormal">
Built for ease of use, Azure Active Directory enables
enterprise mobility and collaboration and delivers advanced identity protection
through multi-factor authentication (MFA), security reports, audits, alerts and
adaptive conditional access policies based on device health, user location and
risk level.<o:p></o:p></div>
<h1>
Creating Azure Active Directory<o:p></o:p></h1>
<div class="MsoNormal">
Here are the step-by-step screenshots on creating Azure
Active Directory:<o:p></o:p></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l3 level1 lfo2; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->First go to the create new resource and search
for Active Directory<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-ns4F1QgGN0Q/Xpw-9t_oJcI/AAAAAAAAgAw/6C1zVBvnl-cG8cI7O3lV5I04dc2fAWIUACEwYBhgLKs4DAL1OcqxdWKIWC4sGFbETaLIhNgwOFrFdyFQSOdFnlYnI359q9ToI9TJSQXjnpmXTLoztlcN1NReSb_A8E34CHYEJk3R5Hrbs3UiUoZqhIOGVFbXKuc-S4PtQsi9UwYGK1j-5cq8XirgWIvBGPIJatL9UYoQSslNqiN4ePmhnanU1X2PHlD1m9uWZpqnNIo5hDXyjYRv9a-HyHLlcJnyGsx10rENe7pXdxjd6WlZGLVgYCjbHKy3NXNUd3J65UdN3yE-49SS0Ff31Xe_ymj_Od4Z065kwU0fxySjJcmpg322bI59_XnvXziJKc0DYTuatFcJGXv1_ni8YiWoGFnL9V4J8teifXtnnhO8ZaIn2BsTI76NPuKRTZVx9m_wl4-GI4W1dCm4-EmlUFKklZwSK1IIzLk1giSiE9Rh-9Il_3MkvcLlkARdPT5xIPlzEA9kn2Zxd1yd-2q4CU_AsxLgizVtQUDpRaDXfuKL8j6-UTyI-0fRZ33iK1JlLSqHl4SdZslK02362K_hQq8QGpZQoQ309EbZAE3XwZDw0PSaWi0rS8PMDA2okXSbqE1Vcdag36vukihQ6i8CJDauTwApNFN4WTbg_4BgiGVOYq-fjMIqD8fQF/s1600/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="338" data-original-width="557" height="388" src="https://1.bp.blogspot.com/-ns4F1QgGN0Q/Xpw-9t_oJcI/AAAAAAAAgAw/6C1zVBvnl-cG8cI7O3lV5I04dc2fAWIUACEwYBhgLKs4DAL1OcqxdWKIWC4sGFbETaLIhNgwOFrFdyFQSOdFnlYnI359q9ToI9TJSQXjnpmXTLoztlcN1NReSb_A8E34CHYEJk3R5Hrbs3UiUoZqhIOGVFbXKuc-S4PtQsi9UwYGK1j-5cq8XirgWIvBGPIJatL9UYoQSslNqiN4ePmhnanU1X2PHlD1m9uWZpqnNIo5hDXyjYRv9a-HyHLlcJnyGsx10rENe7pXdxjd6WlZGLVgYCjbHKy3NXNUd3J65UdN3yE-49SS0Ff31Xe_ymj_Od4Z065kwU0fxySjJcmpg322bI59_XnvXziJKc0DYTuatFcJGXv1_ni8YiWoGFnL9V4J8teifXtnnhO8ZaIn2BsTI76NPuKRTZVx9m_wl4-GI4W1dCm4-EmlUFKklZwSK1IIzLk1giSiE9Rh-9Il_3MkvcLlkARdPT5xIPlzEA9kn2Zxd1yd-2q4CU_AsxLgizVtQUDpRaDXfuKL8j6-UTyI-0fRZ33iK1JlLSqHl4SdZslK02362K_hQq8QGpZQoQ309EbZAE3XwZDw0PSaWi0rS8PMDA2okXSbqE1Vcdag36vukihQ6i8CJDauTwApNFN4WTbg_4BgiGVOYq-fjMIqD8fQF/s640/image001.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<br /></div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l3 level1 lfo2; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Choose Active Directory resource<o:p></o:p></div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_5" o:spid="_x0000_i1033" type="#_x0000_t75" style='width:468pt;
height:348.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Kx9T5QmiCgk/Xpw-9kz2j0I/AAAAAAAAgB4/5l-L_VixQY8D4hbEcBq1UoqJqshT3r42gCEwYBhgLKs4DAL1OcqyM2pbvxTuR7S68k_RiZd8rK9TvgJ5ehMyVSKnMw8LvoEmITcsv_kzKCoRE16kHDDKYVOaa-iYGO9yzIkUw1ozVW_NCiRMzSLhwBNRTtM3K_JX7HQe9HCthB7FnFzUg-KD1MP6NKUci3iZw_ANlqRuhAZQl5GmDiekL2-1ieLjyy6yrq9zF2uusHX2mvnPq_HyEA1Bs4zb65ObWGDphZh0IvZD_6-lLnyXY5DrKj7_G4fWYE1e1FR__pzQiqNbHR7Go5WxegXdvVVW9ygieDy1kLprqQpbepOfHi1gSfL-DVC8JEKFlk4cwDmiVd4rcsMgfj0_VieWHY0TgKu4SX2XCvNs8RjgohdRu1L43eqHeuL3rAAEZbtOFK29IYRwr3z0owWjQU31wolM5NQJQR0fH8wFqrMFgqQIHyLZKNTACHoolbRSa92cKVDfcsepLFvws2OocmrWV7Of4V0tTTzTtHDt3XFvwGB7DTIovqCQMJMwq1EkFCyhOJFiY-sNExbdaHYhzmuimTI_v_HfqNZ-qB0T_DFBwYvU1izxyGHnKhEOzXVXG8Jv9WKx0cuwf0q4UOhvWjfmq0d7AwRCP2dsu_oxGTqwu_c5QMJ-D8fQF/s1600/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="465" data-original-width="624" height="476" src="https://1.bp.blogspot.com/-Kx9T5QmiCgk/Xpw-9kz2j0I/AAAAAAAAgB4/5l-L_VixQY8D4hbEcBq1UoqJqshT3r42gCEwYBhgLKs4DAL1OcqyM2pbvxTuR7S68k_RiZd8rK9TvgJ5ehMyVSKnMw8LvoEmITcsv_kzKCoRE16kHDDKYVOaa-iYGO9yzIkUw1ozVW_NCiRMzSLhwBNRTtM3K_JX7HQe9HCthB7FnFzUg-KD1MP6NKUci3iZw_ANlqRuhAZQl5GmDiekL2-1ieLjyy6yrq9zF2uusHX2mvnPq_HyEA1Bs4zb65ObWGDphZh0IvZD_6-lLnyXY5DrKj7_G4fWYE1e1FR__pzQiqNbHR7Go5WxegXdvVVW9ygieDy1kLprqQpbepOfHi1gSfL-DVC8JEKFlk4cwDmiVd4rcsMgfj0_VieWHY0TgKu4SX2XCvNs8RjgohdRu1L43eqHeuL3rAAEZbtOFK29IYRwr3z0owWjQU31wolM5NQJQR0fH8wFqrMFgqQIHyLZKNTACHoolbRSa92cKVDfcsepLFvws2OocmrWV7Of4V0tTTzTtHDt3XFvwGB7DTIovqCQMJMwq1EkFCyhOJFiY-sNExbdaHYhzmuimTI_v_HfqNZ-qB0T_DFBwYvU1izxyGHnKhEOzXVXG8Jv9WKx0cuwf0q4UOhvWjfmq0d7AwRCP2dsu_oxGTqwu_c5QMJ-D8fQF/s640/image002.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l3 level1 lfo2; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes;"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="mso-no-proof: yes;">Click Create
Button on the next page<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_6" o:spid="_x0000_i1032" type="#_x0000_t75" style='width:468pt;
height:327.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-6ox0wznsGxs/Xpw-9tguJYI/AAAAAAAAgBo/uecwQCUsEVsBZqStRhXL1unMnQHKV8S0gCEwYBhgLKs4DAL1Ocqz4CWeMY_AFFSy4_EoZBm7J27f2BKaO1cn2PjHzo2LcKi3vkjikrnUKquqNkoJJH6jXYFqWoDYERphO5FZPm3coIpHm1sA63Gakr82tifGJwJdBk4Zn6elCdTZtySuFij6QI3FficlAubxgKubhEdcf2tmW_OqFvIoCf_PJ3gqQxZC5zBhyMvqkmTT7907utRPPl5kQMPRqnsnzBYJ6n8arcwV5QSdzUenjaSiTzEnXf3PFWOtd-_qrEUACUuUGTYyQQGdgdDAKqkYLuvxiZOKt3CxJHCX7rdz6auBZnTKAvo5fxENc5_uMzxwxAY0gYT2xWmEozVkdoLFfEZ3zUEfd9828TQgV7M-Fj3vu-eeluVRUbeFGapjpfHMXpYeVLsP6ciikcn_KSi6ZANSJh2oSzFb_w4wilSUDhiSGRRA-DHkyUWd5co6kcCR1IjN_g6vof2OY7hJD7BCvUwYGb9R0mdMgSGZl1hVGNa1hNXx5EduAPpCuc21lqUFB3X232z45ECug0z2vfDd_pM6Vlk9RLs-KmMVvmvGi4lufMYVAbC9hQhPJghmwHUr0ZUeghzA3Sw6DHbydJMd80ArhTYLNXAexWRof7pCwMLSD8fQF/s1600/image003.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="456" data-original-width="651" height="448" src="https://1.bp.blogspot.com/-6ox0wznsGxs/Xpw-9tguJYI/AAAAAAAAgBo/uecwQCUsEVsBZqStRhXL1unMnQHKV8S0gCEwYBhgLKs4DAL1Ocqz4CWeMY_AFFSy4_EoZBm7J27f2BKaO1cn2PjHzo2LcKi3vkjikrnUKquqNkoJJH6jXYFqWoDYERphO5FZPm3coIpHm1sA63Gakr82tifGJwJdBk4Zn6elCdTZtySuFij6QI3FficlAubxgKubhEdcf2tmW_OqFvIoCf_PJ3gqQxZC5zBhyMvqkmTT7907utRPPl5kQMPRqnsnzBYJ6n8arcwV5QSdzUenjaSiTzEnXf3PFWOtd-_qrEUACUuUGTYyQQGdgdDAKqkYLuvxiZOKt3CxJHCX7rdz6auBZnTKAvo5fxENc5_uMzxwxAY0gYT2xWmEozVkdoLFfEZ3zUEfd9828TQgV7M-Fj3vu-eeluVRUbeFGapjpfHMXpYeVLsP6ciikcn_KSi6ZANSJh2oSzFb_w4wilSUDhiSGRRA-DHkyUWd5co6kcCR1IjN_g6vof2OY7hJD7BCvUwYGb9R0mdMgSGZl1hVGNa1hNXx5EduAPpCuc21lqUFB3X232z45ECug0z2vfDd_pM6Vlk9RLs-KmMVvmvGi4lufMYVAbC9hQhPJghmwHUr0ZUeghzA3Sw6DHbydJMd80ArhTYLNXAexWRof7pCwMLSD8fQF/s640/image003.png" width="640" /></a></div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l3 level1 lfo2; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">4.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Provide the necessary details<o:p></o:p></div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_7" o:spid="_x0000_i1031" type="#_x0000_t75" style='width:468pt;
height:231.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-O7ePSTEV2QQ/Xpw--b87RdI/AAAAAAAAgBw/3bJSsb801Rczt_WXAO0coDrW1gUtDQQcwCEwYBhgLKs4DAL1OcqxOSKxZqdbHlwsj_JPIclSITmh9W53IyzAmGNF8N-aCUawy6XEsWwwVltXQjje558YoRjgE0M057uqVKn6BBbRV_eXt3aZ4uOM1yaM5f2O9alTzxK2f20Celp0OcqC2eXnbHDiXcDiakNJDJa5oWqY8XCsNGYHFY_qLtsYsUa4n288K_7DUzhmO-0jE8pQO3uPX9umG8YI77xQlinrHWtQ21YbwqLcbGudY15pEigP8HOmLvXlTtkPJbyRgDEdvAMbDtstNqe2AjmTcfUuFlqX7b6RrBv8JU5Yauo35cJAIMFUbCMCK5gzyGWgweyWykhS0-uw2msTuG73wwmRPQsQE1tGDgPAcEygRQwL2pCnfigwPGnYlXzF8-5HMan5WPDw0Lo5pmBSF_mIHVWPgB6QxjkiSHQ10cwps6Q0ulwNIgIpjj7ZDJ30yrlgT3Optf-3eKOXdL4-C-HSiUkKJKxQgeHdrCLzV72rD7HKrJE70goL1uazY0_-rYRL60qwXGis7Jzds-nrkhubcrs8KM18UwOuou_S7JCKmGRwinLMF7gOtt0WyiMRUIHQot0zSZE5DcTSlIFNsCqF8_FOezjgYlDoY7OiDTdzvMM-D8fQF/s1600/image004.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="366" data-original-width="737" height="316" src="https://1.bp.blogspot.com/-O7ePSTEV2QQ/Xpw--b87RdI/AAAAAAAAgBw/3bJSsb801Rczt_WXAO0coDrW1gUtDQQcwCEwYBhgLKs4DAL1OcqxOSKxZqdbHlwsj_JPIclSITmh9W53IyzAmGNF8N-aCUawy6XEsWwwVltXQjje558YoRjgE0M057uqVKn6BBbRV_eXt3aZ4uOM1yaM5f2O9alTzxK2f20Celp0OcqC2eXnbHDiXcDiakNJDJa5oWqY8XCsNGYHFY_qLtsYsUa4n288K_7DUzhmO-0jE8pQO3uPX9umG8YI77xQlinrHWtQ21YbwqLcbGudY15pEigP8HOmLvXlTtkPJbyRgDEdvAMbDtstNqe2AjmTcfUuFlqX7b6RrBv8JU5Yauo35cJAIMFUbCMCK5gzyGWgweyWykhS0-uw2msTuG73wwmRPQsQE1tGDgPAcEygRQwL2pCnfigwPGnYlXzF8-5HMan5WPDw0Lo5pmBSF_mIHVWPgB6QxjkiSHQ10cwps6Q0ulwNIgIpjj7ZDJ30yrlgT3Optf-3eKOXdL4-C-HSiUkKJKxQgeHdrCLzV72rD7HKrJE70goL1uazY0_-rYRL60qwXGis7Jzds-nrkhubcrs8KM18UwOuou_S7JCKmGRwinLMF7gOtt0WyiMRUIHQot0zSZE5DcTSlIFNsCqF8_FOezjgYlDoY7OiDTdzvMM-D8fQF/s640/image004.png" width="640" /></a></div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l3 level1 lfo2; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Active Directory is created<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_18" o:spid="_x0000_i1030" type="#_x0000_t75" style='width:468pt;
height:251.25pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image006.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-KUmoqX44198/Xpw--su0e4I/AAAAAAAAgB8/JD2fofVt6Y8FvjL21j-XFsLyavmX5l71ACEwYBhgLKs4DAL1OcqybQZtXc_RSNqgQrVZeLApNZCIHRmiwuF_fbEotHM1TCGaR3mOsBVdLXNH6kkL7AnXWDoOENYlvDUPma5AngzCwsGl_qeyRZFo4ZKFGBuiAMP8H3VOEd8duo-m84-h5kIgHNpDQQJ59nu5PgdBjCLCv5xPIoSOGojR6HJDHVDgCu1Udsa6Lxx3W-XP7v_Ju42oM3EpKeWVErgppMJ1C8l0R-IsVEjpeb98ByHE7K4NeZhA_sqKPtE-9pfbQRy25cPvitsG2W1MwnLWsaUT5_4cHmXhAi1Z0_3fjUcfBjpqq55znBbnevhmhzDGsYh07mhxMNULanpM59HIN-Pu_CmHjgpFDFp157vmS9K0IpKKoInEN7uNaf0DAkWdXAMLKwLrpWgdpZcFClK9c1UgsMzIzS_cHeeWFXOF29z7NDGK-MZgPHvPOWqBgdcx_j0mp76d9DMYyo2e9P8iFZ7JcnAHA5YZGcTdgicbbZwmhr-2cooyYsZ0oCbgMQpJpScZSBut31JAdYKfzpxqCBLJrQbdOQi3Z-4Jx_6Z8zCvqdss4gUi5mujTWEzzFkUnZjNpiHDKmlgfq3JZNLkH5ReIzKs3iqdCh0jiBIlHMPOD8fQF/s1600/image006.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="335" data-original-width="624" height="340" src="https://1.bp.blogspot.com/-KUmoqX44198/Xpw--su0e4I/AAAAAAAAgB8/JD2fofVt6Y8FvjL21j-XFsLyavmX5l71ACEwYBhgLKs4DAL1OcqybQZtXc_RSNqgQrVZeLApNZCIHRmiwuF_fbEotHM1TCGaR3mOsBVdLXNH6kkL7AnXWDoOENYlvDUPma5AngzCwsGl_qeyRZFo4ZKFGBuiAMP8H3VOEd8duo-m84-h5kIgHNpDQQJ59nu5PgdBjCLCv5xPIoSOGojR6HJDHVDgCu1Udsa6Lxx3W-XP7v_Ju42oM3EpKeWVErgppMJ1C8l0R-IsVEjpeb98ByHE7K4NeZhA_sqKPtE-9pfbQRy25cPvitsG2W1MwnLWsaUT5_4cHmXhAi1Z0_3fjUcfBjpqq55znBbnevhmhzDGsYh07mhxMNULanpM59HIN-Pu_CmHjgpFDFp157vmS9K0IpKKoInEN7uNaf0DAkWdXAMLKwLrpWgdpZcFClK9c1UgsMzIzS_cHeeWFXOF29z7NDGK-MZgPHvPOWqBgdcx_j0mp76d9DMYyo2e9P8iFZ7JcnAHA5YZGcTdgicbbZwmhr-2cooyYsZ0oCbgMQpJpScZSBut31JAdYKfzpxqCBLJrQbdOQi3Z-4Jx_6Z8zCvqdss4gUi5mujTWEzzFkUnZjNpiHDKmlgfq3JZNLkH5ReIzKs3iqdCh0jiBIlHMPOD8fQF/s640/image006.png" width="640" /></a></div>
<h1>
Deleting Azure Active Directory<o:p></o:p></h1>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l2 level1 lfo4; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Go to the Active Directory pane<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_1" o:spid="_x0000_i1029" type="#_x0000_t75" style='width:468pt;
height:249.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image007.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Gy-nzBoWhr4/Xpw--xOSznI/AAAAAAAAgBw/GX_xHL2L4IIXYPtc9HHXZgA6LCg_N9yLgCEwYBhgLKs4DAL1OcqwIQuj0kpk_of2KLmG-FlEbMZcUullB87xHbbXKjgdhJvWDzbCzIwnWdOa0np6IgPs2-yhFi1PmQj0JfHNtW6nWIbNl4f8GjQNfwnAcbgl10L9MsZFZ-mJVIlXjmtrlC50KjR-ekI1P2FoLB9IFTUA9siHcQOctqh75v8vF3Y7UKZFCI-jjDW3UrLl_NdPCR6dObwt826Q2QoQq-45fIPaUkESBpw6KT0KHE7PT6QjlpnwC-reM9apo64x2r1Qy39aBX0tslEHmPTsgJPJn3j1T5v42a-2MngltAJunMTp-LEeXXgXyHVsqiSvXHYvzHx7F9Uu9dLGHZHad5C0_NcHhM3H59Tq2LOJ9pjhO9IWl7jssyR6ayY0Mn2OJDExAUOaJD_p7xw_jN5dZZaTLAk-fRYXYNHv6SmnmNDMruFwYPtSsIXu8U0Yx2NyfwI-xrgXInc08yr-G2Xiq0aJub2gzofLm4pPbEdTXbcabiB6Hq0ZUg5MGrtoI1EFle__h_RvX-ew4YuVtEIFFkjV2l41uEM7KP2RX8Dc5w4VWkVve5s9fYyorMqvyuJTpwVURwCK22RqYS4fz7xmVyA7cNTULXAl3Znxga_kQMI-E8fQF/s1600/image007.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1366" height="340" src="https://1.bp.blogspot.com/-Gy-nzBoWhr4/Xpw--xOSznI/AAAAAAAAgBw/GX_xHL2L4IIXYPtc9HHXZgA6LCg_N9yLgCEwYBhgLKs4DAL1OcqwIQuj0kpk_of2KLmG-FlEbMZcUullB87xHbbXKjgdhJvWDzbCzIwnWdOa0np6IgPs2-yhFi1PmQj0JfHNtW6nWIbNl4f8GjQNfwnAcbgl10L9MsZFZ-mJVIlXjmtrlC50KjR-ekI1P2FoLB9IFTUA9siHcQOctqh75v8vF3Y7UKZFCI-jjDW3UrLl_NdPCR6dObwt826Q2QoQq-45fIPaUkESBpw6KT0KHE7PT6QjlpnwC-reM9apo64x2r1Qy39aBX0tslEHmPTsgJPJn3j1T5v42a-2MngltAJunMTp-LEeXXgXyHVsqiSvXHYvzHx7F9Uu9dLGHZHad5C0_NcHhM3H59Tq2LOJ9pjhO9IWl7jssyR6ayY0Mn2OJDExAUOaJD_p7xw_jN5dZZaTLAk-fRYXYNHv6SmnmNDMruFwYPtSsIXu8U0Yx2NyfwI-xrgXInc08yr-G2Xiq0aJub2gzofLm4pPbEdTXbcabiB6Hq0ZUg5MGrtoI1EFle__h_RvX-ew4YuVtEIFFkjV2l41uEM7KP2RX8Dc5w4VWkVve5s9fYyorMqvyuJTpwVURwCK22RqYS4fz7xmVyA7cNTULXAl3Znxga_kQMI-E8fQF/s640/image007.png" width="640" /></a></div>
<br />
<br /></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l2 level1 lfo4; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Choose Delete directory option<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_9" o:spid="_x0000_i1028" type="#_x0000_t75" style='width:468pt;
height:249.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image009.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-DoMKfY_qCeU/Xpw-_HjsGEI/AAAAAAAAgB4/JQNeGp6GhnIBB8Ou81M-ast24JKzLg4YACEwYBhgLKs4DAL1OcqzGUWjYp81bHCWw9uoGMbRwp9_pG41fny9QbFJMrmQLNxlUm_tVTKKveM5PisZUm40t5Vb_GVcHGFGnFsRnMaQEEGqRWZp9qquWbhIElTxkYF3xWUR3aRlObk3oDyDyFUxvbEve8tpaE_-lygQma5rOzl406bkajj4cPMb4-UITK5tqX_9MFbUfmRnbsJRw4Hi1hHVmomgAUU3yKLLQmKOkRUqw_BZ4QMxJoEb8OFs7PD-YEynNBlpvIQkGSjkO2Id2O8N4oXfhpcFcpUjOaf7ggjV7Tu5aMZNjT2fRuuB32nJx8oz0hcyHvXldBJbFuBGui2NKHEcokLZU73N173beOB_CmqyYHLkU6EnGL9ZVvWSvKVvor8JYOIuDP1_5SysoReYJZpL9Vi2ShFkd5pG3f9X-usz4bdatir2BA8iMTyM9MyGqbTj5NElAIUOM0E1NKNlABn3Ykg_6xxAYsTX1wBslYbc14ZMmgzie-jA_meDKlGOhLay_sQliz4nlg_YiVr6GAY4MHQodrUFx_IuII8AKXd2y3QndV5v0F9X6vXP2MIzVbN3lnt3mLTfiAW2rSRXNVGZi7ofwhFZGiNOHm59byX34-td_MNqF8fQF/s1600/image009.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="333" data-original-width="624" height="340" src="https://1.bp.blogspot.com/-DoMKfY_qCeU/Xpw-_HjsGEI/AAAAAAAAgB4/JQNeGp6GhnIBB8Ou81M-ast24JKzLg4YACEwYBhgLKs4DAL1OcqzGUWjYp81bHCWw9uoGMbRwp9_pG41fny9QbFJMrmQLNxlUm_tVTKKveM5PisZUm40t5Vb_GVcHGFGnFsRnMaQEEGqRWZp9qquWbhIElTxkYF3xWUR3aRlObk3oDyDyFUxvbEve8tpaE_-lygQma5rOzl406bkajj4cPMb4-UITK5tqX_9MFbUfmRnbsJRw4Hi1hHVmomgAUU3yKLLQmKOkRUqw_BZ4QMxJoEb8OFs7PD-YEynNBlpvIQkGSjkO2Id2O8N4oXfhpcFcpUjOaf7ggjV7Tu5aMZNjT2fRuuB32nJx8oz0hcyHvXldBJbFuBGui2NKHEcokLZU73N173beOB_CmqyYHLkU6EnGL9ZVvWSvKVvor8JYOIuDP1_5SysoReYJZpL9Vi2ShFkd5pG3f9X-usz4bdatir2BA8iMTyM9MyGqbTj5NElAIUOM0E1NKNlABn3Ykg_6xxAYsTX1wBslYbc14ZMmgzie-jA_meDKlGOhLay_sQliz4nlg_YiVr6GAY4MHQodrUFx_IuII8AKXd2y3QndV5v0F9X6vXP2MIzVbN3lnt3mLTfiAW2rSRXNVGZi7ofwhFZGiNOHm59byX34-td_MNqF8fQF/s640/image009.png" width="640" /></a></div>
<br />
<br /></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l2 level1 lfo4; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Verify all the delete rules are passed. If not
go to the corresponding required action.<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_10" o:spid="_x0000_i1027" type="#_x0000_t75" style='width:468pt;
height:249.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image010.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-wtN-YV2FKLQ/Xpw-_nwQtEI/AAAAAAAAgBw/JXd4T-ZK5PYuv_gkVhOcJLSAtgYL9eZUwCEwYBhgLKs4DAL1OcqwIyeJnk5O5XyxVt2xBttHp2ivaRkKmol4bV0nKtutHCdysRJ_WI1XmePtqKiDatnlybUekD_xwBWqchWdHLT7w_oyjDyPjmiZifdKDzSo8hsi5TH9UVlAzFy5KzFFtN-0MV4E1qZNvZMFdpop9DMsVYMjAMfoZQWqmKfoT8a2YNSkWefspDZM1kkKR9eeqOF22zwab6ghZnz1zWyp_W4qnlnaWdj1VM0mioH72YIrCc5K0w1VpG_iwR2RFN1455WDdADzks48p-JBpfXRyoueQTsf4Rkwtvi6anoNFm0zdtoGKgVt03wtQb-9QfwRxVyR1A6DfGKmYGOZR3IdjTwQii6ZoC_JKa_iWlnnRRjo1QYtcoNbXgKoJF1tsy3jLgqoKyi-v3Bx1xY8ycuyBbc2QVLqfNB_IYo9aZjotnAA_qjm18LIhlnc1IJZn9FrjeoTolm4BdsAanz_ny9YjY8rm5dKv2-Pd-L1mwoJ0NcPhUclyAcAvWwIG1JNLOnVD7LZQgLZhjzH4uywrQO8LyWg_eor-sPRqUUuTU-WVhJZqfN4dX2E03ht5vbixNzuwg_7X9zGol6ROrkW1ZS6MfnVN4NKoNMLqPo8sMPCF8fQF/s1600/image010.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1366" height="340" src="https://1.bp.blogspot.com/-wtN-YV2FKLQ/Xpw-_nwQtEI/AAAAAAAAgBw/JXd4T-ZK5PYuv_gkVhOcJLSAtgYL9eZUwCEwYBhgLKs4DAL1OcqwIyeJnk5O5XyxVt2xBttHp2ivaRkKmol4bV0nKtutHCdysRJ_WI1XmePtqKiDatnlybUekD_xwBWqchWdHLT7w_oyjDyPjmiZifdKDzSo8hsi5TH9UVlAzFy5KzFFtN-0MV4E1qZNvZMFdpop9DMsVYMjAMfoZQWqmKfoT8a2YNSkWefspDZM1kkKR9eeqOF22zwab6ghZnz1zWyp_W4qnlnaWdj1VM0mioH72YIrCc5K0w1VpG_iwR2RFN1455WDdADzks48p-JBpfXRyoueQTsf4Rkwtvi6anoNFm0zdtoGKgVt03wtQb-9QfwRxVyR1A6DfGKmYGOZR3IdjTwQii6ZoC_JKa_iWlnnRRjo1QYtcoNbXgKoJF1tsy3jLgqoKyi-v3Bx1xY8ycuyBbc2QVLqfNB_IYo9aZjotnAA_qjm18LIhlnc1IJZn9FrjeoTolm4BdsAanz_ny9YjY8rm5dKv2-Pd-L1mwoJ0NcPhUclyAcAvWwIG1JNLOnVD7LZQgLZhjzH4uywrQO8LyWg_eor-sPRqUUuTU-WVhJZqfN4dX2E03ht5vbixNzuwg_7X9zGol6ROrkW1ZS6MfnVN4NKoNMLqPo8sMPCF8fQF/s640/image010.png" width="640" /></a></div>
<br />
<br /></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l2 level1 lfo4; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">4.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]-->Give necessary permissions to delete the active
directory<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_14" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:467.25pt;
height:249pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image012.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-NHUv9frpIFI/Xpw-__fPP0I/AAAAAAAAgBw/KNWEVx0mf9YWCmyTtq7lraymeqHjxcIJwCEwYBhgLKs4DAL1OcqzTlGJDLKOTmIJxPeFNnIR2ybgCi0GYDRiYylmAbxEPKF_t3HdHed8xpa1TJTgWEL2a6MCkl9zeDgC2vjfi51fkOjXp9uv-bWB8GXgh5RooiLGc-Xv8isdY5pHVMRsF72oAZHqTn5UHRTsof-bbXqzU_1Qlu_xorHGPA1TdKaNMdS7tj9zmhwrd7BbGRs5gljtZqmoACY8uu05WMAzITJnF9yfiGMq_0yTnPJ6cT_h25hCh0ilazHYcj7Qh-CuD7Y4K1g-2AACwNK6OVbfAUt24YCLwKZwBAr2Nx9QBsCMpcR9hnQlDUBpO09RKw4cEsfi8RL2lav_IHiBOx8iNlF2ji0i_EL7oAOH5M1iBZfnJBv2xa46_eIAkJsURmGaRYtYyjfwoLGo1u36DRbGIbGDikML8Bb44RxmKaGw17OWN8ylnZirz2UOLYpfUdqTobWeB1n5GGpd8eyzzvXYW0Bdjd99TyzjgDcUWKP0jyt0aEYiRL5dqiIiokuoWXswYPa1wO4sMsuL2mhPaVPOP-qScvF4qbebjZH44k0GErijghjggpG3XldhMqdAtn-LiHm-reNS3tQoTsiKckDJc-pOCS7xQkxaLl91DMI-G8fQF/s1600/image012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1366" height="340" src="https://1.bp.blogspot.com/-NHUv9frpIFI/Xpw-__fPP0I/AAAAAAAAgBw/KNWEVx0mf9YWCmyTtq7lraymeqHjxcIJwCEwYBhgLKs4DAL1OcqzTlGJDLKOTmIJxPeFNnIR2ybgCi0GYDRiYylmAbxEPKF_t3HdHed8xpa1TJTgWEL2a6MCkl9zeDgC2vjfi51fkOjXp9uv-bWB8GXgh5RooiLGc-Xv8isdY5pHVMRsF72oAZHqTn5UHRTsof-bbXqzU_1Qlu_xorHGPA1TdKaNMdS7tj9zmhwrd7BbGRs5gljtZqmoACY8uu05WMAzITJnF9yfiGMq_0yTnPJ6cT_h25hCh0ilazHYcj7Qh-CuD7Y4K1g-2AACwNK6OVbfAUt24YCLwKZwBAr2Nx9QBsCMpcR9hnQlDUBpO09RKw4cEsfi8RL2lav_IHiBOx8iNlF2ji0i_EL7oAOH5M1iBZfnJBv2xa46_eIAkJsURmGaRYtYyjfwoLGo1u36DRbGIbGDikML8Bb44RxmKaGw17OWN8ylnZirz2UOLYpfUdqTobWeB1n5GGpd8eyzzvXYW0Bdjd99TyzjgDcUWKP0jyt0aEYiRL5dqiIiokuoWXswYPa1wO4sMsuL2mhPaVPOP-qScvF4qbebjZH44k0GErijghjggpG3XldhMqdAtn-LiHm-reNS3tQoTsiKckDJc-pOCS7xQkxaLl91DMI-G8fQF/s640/image012.png" width="640" /></a></div>
<br />
<br /></div>
<div class="MsoListParagraph" style="margin-left: 18.0pt; mso-add-space: auto; mso-list: l2 level1 lfo4; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><o:p></o:p><span style="font-family: "calibri" , sans-serif; font-size: 11pt;">Finally
click Delete to Delete Active Directory</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-kwZKCir1YoI/Xpw_AW_D4RI/AAAAAAAAgB8/wNCZ-PhxGbkBwFjAd-9dBrO6Xc1yZDTeACEwYBhgLKs4DAL1OcqxM0skgC_Yw9jVv1obXYxVgT6lrwbcvljbBQTBN-tYi6Q34l8SUau5fGApMBCXFZ76lVgXTgC8yPE-GULgGpT_97WjBoWyMotmCF6ZlW09mIkbuFdUfm1y1JkokXRmaDvJMNxQghIv0DDVoJHiEcyd0brk7UWbobEUBO3FN1yFaxr7Q64cY3iZjwQHr9UQOnPOlUxsjmsOuHgCXTh3jSy70Rbq9S_3JNa1xmpQei-LrgqjcWh110DPuOqZAmAYLp8_Dm3Z1h5qBNCcX2VqeRgK3m6DFtN2LOFszQuCTH4zQ_khlEFUznN0HhIA47vqAEOw3ABxv74hh-Eqmti_089a6hxU5TvS-qRpd6mDPJze6doxFUD3JVQJ67VUokRzow55wCp9SUQQFBxsNvFoxUDDm8PFlPkqJYIFf02lxCOIqWiei_CPkz-FJVeYUo2EKiZOZjusFIwOr4EoFFwvxp9L0fG1JGHMj36CfZxO3Xa_EpWZuwa37s2FBfJFERh2RAA1AvhEJa3jX-htmRCvJJBZd8YwlkTbAWEq9sa1GC7CIr0L6DVLAgIzrHrZXmEab5HZ3oAjCvH9n5U4KvMDlAx5wKQxTAC0pEXlgMK6G8fQF/s1600/image014.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1366" height="340" src="https://1.bp.blogspot.com/-kwZKCir1YoI/Xpw_AW_D4RI/AAAAAAAAgB8/wNCZ-PhxGbkBwFjAd-9dBrO6Xc1yZDTeACEwYBhgLKs4DAL1OcqxM0skgC_Yw9jVv1obXYxVgT6lrwbcvljbBQTBN-tYi6Q34l8SUau5fGApMBCXFZ76lVgXTgC8yPE-GULgGpT_97WjBoWyMotmCF6ZlW09mIkbuFdUfm1y1JkokXRmaDvJMNxQghIv0DDVoJHiEcyd0brk7UWbobEUBO3FN1yFaxr7Q64cY3iZjwQHr9UQOnPOlUxsjmsOuHgCXTh3jSy70Rbq9S_3JNa1xmpQei-LrgqjcWh110DPuOqZAmAYLp8_Dm3Z1h5qBNCcX2VqeRgK3m6DFtN2LOFszQuCTH4zQ_khlEFUznN0HhIA47vqAEOw3ABxv74hh-Eqmti_089a6hxU5TvS-qRpd6mDPJze6doxFUD3JVQJ67VUokRzow55wCp9SUQQFBxsNvFoxUDDm8PFlPkqJYIFf02lxCOIqWiei_CPkz-FJVeYUo2EKiZOZjusFIwOr4EoFFwvxp9L0fG1JGHMj36CfZxO3Xa_EpWZuwa37s2FBfJFERh2RAA1AvhEJa3jX-htmRCvJJBZd8YwlkTbAWEq9sa1GC7CIr0L6DVLAgIzrHrZXmEab5HZ3oAjCvH9n5U4KvMDlAx5wKQxTAC0pEXlgMK6G8fQF/s640/image014.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape
id="Picture_x0020_15" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:468pt;
height:249.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image014.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<h2>
References:<o:p></o:p></h2>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><a href="https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-whatis">https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-whatis</a><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<br />Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-76599398576432812722020-03-12T06:40:00.000+05:302020-03-29T12:29:47.968+05:30AZ-304: Microsoft Azure Architect Design Objective Domain<br />
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Objective
Domain means set of skills, knowledge and abilities that are measured by the
certification program.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Below is
the objective domain for AZ-304:</span></div>
<div class="MsoNormal">
</div>
<ol>
<li><span style="text-indent: -18pt;"><a href="https://www.blogger.com/blogger.g?blogID=9014730285386259823#monitoring">Design
Monitoring (10-15%)</a></span></li>
<li><span style="text-indent: -18pt;"><a href="https://www.blogger.com/blogger.g?blogID=9014730285386259823#identity">Design Identity and Security
(25-30%)</a></span></li>
<li><span style="text-indent: -18pt;"><a href="https://www.blogger.com/blogger.g?blogID=9014730285386259823#storage">Design Data Storage (15-20%)</a></span></li>
<li><span style="text-indent: -18pt;"><a href="https://www.blogger.com/blogger.g?blogID=9014730285386259823#businesscontinuity">Design Business Continuity (10-15%)</a></span></li>
<li><span style="text-indent: -18pt;"><a href="https://www.blogger.com/blogger.g?blogID=9014730285386259823#infrastructure">Design Infrastructure (25-30%)</a></span></li>
</ol>
<br />
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Here are
the exam skills measured and candidate profile from the Microsoft certification
site<o:p></o:p></span></div>
<h2>
Audience Profile<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><o:p></o:p></span></h2>
<div class="MsoNormal">
Candidates for this exam are Azure Solution Architects who
advise stakeholders and translate business requirements into secure, scalable,
and reliable solutions. <o:p></o:p></div>
<div class="MsoNormal">
Candidates should have advanced experience and knowledge of
IT operations, including networking, virtualization, identity, security,
business continuity, disaster recovery, data platform, budgeting, and
governance. This role requires managing how decisions in each area affects an
overall solution. <o:p></o:p></div>
<div class="MsoNormal">
Candidates must have expert-level skills in Azure
administration and have experience with Azure development processes and DevOps
processes.<o:p></o:p></div>
<h2>
Skills Measured<o:p></o:p></h2>
<h3 style="margin-left: 18.0pt; mso-list: l3 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: "Calibri Light"; mso-bidi-theme-font: major-latin; mso-fareast-font-family: "Calibri Light"; mso-fareast-theme-font: major-latin;"><span style="mso-list: Ignore;">1.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><a href="https://www.blogger.com/null" name="monitoring">Design Monitoring (10-15%)</a><o:p></o:p></span></h3>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design for cost optimization<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for cost management and cost reporting<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
solutions to minimize costs<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design a solution for logging and
monitoring<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">determine
levels and storage locations for logs<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">plan
for integration with monitoring tools including Azure Monitor and Azure
Sentinel<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
appropriate monitoring tool(s) for a solution<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">choose
a mechanism for event routing and escalation<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a logging solution for compliance requirements<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">NOT:
resource-specific monitoring. This objective should ONLY cover the all-up holistic
monitoring strategy<o:p></o:p></span></div>
<h3 style="margin-left: 18.0pt; mso-list: l3 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: "Calibri Light"; mso-bidi-theme-font: major-latin; mso-fareast-font-family: "Calibri Light"; mso-fareast-theme-font: major-latin;"><span style="mso-list: Ignore;">2.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><a href="https://www.blogger.com/null" name="identity">Design Identity and Security
(25-30%)</a><o:p></o:p></span></h3>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design authentication<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for single-sign on<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for authentication<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for Conditional Access, including multi-factor authentication<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for network access authentication<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for a hybrid identity including Azure AD Connect and Azure AD
Connect Health<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for user selfservice<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
and implement a solution for B2B integration<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">NOT:
federation with ADFS<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design authorization<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">choose
an authorization approach<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a hierarchical structure that includes management groups, subscriptions and
resource groups<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
an access management solution including RBAC policies, access reviews, role
assignments, physical access, Privileged Identity Management (PIM), Azure AD
Identity Protection, Just In Time (JIT) access<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design governance<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a strategy for tagging<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for using Azure Policy<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for using Azure Blueprint<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.4.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design security for applications<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution that includes KeyVault <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l2 level2 lfo4; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">what
can be stored in KeyVault<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l2 level2 lfo4; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">KeyVault
operations<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l2 level2 lfo4; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">KeyVault
regions<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution that includes Azure AD Managed Identities<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for integrating applications into Azure AD</span></div>
<h3 style="margin-left: 18.0pt; mso-list: l3 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: "Calibri Light"; mso-bidi-theme-font: major-latin; mso-fareast-font-family: "Calibri Light"; mso-fareast-theme-font: major-latin;"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><a href="https://www.blogger.com/null" name="storage">Design Data Storage (15-20%)</a><o:p></o:p></span></h3>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design a solution for databases<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">select
an appropriate data platform based on requirements<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
database service tier sizing<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for database scalability<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for encrypting data at rest, data in transmission, and data in use<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">NOT:
data caching<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">NOT:
MariaDB, PostGreSQL, MySQL<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design data integration<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a data flow to meet business requirements<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for data integration, including Azure Data Factory, Azure Data
Bricks, Azure Data Lake, Azure Synapse Analytics<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Select an appropriate storage
account<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">choose
between storage tiers<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a storage access solution<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
storage management tools<o:p></o:p></span></div>
<h3 style="margin-left: 18.0pt; mso-list: l3 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: "Calibri Light"; mso-bidi-theme-font: major-latin; mso-fareast-font-family: "Calibri Light"; mso-fareast-theme-font: major-latin;"><span style="mso-list: Ignore;">4.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><a href="https://www.blogger.com/null" name="businesscontinuity">Design Business Continuity (10-15%)</a><o:p></o:p></span></h3>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">4.1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design a solution for backup and
recovery<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a recovery solution for Azure hybrid and on-premises workloads that meets
recovery objectives (RTO, RLO, RPO)<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">design
and Azure Site Recovery solution<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l4 level2 lfo5; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a site recovery replication policy<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l4 level2 lfo5; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for site recovery capacity<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l4 level2 lfo5; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for site failover and failback (planned/unplanned)<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l4 level2 lfo5; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for the site recovery network<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for recovery in different regions<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for Azure Backup management<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">design
a solution for data archiving and retention<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l1 level2 lfo6; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
storage types and methodology for data archiving<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l1 level2 lfo6; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">identify
business compliance requirements for data archiving<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l1 level2 lfo6; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">identify
requirements for data archiving<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l1 level2 lfo6; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">identify
SLA(s) for data archiving <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l1 level2 lfo6; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a data retention policy<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">4.2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design for high availability<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for application and workload redundancy, including compute,
database, and storage<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for autoscaling<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">identify
resources that require high availability<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">identify
storage types for high availability<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for georedundancy of workload<o:p></o:p></span></div>
<h3 style="margin-left: 18.0pt; mso-list: l3 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: "Calibri Light"; mso-bidi-theme-font: major-latin; mso-fareast-font-family: "Calibri Light"; mso-fareast-theme-font: major-latin;"><span style="mso-list: Ignore;">5.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><a href="https://www.blogger.com/null" name="infrastructure">Design Infrastructure (25-30%)</a><o:p></o:p></span></h3>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.1.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design a compute solution<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for compute provisioning<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">determine
appropriate compute technologies, including virtual machines, App Services,
Service Fabric, Azure Functions, Windows Virtual Desktop, and containers<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for containers<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">AKS
versus ACI and the configuration of each one<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for automating compute management<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">NOT:
monitoring, backups, recovery, availability, security, storage; VMWare<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.2.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design a network solution<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for network addressing and name resolution<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for network provisioning<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for network security<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">private
endpoints<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">firewalls<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">gateways<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">etc.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for network connectivity to the Internet, on-premises networks, and
other Azure virtual networks<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for automating network management<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for load balancing and traffic routing<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><!--[endif]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design an application architecture<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a microservices architecture including Event Grid, Event Hubs, Service Bus,
Storage Queues, Logic Apps, Azure Functions, and webhooks<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
an orchestration solution for deployment of applications including ARM
templates, Logic Apps, or Azure Functions<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">select
an automation method<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">choose
which resources or lifecycle steps will be automated<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">design
integration with other sources such as an ITSM solution<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for monitoring automation<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for API integration<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">design
an API gateway strategy<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">determine
policies for internal and external consumption of APIs<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a hosting structure for API management<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
when and how to use API Keys<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 39.6pt; mso-add-space: auto; mso-list: l3 level2 lfo1; text-indent: -21.6pt;">
<!--[if !supportLists]--><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.4.<span style="font: 7.0pt "Times New Roman";">
</span></span></span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Design migrations<o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">assess
and interpret on-premises servers, data, and applications for migration<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for migrating applications and VMs<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "symbol"; mso-ansi-language: EN-IN; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">recommend
a solution for migration of databases<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 75.6pt; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -21.6pt;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-family: "courier new"; mso-ansi-language: EN-IN; mso-fareast-font-family: "Courier New";"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span lang="EN-IN" style="mso-ansi-language: EN-IN;">determine
migration scope, including redundant, related, trivial, and outdated data<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<br />Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com3tag:blogger.com,1999:blog-9014730285386259823.post-45504340811347928382018-09-27T19:22:00.001+05:302018-09-27T19:22:48.225+05:30ASP.NET Core and Angular Ignore TimeZone – Part 1 of 2<br />
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Date and
Time is always hard, especially when it spans across time zones. Once your
application becomes global, the time zone related issues become inevitable.
This becomes harder with Single Page Application Technology, now we need to
sync date between the javascript running on browser and with that of server. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Have you
faced issue where you are losing a day or getting a day more than what user
entered in your Angular application? Chances are that your server is in one
time zone and your user is in a different time zone. Your user enters the date
or picks the date using a calendar control (example Expiration Date). Due to
time zone difference, the date may change when it reaches server. For example,
user in India picked date at 27-09-2018 at 9:00 AM, the server in California
receives this date as 26-09-2018 8:30 PM. If you are considering only date part
then your date will be one day less (26<sup>th</sup> instead of 27<sup>th</sup>)
due to this time zone conversion.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">Below are
the two solutions for this problem:</span></div>
<div class="MsoNormal">
</div>
<ol>
<li>Ignore time zone globally when
sending data between browser and server</li>
<li>A more elegant solution is to ignore
time zone only for specific date controls or properties</li>
</ol>
<br />
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">In this
blog, I will cover the first solution and in my next blog I will go over the
second solution.<o:p></o:p></span></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></b></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="mso-ansi-language: EN-IN;">Ignore time zone globally<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">In most
applications, we do not need to consider time. In these applications, ignoring
time zone is the best approach. As you know, Angular and ASP.NET by default
convert the date from one time zone to another time zone. This is true even if
you are sending just date.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">The best
way for this problem, is to remove time zones while exchanging data between
ASP.NET and Angular. Unfortunately, there is no out of box solution to remove
time zones. However, the solution is very easy. When the data is exchanged
between ASP.NET and Angular, the data is serialized to JSON and is transferred.
We can tap into this serialization process and can force date conversion to
ignore time zone.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">ASP.NET
Core by default uses Json.NET to serialize the data. In Json serialization
configuration, we can specify the date serialization to remove time zone. For
this, we need to pass the Date format as shown below:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">.AddJsonOptions(options =></span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">{</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"> options.SerializerSettings.DateTimeZoneHandling
= DateTimeZoneHandling.Local;</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">
options.SerializerSettings.DateFormatHandling =
DateFormatHandling.IsoDateFormat;</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;"> <span style="background: yellow; mso-highlight: yellow;">options.SerializerSettings.DateFormatString = </span></span><span style="background: yellow; color: #a31515; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">"yyyy-MM-ddTHH:mm:ss"</span><span style="background: yellow; color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">;</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt; line-height: 107%;">});</span><o:p></o:p></div>
</div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">In Angular
we also need to override the Json serialization. Angular internally uses
Json.stringy to serialize the object. Under hood, this json serializer uses
toISOString. We can override this and provide the same format we used in the
ASP.NET. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div><div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>Date.prototype.toISOString = </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">function</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">() {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">return</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getFullYear()
+ </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"-"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> + </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getMonth().toString().padStart(2, </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"0"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">) <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>+ </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"-"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> + </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getDate().toString().padStart(2,
</span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"0"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">) + </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"T"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>+ </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getHours().toString().padStart(2, </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">"0"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">) + </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">":"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>+ </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getMinutes().toString().padStart(2, 0) + </span><span style="color: #a31515; font-family: "consolas"; font-size: 9.5pt;">":"</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>+ </span><span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">this</span><span style="color: black; font-family: "consolas"; font-size: 9.5pt;">.getSeconds().toString().padStart(2, 0);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: black; font-family: "consolas"; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>};<o:p></o:p></span></div></div>
<div class="MsoNormal">
<span lang="EN-IN" style="mso-ansi-language: EN-IN;">By
providing DateFormats without time zone on both ASP.NET and Angular we can
ignore time zone. With this approach our application does not lose a day while
sending data to and fro.<o:p></o:p></span></div>
<br />Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com4tag:blogger.com,1999:blog-9014730285386259823.post-45196726713413048992017-12-10T06:38:00.000+05:302017-12-10T06:38:10.391+05:30Global CSS Styles in Angular<div class="MsoNormal">
<span lang="EN-IN">Angular recommends
component based styling as the component should encapsulate every UI
functionality. Here is a typical example using stylesheet for a component:<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">import</span><span style="font-family: Consolas; font-size: 9.5pt;"> { Component } </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">from</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"@angular/core"</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">@Component({<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> selector: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"top-bar"</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> templateUrl: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"./TopBarComponent.html"</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> styleUrls: [</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"./TopBarComponent.css"</span><span style="font-family: Consolas; font-size: 9.5pt;">]<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">})<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">export</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">TopBarComponent</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">In some
situations we may need to have styles that we want to apply to multiple
components or globally across the entire application. In this case we can
define a css file and use it in the index.html page. <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">link</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">rel</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="stylesheet"</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">href</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="~/styles.css"</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">With the
above approach we may lose the building and bundling provided by Angular and
have to extend or implement a separate webpack or gulp task. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">I recommend
creating a separate component which contains all the global styles and expose
these component’s style using encapsulation as shown below:<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">import</span><span style="font-family: Consolas; font-size: 9.5pt;"> { Component, ViewEncapsulation } </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">from</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"@angular/core"</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">@Component({<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> selector: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"app-styles"</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">""</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> styleUrls: [</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"./AppStyles.css"</span><span style="font-family: Consolas; font-size: 9.5pt;">],<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> encapsulation: ViewEncapsulation.None<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">})<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">export</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">AppStyles</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">ViewEncapsulation.None
exposes all the styles defined in AppStyles.css globally and these styles can
be across the application. As a final step we need to include this AppStyles
Component (which does not have any visible elments) inside our AppComponent<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">app-styles</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">app-styles</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-87627652867202656132017-11-24T05:34:00.000+05:302017-11-24T05:34:02.385+05:30ASP.NET MVC style layout and section in Angular<div class="MsoNormal">
<span lang="EN-IN">As you know
ASP.NET MVC provides a great feature for consistent look and feel with Layout
engine. This layout engine consists of two main components, RenderBody and
RenderSection which helps in defining hot areas in the page where we can
substitute content from the current/active page. Almost everyone who worked/working
in ASP.NET MVC have used this feature. In this blog I will go over how to
recreate the same feature in Angular.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN">RenderBody<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Similar to
ASP.NET MVC we need to fill the content of the View at this location in HTML.
In Angular this is similar to the router-outlet. So I will wrap the
router-outlet with our own component called render-body. Here is the code for
this:<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">import</span><span style="font-family: Consolas; font-size: 9.5pt;"> { Component } </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">from</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">'@angular/core'</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">@Component({<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> selector: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">'render-body'</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">'<router-outlet></router-outlet>'</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">})<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">export</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">RenderBodyComponent</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">RenderBody
is straight forward. Whenever there is a route transition, Angular routing
automatically inject the content of the view at this location. Here is how
RenderBody can be used in the layout page<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="MsoNormal"><div class="code">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">render-body</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">render-body</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">></span><span lang="EN-IN"><o:p></o:p></span></div></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN">RenderSection<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">In MVC
RenderSection allows a part of the layout page be replaced by the content
defined in the current page. RenderSection allows us to define multiple named
sections in the layout for which the content be defined in each page. It also
allows to define a default content if the page does not specify the content. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">I
implemented the similar functionality in my RenderSection component. In
addition I extended the RenderSection with an ability to hide from the content
page. I also added the capability to have nested levels of RenderSection.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Similar to
MVC, first you would define a named section and then in the content page
specify the target where you would like the content to be displayed. Here is
how you can use the RenderSection in the layout page with a default content
(showing a menu)<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="background: yellow; color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas; mso-highlight: yellow;">name</span><span style="background: yellow; color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas; mso-highlight: yellow;">="menu"</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">fxFlex</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="25"></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">b</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;">Menu</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">b</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/home"></span><span style="font-family: Consolas; font-size: 9.5pt;">Home</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/counter"></span><span style="font-family: Consolas; font-size: 9.5pt;">Counter</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/fetch-data"></span><span style="font-family: Consolas; font-size: 9.5pt;">Fetch Data</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">In the
content page this menu section can be replaced with page specific menu or
content.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="background: yellow; color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas; mso-highlight: yellow;">target</span><span style="background: yellow; color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas; mso-highlight: yellow;">="menu"</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> Custom Menu from content page<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Let’s delve
into the code on how to implement the RenderSection component in Angular.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">As we are
showing content dynamically when a user navigates from page to page, we have to
use ngTemplateOutlet. Angular transclusion (ng-content) is used for displaying
the content. Here is the template code for RenderSection component for dynamic
content:<o:p></o:p></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><ng-container
*ngTemplateOutlet="getTemplate()"></ng-container><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><ng-template
#sectionRef><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"> <ng-content></ng-content><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></ng-template>`</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">In the
above code I am getting the current page’s template using the getTemplate
function call and showing its content.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">For each
section I am capturing the following data (as defined in the SectionModel):<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">export</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">SectionModel</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> name: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> hidden: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">boolean</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> changeDetectorRef: ChangeDetectorRef;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: TemplateRef<</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">any</span><span style="font-family: Consolas; font-size: 9.5pt;">>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> currentTemplate: TemplateRef<</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">any</span><span style="font-family: Consolas; font-size: 9.5pt;">>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> targets: SectionTargetModel[];<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Here are
the details for each of the properties in the SectioModel</span></div>
<div class="MsoNormal">
</div>
<ul>
<li>name
– This holds the name of the section. This is used to display the content when
the target is equal to the name of the template</li>
<li>hidden
– This is the initial setting whether the section be hidden or not</li>
<li>changeDetectorRef
– This is used to force a change detection when we set the target’s content to
the section’s content. If a page has specified the content for a section (using
target attribute), this page’s content is set to the section defined with name
and the change detection is manually invoked for this section component</li>
<li>template
– This is the default content for the section. If no target is defined in the
content page, then this template is displayed as the section’s content</li>
<li>currentTemplate
– This the template of the content which is currently shown. The
currentTemplate is bound to the section template. This currentTemplate would
contain either the default template or the template defined in the current
page. A change detection is called whenever there is a change in this variable</li>
<li>targets
– This is the stack of all the contents defined for a section. As my design
support hierarchical replacement of the content, I am using stack. During the
page load (ngAfterContentInit) if the page has a render-section, then the
section’s template is pushed into this array. When this page is destroyed(ngOnDestroy),
then the page’s template is poped. The targets are of type SectionTargetModel
array whose definition is below:</li>
</ul>
<br />
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">export</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">class</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">SectionTargetModel</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
target: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
hidden: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">boolean</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
template: TemplateRef<</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">any</span><span style="font-family: Consolas; font-size: 9.5pt;">>;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Now let’s
delve into the code. Surprisingly the code is very simple. We need three functions,
push, pop and update. Here is important code for each of these functions.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<b><span lang="EN-IN">push<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">As the name
indicates it pushes the section defined either in the layout or in the page.
This is also needed to support the default section content or the nested
sections. During the page load (ngAfterContentInit), the section is pushed into
the array.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">public</span><span style="font-family: Consolas; font-size: 9.5pt;"> push(<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> name: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> target: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> hidden: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">boolean</span><span style="font-family: Consolas; font-size: 9.5pt;">,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: TemplateRef<</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">any</span><span style="font-family: Consolas; font-size: 9.5pt;">>,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> changeDetectorRef:
ChangeDetectorRef<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> ): </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">void</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (name !== undefined) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.sections[name] = <SectionModel>{<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> name: name,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> hidden: hidden,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> changeDetectorRef:
changeDetectorRef,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> targets:
[<SectionTargetModel>{<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> target: name,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> hidden: hidden,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: template<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }],<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: template,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> currentTemplate: template<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> };<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.update(section);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">else</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;">(target !==
undefined) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
section.targets.push(<SectionTargetModel>{<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> target: name,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> hidden: hidden,<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> template: template<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> });<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.update(section);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">As you see
above the code checks if the section with the name already exists or not, if
not exists creates and pushes the section. If it exists it just pushes the
section into the array. After pushing the section into the array, update is
called to refresh the section in the layout and show the relevant section content
from the page.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span lang="EN-IN"><br /></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-IN">pop<o:p></o:p></span></b></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-IN">Again as the name indicates, pop removes the
page’s section content from the array. During page destroyed(ngOnDestroy) the section is poped
from the array. It also changes the section content from the array.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--></span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><o:p></o:p></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">private</span><span style="font-family: Consolas; font-size: 9.5pt;"> popTemplate(name: </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">string</span><span style="font-family: Consolas; font-size: 9.5pt;">): </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">void</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">let</span><span style="font-family: Consolas; font-size: 9.5pt;"> section: SectionModel = </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.sections[name];<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> section.targets.pop();<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.update(section);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Similar to
push the upgrade function is called in pop to refresh the section and to show
the active content.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span lang="EN-IN"><br /></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-IN">update<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">This sets
the current template to a section and calls the change detection to refresh the
section. This always shows the last section content in the array. It also has
the logic to show or hide the section.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">private</span><span style="font-family: Consolas; font-size: 9.5pt;"> update(section: SectionModel) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">let</span><span style="font-family: Consolas; font-size: 9.5pt;"> targetSection = section.targets[section.targets.length - 1];<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> section.currentTemplate =
targetSection.template;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (targetSection.hidden) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
section.template.elementRef.nativeElement.parentElement.style.display = </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"none"</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (!targetSection.hidden) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
section.template.elementRef.nativeElement.parentElement.style.display = </span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">"block"</span><span style="font-family: Consolas; font-size: 9.5pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (!(section.changeDetectorRef </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">as</span><span style="font-family: Consolas; font-size: 9.5pt;"> ViewRef).destroyed) {<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">
section.changeDetectorRef.detectChanges();<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">With these
simple three functions, push, pop and update we can get the behaviour similar
to that of ASP.NET MVC sections. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Finally
here is the MVC type layout, which is a regular component in Angular.
AppComponent can also be used for this.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><br /></span></div>
<div class="code">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">div</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">fxLayout</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="row"></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">name</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="menu"</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">fxFlex</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="25"></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">b</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;">Menu</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">b</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/home"></span><span style="font-family: Consolas; font-size: 9.5pt;">Home</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/counter"></span><span style="font-family: Consolas; font-size: 9.5pt;">Counter</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">routerLink</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="/fetch-data"></span><span style="font-family: Consolas; font-size: 9.5pt;">Fetch Data</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">a</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">br</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">/></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-section</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">div</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">fxFlex</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-body</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">render-body</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">div</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;"></</span><span style="color: maroon; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">div</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%; mso-bidi-font-family: Consolas;">><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Finally I
created an Angular module to wrap the RenderBody, RenderSection and supporting
providers. You can review this code from my GitHub site<o:p></o:p></span></div>
<div class="MsoNormal">
<a href="https://github.com/Nootus/0xServices/tree/master/src/0xServices.Web/ClientApp/app/fabric/layoutRender"><span lang="EN-IN">https://github.com/Nootus/0xServices/tree/master/src/0xServices.Web/ClientApp/app/fabric/layoutRender</span></a><span lang="EN-IN"><o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<br /></div>
Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-70453851917051371492017-09-11T20:50:00.000+05:302020-03-10T19:38:18.927+05:30Ethereum Solidity Compiler<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-zCJa5fv2GvI/WZr3runDMxI/AAAAAAAAcOE/eXzF2rJ8Hi812kOT5C00fr1mD4jq3-k_wCPcBGAYYCw/s1600/Solidity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="220" data-original-width="142" src="https://2.bp.blogspot.com/-zCJa5fv2GvI/WZr3runDMxI/AAAAAAAAcOE/eXzF2rJ8Hi812kOT5C00fr1mD4jq3-k_wCPcBGAYYCw/s1600/Solidity.png" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Ethereum contracts are written in the high level language called Solidity and compiled into bytecode using the Solidity compiler. This bytecode is then uploaded on to the blockchain.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">As mentioned in the previous blog, Visual Studio Code and several editors provide integrated environment to compile the code. If you want to manually run the compiler then here are the steps for compiling a smart contract.</div><div class="MsoNormal"><span style="text-indent: -18pt;"><br /></span></div><div class="MsoNormal"><span style="text-indent: -18pt;">Download the compiler from the GitHub release site</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle"><a href="https://github.com/ethereum/solidity/releases">https://github.com/ethereum/solidity/releases</a><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">Based on your platform download the corresponding bits</div><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-UvoVrTzZQL0/WbapkrugyeI/AAAAAAAAcRc/nWeStyANcpEzxGHPZ6T7x0pjNEg48ppnQCLcBGAs/s1600/SolCompilerDownload.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="521" data-original-width="891" height="372" src="https://2.bp.blogspot.com/-UvoVrTzZQL0/WbapkrugyeI/AAAAAAAAcRc/nWeStyANcpEzxGHPZ6T7x0pjNEg48ppnQCLcBGAs/s640/SolCompilerDownload.png" width="640" /></a></div><div class="MsoListParagraphCxSpMiddle"><br /></div><div class="MsoListParagraphCxSpMiddle">Open the command line and run the below command to compile our 0xService or any smart contract</div><div class="MsoListParagraphCxSpMiddle code">%path%\solc.exe --bin --abi --overwrite -o bin Service.sol</div><br /><div class="MsoListParagraphCxSpLast"><o:p></o:p></div>As you see in the above we are passing bin and abi arguments to specify to the compiler to create the bin and abi file. The generated files are created in the bin folder as mentioned by the other bin attribute. The overwrite flag is used to overwrite the previously generated abi and bytecodes.<br /><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-68587874281274069752017-09-05T21:57:00.000+05:302020-03-10T19:38:19.006+05:300x Services Objective & Requirements<div class="MsoNormal"><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-rW4-aOfnn5s/WbFSVzmTV9I/AAAAAAAAcRM/LXvBB1kXqawLtRy3t25R5R9-52xxyiKFACLcBGAs/s1600/0xServices.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="673" data-original-width="1600" height="267" src="https://3.bp.blogspot.com/-rW4-aOfnn5s/WbFSVzmTV9I/AAAAAAAAcRM/LXvBB1kXqawLtRy3t25R5R9-52xxyiKFACLcBGAs/s640/0xServices.png" width="640" /></a></div><br />Below are the objective and requirements of 0x platform<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Objective:<o:p></o:p></b></div><div class="MsoNormal">Provide a decentralized platform where a client can post a service request and a provider or contractor perform the service in a trustless environment and with escrow payment system.<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Requirements</b>:<o:p></o:p></div><div class="MsoNormal">Client</div><div class="MsoNormal"></div><ul><li>Register and create an account with 0x. 0x creates an user account in Ethereum chain</li><li>Post a service request in 0x and set its price in Ether or 0x tokens. 0x creates a smart contract on Ethereum chain</li><li>0x charges a small amount of fee for creating the contract, this is in addition to the gas required by Ethereum chain. This fee will be paid through 0x tokens</li><li>Negotiate the price of the service with the provider (out of scope for POC)</li><li>The contract acts as the escrow account. Fund the contract with the agreed service amount. This funding can be done through Ether or 0x tokens.</li><li>Once the work is complete authorize payment to the contractor.</li><li>Settle disputes with help of arbiter</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal">Contractor</div><div class="MsoNormal"></div><ul><li>Register and create an account with 0x. 0x creates an user account in Ethereum chain</li><li>Apply for a service</li><li>Perform the requested service (outside of 0x)</li><li>Request payment for the service</li><li>Receive payment to the account</li><li>Raise arbitration if the payment is not received</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal">Arbiter</div><div class="MsoNormal"></div><ul><li>Settle the dispute and authorize the payment from escrow account.</li><li>0x acts as the default arbiter. The client can choose his own arbiter.</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l3 level1 lfo3; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal" style="margin-left: 18.0pt;"><br /></div><div class="MsoNormal">The below are the out of scope requirements for the current implementation and these can be taken up at a later time.</div><div class="MsoNormal"></div><ul><li>Terms and Conditions of the work which will be checked before the payment is made</li><li>Termination procedure</li><li>Intermediate payment or payment schedule where the contractor gets payments based on the payment terms</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo4; text-indent: -18.0pt;">s</div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-85296863059196230762017-08-31T21:46:00.000+05:302020-03-10T19:38:19.065+05:30Visibility Modifiers<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-DBRC1cctii4/Wag2QU5W7HI/AAAAAAAAcPc/3EB3CRlcz2oZFcXU_SWP_Sz6grYzmrfAgCLcBGAs/s1600/icon_visibility_big.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="164" data-original-width="230" src="https://4.bp.blogspot.com/-DBRC1cctii4/Wag2QU5W7HI/AAAAAAAAcPc/3EB3CRlcz2oZFcXU_SWP_Sz6grYzmrfAgCLcBGAs/s1600/icon_visibility_big.png" /></a></div><br /><div class="MsoNormal">Solidity exposes state variables and functions to internal and external worlds using the visibility modifiers. There are four types of visibility modifiers public, internal, private and external.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Functions can have all the four visibility modifiers, the default visibility modifier for functions is public. State variables cannot have external visibility modifier and the default modifier is internal.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Below is the brief description and usage of these visibility modifiers for state variables and functions:<o:p></o:p></div><h3>public<o:p></o:p></h3><div class="MsoNormal">Public functions are part of the contract interface and can be either accessible within the contract or via messages. Public state variables are accessible similar to the functions. <o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">contract </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">Service</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> arbiter; </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// 0x is the default arbiter for every contract</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice Once the service is completed, client pays to the contractor</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">pay</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor.</span><span style="color: #4ec9b0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">transfer</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">(amountPaid);<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> amountPaid </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #b5cea8; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">0</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">For public State variables Solidity automatically generates a getter function. In the above contract, arbiter is defined as public, Solidity generates a function called arbiter which returns the arbiter address.<o:p></o:p></div><h3>internal<o:p></o:p></h3><div class="MsoNormal">The internal functions and state variables can only be accessed within the contract or derived contracts. This is similar to protected variables in C# and other object oriented programming.<o:p></o:p></div><div class="MsoNormal">In the above code, contractor state variable does not have any visibility modifier. As per default configuration, the contract state variable will be on internal scope.<o:p></o:p></div><h3>private<o:p></o:p></h3><div class="MsoNormal">Private functions and state variables, like the name indicates, are accessible within the contract they defined. They are not available in the derived contracts. <o:p></o:p></div><h3>external<o:p></o:p></h3><div class="MsoNormal">An external function is similar to public function. In addition from being called internally and via transactions, external functions can be called from other contracts. To call an external function internally it needs to be prefixed with this (<span style="background: lightgrey; mso-highlight: lightgrey;">this.fund()</span>). External functions can access other functions and state variable directly (without the prefix of this)<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice based on the agreement, client will fund the contract</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// this amount will be payed to contractor at the end</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">fund</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">external</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> onlyClient payable {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> amountPaid +</span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">msg</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">.</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">value</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><br /><div class="MsoNormal">As mentioned earlier State variables cannot have external visibility modifier. Only functions can have external visibility modifier.<o:p></o:p></div><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-19924439143473195882017-08-29T21:00:00.000+05:302020-03-10T19:38:19.114+05:30Solidity Constant<div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-0nfYIg8j-vM/WaWHUiAsnvI/AAAAAAAAcPI/ovdImZ1XdY0KzmhUthfNkr0h_57e5KsCQCLcBGAs/s1600/constant.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="600" height="170" src="https://3.bp.blogspot.com/-0nfYIg8j-vM/WaWHUiAsnvI/AAAAAAAAcPI/ovdImZ1XdY0KzmhUthfNkr0h_57e5KsCQCLcBGAs/s400/constant.png" width="400" /></a></div><br /><div class="MsoNormal">Solidity supports to declare constant state variables and functions. A keyword <span style="background: #C9C9C9; mso-shading-themecolor: accent3; mso-shading-themetint: 153;">constant</span> is used to define constants in Solidity.<o:p></o:p></div><h3>Constant State Variables<o:p></o:p></h3><div class="MsoNormal">State variables can be declared as constant. All constant state variables should be assigned to a constant value at compile time. It can have an expression, but that expression should be evaluated to constant at compile time. Solidity only supports value types and string types as constants. Here is an example of defining constant static variable from Ethereum documentation. Currently in our contract we do not need this constant variables.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">contract </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">C</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">uint</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> x </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">32</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">**</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">22</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> + </span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">8</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">string</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> text </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"abc"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">bytes32</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> myHash </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">keccak256</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"abc"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">);<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><h3>Constant Functions<o:p></o:p></h3><div class="MsoNormal">Constant function are those functions which does not modify the state of the contract. These functions are used to return values from the contract. In our 0x service contract we defined a constant function which returns the address of the contractor.<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @notice Get the contractor assigned to the service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @return contractor address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">getContractorAddress</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">public</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">returns</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor;</span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-23153450209360213922017-08-29T05:48:00.000+05:302020-03-10T19:38:19.171+05:30Ethereum Solidity Function Parameters<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-7aDrNqQDQgs/WaSyy6fwfLI/AAAAAAAAcO4/8O_GwrUXnfs_NRpNQOfM1ApB6H7FSliiQCLcBGAs/s1600/Functions.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="210" data-original-width="220" src="https://2.bp.blogspot.com/-7aDrNqQDQgs/WaSyy6fwfLI/AAAAAAAAcO4/8O_GwrUXnfs_NRpNQOfM1ApB6H7FSliiQCLcBGAs/s1600/Functions.png" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity functions, like any other programming language, take input parameters and return output parameters. They can also return arbitrary number of parameters as output (this is similar to Tuples in C# 7). <o:p></o:p></div><h3>Input Parameters<o:p></o:p></h3><div class="MsoNormal">The input parameters are defined same as variables. A function can take multiple number of input parameters. In our service if we want to hire a contractor we specify the contract address as the input parameter.<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice hiring the contractor to perform the work</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @param _contractor ethereum address of the contractor</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">hire</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> _contractor) onlyClient {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> _contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><h3>Output Parameters<o:p></o:p></h3><div class="MsoNormal">Solidity functions support multiple ways of returning parameters. The function return type should be declared with <span style="background: lightgrey; mso-highlight: lightgrey;">returns</span> keyword. In our service if we want to return the contractor address, then we would write as below:<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice Get the contractor assigned to the service</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @return contractor address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">getContractorAddress</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">constant</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">returns</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">return</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Similar to other languages we can use the keyword return to <span style="background: lightgrey; mso-highlight: lightgrey;">return</span> the function output. Solidity supports named parameters we can provide name of the return parameter as shown below:<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice Get the contractor assigned to the service</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @return contractor address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">getContractorAddress</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">constant</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">returns</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> _contractor) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> _contractor </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above code we provided variable name to the return parameter, _contractor. Assigning value to the variable will automatically return its value.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity supports returning values. It internally uses tuple types, i.e. a list of objects of potentially different types whose size is a constant at compile-time. Those tuples can be used to return multiple values at the same time. The functionality is similar to tuples in C# 7. Let’s return all the addresses in our Service Contract<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @notice Get the addresses of client, contractor and 0x platform</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">/// @return client, contractor and platform address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">getAllAddresses</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">constant</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">returns</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">, </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">, </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">return</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (client, contractor, platform);<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com1tag:blogger.com,1999:blog-9014730285386259823.post-26014874308868384502017-08-22T22:15:00.000+05:302020-03-10T19:38:19.216+05:30Ethereum Solidity Comments<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-m8-8p5sL5Jg/WZxfnfSC95I/AAAAAAAAcOQ/ESVo9J4jh6g6qu9yiZP0UJAUBlVxxZhhACLcBGAs/s1600/Comments.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="600" height="170" src="https://1.bp.blogspot.com/-m8-8p5sL5Jg/WZxfnfSC95I/AAAAAAAAcOQ/ESVo9J4jh6g6qu9yiZP0UJAUBlVxxZhhACLcBGAs/s400/Comments.png" width="400" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Similar to JavaScript, Solidity supports single line comments (<span style="background: lightgrey; mso-highlight: lightgrey;">//</span>) and multi-line comments (<span style="background: lightgrey; mso-highlight: lightgrey;">/*…*/</span>) as shown below<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// This is a single-line comment.</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/*</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">This is a</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">multi-line comment.</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">*/</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity contracts can also have a special form of comments for documentation. This documentation type of comments is called Ethereum Natural Specification Format (Natspec). Natspec format uses doxygen tags. It can have either one or multiple lines starting with <span style="background: silver; mso-highlight: silver;">///</span> or a multiline comment starting with <span style="background: silver; mso-highlight: silver;">/**</span> and ending with <span style="background: silver; mso-highlight: silver;">*/</span>. Here is how we are using Natspec documentation in our service contract.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @title contract between client and contractor.</span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">contract </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">Service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor; </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// address of the hired contractor</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @notice Hiring the contractor to perform the work</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @param _contractor Ethereum address of the contractor</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">hire</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">_contractor) onlyClient {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @notice Get the contractor assigned to the service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">/// @return contractor address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">getContractorAddress</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">public</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">returns</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above code we documented the title of the contract. We also documented the two functions along with their parameters. This documentation comments are parsed by Natspec client and create documentation json files.<o:p></o:p></div><br />Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com2tag:blogger.com,1999:blog-9014730285386259823.post-8965568415351076472017-08-21T20:40:00.000+05:302020-03-10T19:38:19.250+05:30Ethereum Solidity<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-zCJa5fv2GvI/WZr3runDMxI/AAAAAAAAcOA/xaVaP_FtfAoBgUEudfDuYi5j2lKY-CWwwCLcBGAs/s1600/Solidity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="220" data-original-width="142" src="https://2.bp.blogspot.com/-zCJa5fv2GvI/WZr3runDMxI/AAAAAAAAcOA/xaVaP_FtfAoBgUEudfDuYi5j2lKY-CWwwCLcBGAs/s1600/Solidity.png" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity is a contract-oriented, high-level programming language for writing smart contracts which run on Ethereum Virtual Machine. Solidity language is statically typed and follows object-oriented principles. It supports inheritance, libraries and complex user-defined types. Solidity’s syntax is similar to that of ECMA Script (JavaScript) syntax making it familiar for existing web developers.</div><div class="MsoNormal"><br /></div><div class="MsoNormal">Here is the Hello World solidity code we looked earlier.<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">pragma </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">solidity</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> ^</span><span style="color: #b5cea8; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">0</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">.</span><span style="color: #b5cea8; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">4</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">.</span><span style="color: #b5cea8; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">14</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">contract </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">HelloWorld</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">function </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">greet</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">() </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">constant</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">returns</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> (</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">string</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">return</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #ce9178; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">"Hello World!"</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity code is compiled to bytecode that is executable on the EVM. We can use solc, the solidity compiler, or developer editors such as Visual Studio Code to compile and generate the bytecode. Here is the bytecode for the above Hello World sample.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #ce9178; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">6060604052341561000c57fe5b5b6101498061001c6000396000f300606060405263ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663cfae3217811461003a575bfe5b341561004257fe5b61004a6100ca565b604080516020808252835181830152835191928392908301918501908083838215610090575b80518252602083111561009057601f199092019160209182019101610070565b505050905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100d261010b565b5060408051808201909152600c81527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060208201525b90565b604080516020810190915260008152905600a165627a7a723058205168b085c257b42e405c11a8e900935fd85bd351767a3ed78211b54b7c6df2e10029</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity also uses an application binary interface (ABI). ABI defines the structure and methods used in the contract. Ethereum internally uses ABI for encoding and decoding data into and out of transactions. We can use this ABI during contract deploying and also to decode the data passed with transactions. Here is the ABI for our Hello World code.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">[{</span><span style="color: #ce9178; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}]<o:p></o:p></span></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-84717529964598366892017-08-20T20:50:00.000+05:302020-03-10T19:38:19.289+05:30Data Types in Ethereum Solidity Smart Contracts<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-Es4t4HhdME8/WZmogCTSpqI/AAAAAAAAcNw/c5WJyD7Rp1AEyKdahExbAIaQ89ELNyQNgCLcBGAs/s1600/solidity-data-types.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="425" data-original-width="424" height="320" src="https://1.bp.blogspot.com/-Es4t4HhdME8/WZmogCTSpqI/AAAAAAAAcNw/c5WJyD7Rp1AEyKdahExbAIaQ89ELNyQNgCLcBGAs/s320/solidity-data-types.png" width="319" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity is a statically typed language which employs a type system that allows compiler to check for correct usage of variables. Solidity compiler forces that every variable be defined at compile time. Solidity language provides several basic types. These basic types can be combined to form complex types.</div><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Like other static type languages such as C#, Solidity has Value types and Reference types. Solidity Value Types and Reference Types behave similar to C# as outlined below:<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Value Types</b>: Value Type variables are always passed by value. These variables are copied when they are used as function arguments or in assignment. These are basic data types provided by Solidity<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Reference Types</b>: These are the complex data types that cannot be copied. Their memory or data location is passed around.</div><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Below are the popular data types used in Solidity. For more information refer to the Solidity documentation <a href="http://solidity.readthedocs.io/en/latest/types.html">http://solidity.readthedocs.io/en/latest/types.html</a></div><div class="MsoNormal"></div><ul><li>Value Types</li><ul><li><span style="text-indent: -18pt;">Boolean</span></li><li><span style="text-indent: -18pt;">Integer</span></li><li>Address</li><li><span style="text-indent: -18pt;">Enum</span></li><li><span style="text-indent: -18pt;">Function</span></li></ul><li>Reference Types</li><ul><li>String</li><li>Array</li><li>Struct</li><li>Mapping</li></ul></ul><div class="MsoListParagraphCxSpLast" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal">Here are the brief details of the common data types in Solidity<o:p></o:p></div><h3>Boolean</h3><h2><o:p></o:p></h2><div class="MsoNormal">Boolean data type is used to store true or false value. This is similar to C# and other programming languages. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Boolean supports all the typical comparison operators such as <span style="background: silver; mso-highlight: silver;">!</span> , <span style="background: silver;">||</span>, <span style="background: silver; mso-highlight: silver;">&&</span>, <span style="background: silver; mso-highlight: silver;">==</span>, <span style="background: silver; mso-highlight: silver;">!=</span>. The operators <span style="background: silver; mso-highlight: silver;">||</span> and <span style="background: silver; mso-highlight: silver;">&&</span> apply the common short-circuiting rules. This means that in the expression f(x) || g(y), if f(x) evaluates to true, g(y) will not be evaluated.<o:p></o:p></div><h3>Integer</h3><h2><o:p></o:p></h2><div class="MsoNormal">Solidity support signed and unsigned integers. Signed integers are declared with keyword <span style="background: silver; mso-highlight: silver;">int</span> and unsigned integers with keyword <u><span style="background: silver; mso-highlight: silver;">uint</span></u>. In addition to better optimize memory Solidity allows specifing the size of the integer data types, such as <span style="background: silver; mso-highlight: silver;">uint8</span>, <span style="background: silver; mso-highlight: silver;">uint16</span>, …, <span style="background: silver; mso-highlight: silver;">uint256</span> and <span style="background: silver; mso-highlight: silver;">int8</span>, <span style="background: silver; mso-highlight: silver;">int16</span>, …, <span style="background: silver; mso-highlight: silver;">int256</span>. The size of the data types varies by a step of 8 bits. Solidity provided a short hand alias of <span style="background: silver; mso-highlight: silver;">uint</span> for <span style="background: silver; mso-highlight: silver;">uint256</span> and <span style="background: silver; mso-highlight: silver;">int</span> for <span style="background: silver; mso-highlight: silver;">int256</span>. This is similar to int alias in C#. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">uint</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> budget; </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// amount budgeted for the service</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">uint</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> amountPaid; </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// amount paid to the contractor</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Like other languages (C#), Solidity provides the following operators</div><div class="MsoNormal"></div><ul><li>Comparison operators: <span style="background: silver; text-indent: -18pt;"><=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;"><</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">==</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">!=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">>=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">></span></li><li>Bit operators: <span style="background: silver; text-indent: -18pt;">&</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">|</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">^</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">~</span></li><li>Arithmetic Operators: <span style="background: silver; text-indent: -18pt;">+</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">-</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">*</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">/</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">%</span></li><li>Unary operators: <span style="background: silver; text-indent: -18pt;">++</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">--</span></li><li>Assignment operators: <span style="background: silver; text-indent: -18pt;">-=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">*=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">/=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">%=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">|=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">&=</span><span style="text-indent: -18pt;">, </span><span style="background: silver; text-indent: -18pt;">^=</span></li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;"><o:p></o:p></div><h3>String</h3><h2><o:p></o:p></h2><div class="MsoNormal">Strings are the dynamic sized array (see below for Arrays). This type is used to store an arbitrary length of string. As Strings are arrays they are reference type. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity also supports string literals which are fixed sized byte arrays. String literals are written with either double or single quotes (“Client”, ‘Contractor’). Similar to integer data types, the string literals can have the data types of bytes1, ..., bytes32 (depending on the string size)<o:p></o:p></div><h3>Address</h3><h2><o:p></o:p></h2><div class="MsoNormal">Address data type is used to store an Ethereum address. It can contain the address of a user account or an address of a contract. Ethereum address is a 20 byte value as shown below:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// 0x account address</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> platformAddress </span><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">=</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #b5cea8; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">0x1e2f51e97f2772dafe59d345bbe48c32a7d2b46b</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">; <o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">The Address data type has below two frequently used members:</div><div class="MsoNormal"></div><ul><li>balance() returns(uint)<span style="text-indent: -18pt;">: This method returns the ether balance of the address in units of wei</span></li><li>transfer(uint)<span style="text-indent: -18pt;">: This method is used to send ethers from the current contract address to another address. The ethers are defined in the units of wei.</span></li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><o:p></o:p></div><h3>Enum</h3><h2><o:p></o:p></h2><div class="MsoNormal">The enum keyword is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. Hence Enums are strongly typed constants which makes the code more readable and less prone to errors.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// enum to define states of the service contract</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">enum </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">State</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> { Bid, Award, Work, Paid }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">State</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractState; </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// to store the current state of the service contract</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Enums need at least one member. Enum types have to be explicitly converted from and to integer types. Solidity sometimes implicitly convert the enum types when used in function return parameters.<o:p></o:p></div><h3>Function Types</h3><h2><o:p></o:p></h2><div class="MsoNormal">Function Types are the types of functions. Similar to Java Script, Solidity allows functions to be passed as function parameters and return types. Solidity functions can be assigned to a variable of Function Type. These variables can be passed as inputs to the functions and can be returned as function return values. Function Types comes in two flavours – internal and external functions. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Internal functions contain the actual code of the function. They can only be called inside the current contract and can only be executed inside the current contract context. Calling an internal function is similar to calling any other function that is defined in the current contract. The advantage of using Internal function type is that they can be passed around and invoked based on the application logic.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">External functions contains the address and the function signature. These types can be used, as the name indicates, to execute the external functions.<o:p></o:p></div><h3>Arrays</h3><h2><o:p></o:p></h2><div class="MsoNormal">Arrays can be fixed size or dynamic at the compile time. The fixed size arrays are declared as <span style="background: silver; mso-highlight: silver;">T[k]</span> where k is the fixed size of element T. The dynamic arrays are declared as <span style="background: silver; mso-highlight: silver;">T[]</span>. The Array data type is similar to arrays in C# and other programming language.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Solidity support multi-dimensional array and this multi-dimensional array is declared as <span style="background: silver; mso-highlight: silver;">T[][]</span>. We can even declare an array of dynamic arrays. For example to declare an array of 5 dynamic arrays, T[][5].<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Array data type supports the following two members:</div><div class="MsoNormal"></div><ul><li>length: The length member holds and returns the number of elements in the array.</li><li>push: For dynamic storage arrays and bytes, push can be used to append an element at the end of the array. The function returns the new length of the array</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l3 level1 lfo4; text-indent: -18.0pt;"><o:p></o:p></div><h3>Structs</h3><h2><o:p></o:p></h2><div class="MsoNormal">Structs let us define complex data types or user defined data types in solidity. These structs are similar to other programming languages like C#. In our contract we will define a bidder type which holds the information of the contractor and his bid amount. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// struct type to hold bidder information</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">struct </span><span style="color: #dcdcaa; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">Bidder</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">uint</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> bidAmount;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><h3>Mappings</h3><h2><o:p></o:p></h2><div class="MsoNormal">Mapping data types are the dynamic array of key value pair. Mappings are similar to hash table or dictionary in C# or other programming languages. Solidity uses SHA-3 hash (keccak256) on the key and stores the value with that hash. When needed it will use this hash to look up and retrieve the value.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">mapping</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">(</span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">address</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"> => </span><span style="color: #569cd6; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">Bidder</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">) bids; </span><span style="color: #608b4e; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";">// storing all bids received for the contract</span><span style="color: #d4d4d4; font-family: Consolas; font-size: 10.5pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Mappings are only allowed for state variables. Hence mappings typically used to data for quick retrieval.<o:p></o:p></div><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-53821189428765467022017-08-20T06:50:00.000+05:302020-03-10T19:38:19.323+05:30Standalone PC to Decentralized Ethereum Platform<div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-STgR7JQX8zw/WZjjmulqyMI/AAAAAAAAcNg/A7u285fJqyUsO5lFjiHpY_YRXlq8fZiGwCLcBGAs/s1600/Standalone.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="462" data-original-width="1361" height="216" src="https://3.bp.blogspot.com/-STgR7JQX8zw/WZjjmulqyMI/AAAAAAAAcNg/A7u285fJqyUsO5lFjiHpY_YRXlq8fZiGwCLcBGAs/s640/Standalone.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Early 1980s witnessed the beginning of a new era in computing owing to the birth of the general purpose personal computers. This PC technology penetrated homes, small business and schools. At that time most of these computers are standalone and worked independently.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Slowly these independent computers had to connect to other independent computers to share data and resources. Computer networks which already existed at that time allowed these independent computers, sometimes called as nodes, to connect and share resources. As technology progressed the demand to connect more and more computers grew tremendously.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Early 1990 marks the transition of these smaller computer networks into a global system of interconnected computer networks. Thus giving birth to Internet. The Internet, sometimes called “Net”, is a massive network of networks that consists private, public, academic, business and government networks. Internet revolutionized how we exchange data between millions of computers. With computers spread across the globe forming a global infrastructure, Internet is the beginning of decentralized computing. No one owns Internet, and no single person or organization controls the Internet.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">With increase in sharing between nodes or computers, a new communication protocol, BitTorrent, has evolved which enabled distribution of large data and files over the Internet. BitTorrent is the communication protocol for peer to peer file sharing (“P2P”) digital media using peer to peer networking technology. It relies decentralized network to effectively share resources and reduce burden on the centralized server. The decentralization technology continued to evolve.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">With the advent of cloud, the environment changed drastically. All of a sudden a centralized computing took the prime seat. More and more servers were deployed on to the centralized cloud environment to perform computing, sharing resources etc. The cloud revolution temporarily pushed the decentralized journey to back seat.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Bitcoin brought decentralization back to the table. It also revolutionized decentralized technologies with a decentralized peer to peer ledger that runs in a trustless public environment with immutable data and without any trusted central authority. It also introduced distributed consensus which helps all the nodes to validate the block and build the best block chain. Bitcoin uses Blockchain as the underlying technology.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Ethereum took this decentralized blockchain further by providing a platform where we can develop decentralized applications. Ethereum, sometimes called Blockchain 2.0, provides us a programming model which enables developers to write smart contracts that encapsulate user obligations in a decentralized network.<o:p></o:p></div><br /><div class="MsoNormal"><br /></div><div class="MsoNormal">As you see the decentralization evolved from standalone systems to the current state and it will evolve further to become an efficient system with millions of transactions and capable of changing the technology we know.<o:p></o:p></div><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-20811960104074372872017-08-14T14:38:00.000+05:302020-03-10T19:38:19.359+05:30Structure of an Ethereum Smart Contract<div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-o6xRcvfxIy4/WZFoe2n2dFI/AAAAAAAAbfk/sHiwsQHXi34-UlYkmYXa4060tTbp_akcACLcBGAs/s1600/structure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="331" data-original-width="500" height="211" src="https://3.bp.blogspot.com/-o6xRcvfxIy4/WZFoe2n2dFI/AAAAAAAAbfk/sHiwsQHXi34-UlYkmYXa4060tTbp_akcACLcBGAs/s320/structure.png" width="320" /></a></div><div class="MsoNormal">Smart Contract is similar to a class in object oriented programming. A smart contract can contain the following parts:</div><div class="MsoNormal"></div><ul><li>Version Pragma</li><li>Comments</li><li>State Variables</li><li>Functions</li><li>Function Modifiers</li><li>Events</li><li>Structs Types</li><li>Enums Types</li></ul><br /><div class="MsoNormal">Below is the brief definition of these components. In the subsequent blogs I will go in depth into each of these components:<br /><!--[if !supportLineBreakNewLine]--><br /><!--[endif]--><o:p></o:p></div><div class="MsoNormal"><b>Version Pragma<o:p></o:p></b></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal">This pragma directive tells the compiler to use the correction version to compile the contract and to reject compiling with an incompatible compiler. This annotation ensures that our code is always compiled correctly as we intended. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">The version pragma is used as follows:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">pragma </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">solidity</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> ^</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">4</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">14</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;</span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">This directive is optional, but is highly recommended to annotate every source file with this version pragma. The version pragma uses semantic versioning and is denoted by [major, minor, patch] tuple. As shown above 0.4.14. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above version directive we used caret range to specify the supported compilers. The caret range allows compiler greater than the specified version and does not allow compiler greater than the left most non-zero digit. In our definition the left most non-zero digit is 4 (0.4). So the caret range allows compiler greater than the specified version (0.4.14) and does not allow greater than the left most non-zero digit (0.5.0). In other words, only compiler with version >= 0.4.14 and < 0.5.0 be allowed to compile to compile our contract code. This version pragma directive can also include prerelease tags such as alpha, beta. Below are examples of caret ranges:</div><div class="MsoNormal"></div><ul><li>^0.4.14 := >=0.4.14 and <0.5.0</li><li>^1.2.3 := >=1.2.3 and <2.0.0</li><li>^0.2.3 := >=0.2.3 <0.3.0</li><li>^0.0.3 := >=0.0.3 <0.0.4</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal">The solidity compiler can use complex rules for identifying the correct compiler version. But this may be rarely used. Unless you want to target a specific version range, you don’t need to go that complex.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><b>State Variables<o:p></o:p></b></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal">State Variables are values which are permanently stored in contract storage. These are similar to the class variables.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">pragma </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">solidity</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> ^</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">4</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">14</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">contract </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">Service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> client; </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// State variable to store client who requests service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor; </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// State variable to store contractor for the service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> platform; </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// State variable to store 0x address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above contract we defined three state variables called client, contractor and platform which are of type address. We use these variable to store the address of the client who requested service, contractor who has hired to perform the service and 0x platform who facilitates the interaction between client and contractor. I will revisit State Variables once we cover more details.<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Functions<o:p></o:p></b></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Functions are the executable units of code within a contract. Again these are similar to the functions in the object oriented world.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">A contract can have the following types of functions</div><div class="MsoNormal"></div><ul><li>Member functions</li><li>Constructor</li><li>Fallback function</li><li>Constant functions</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal"><u>Member functions<o:p></o:p></u></div><div class="MsoNormal">These are the functions which modify the state variables of the contract and performs transactions that are stored in the block chain. These functions typically don’t have return values.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// hiring the contractor to perform the work</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">hire</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above code the client of the service requestor finalized the contractor and is hiring the contractor to perform the service. As you see this function is updating the contractor state variable.<o:p></o:p></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Constructor<o:p></o:p></u></div><div class="MsoNormal">A constructor is a special type of member function. The constructor is called only once for the life of the contract and during the initialization of the contract. Hence you can have all your initialization logic in this constructor. As show below I am storing the client address, one who creates the contract (msg.sender is the account which initializes the contract) and the 0x platform address which can be used to arbitrage between client and contractor.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// creates the service for the client</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// 0x will be platform provider</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">Service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">_platform) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> client </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">msg</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">sender</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> platform </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _platform;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Fallback function<o:p></o:p></u></div><div class="MsoNormal">Fallback function is a function which does not have a function name. This function is invoked whenever a contact is called with a function name that does not exist. For example if user calls a function called “close” and this close function does not exist in the contract, then the fallback function will be called. In our code we don’t want users to call functions that don’t exist, hence reverting the call.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">//default function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">revert()</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">} <o:p></o:p></span></div><div class="MsoNormal"><br /><span style="font-family: "Calibri",sans-serif; font-size: 11.0pt; line-height: 107%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">A contract can have exactly one unnamed function. This function cannot have arguments and cannot return anything. </span><br /><br /></div><div class="MsoNormal"><u>Constant function<o:p></o:p></u></div><div class="MsoNormal">A constant function is used in scenarios where you want to read the state variables of the contract and don’t want to update their state. Constant functions prevent updating the state variables of the contract. In our 0x contract we will have a validate function which checks the terms and conditions of our smart contract. For this POC the actual validation is out of scope. So let’s assume that the validation is always successful and return true as shown below:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// validate the terms of the contract</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">validate</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">returns</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">bool</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// for POC we are doing additional validations</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">true</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><b>Function Modifiers<o:p></o:p></b></div><div class="MsoNormal">Function Modifiers are used to amend the semantics of a function in a declarative way. These can be used to automatically check a condition prior and/or after the execution of a function. Here is an example on how Function Modifiers are used in our 0x service contract<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// modifier to ensure client can only execute a function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">modifier </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">onlyClient</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">require</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">msg</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">sender</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">==</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> client);<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">_</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">hire</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor) onlyClient { </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// using function modifier</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above code we defined a function modifier, onlyClient, in which we are checking whether the caller of the contract function is a client. msg.sender contains the address of the caller. Require checks and validates the condition is true before proceeding. If the condition fails, requires throws an exception and exits the function.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">The special symbol underscore “_” is very important in the modifier. The body of the actual function will be inserted and executed at this point. This enables us to use function modifiers before and/or after the execution of the function.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">A function can have multiple function modifiers. These modifiers should be specified in a whitespace separated list and these modifiers are evaluated in the order present.<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Structs Type<o:p></o:p></b></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Structs are the custom defined types in Solidity. These are used to group several variables. In our 0x service we will be defining a custom type, struct, Bidder as shown below:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// struct type to hold bidder information</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">struct </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">Bidder</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">uint</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> bidAmount;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">mapping</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> => </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">Bidder</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) bids;<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Struct types are typically used inside mappings and arrays. Mapping type in the above code is similar to the dictionary in C#. Structs can contain other structs and other complex types.<o:p></o:p></div><div class="MsoNormal"><b><br /></b></div><div class="MsoNormal"><b>Enum Types<o:p></o:p></b></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Enums are also user defined types in solidity (similar to structs). Enum Types will have a finite set of values. In our 0x Service contract we defined an enum to hold the current state of the contract as shown below:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">enum </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">State</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> { Bid, Award, Work, Paid }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">State</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractState;<o:p></o:p></span></div><div class="MsoNormal"><br /></div><br /><div class="MsoNormal">In the above code the State enum contains the possible states of the contract, i.e., open for bid, contract awarded, work started and finally payment for the service. contractState variable is used to store the current state of the contract.<o:p></o:p></div><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com3tag:blogger.com,1999:blog-9014730285386259823.post-71317392102816901882017-08-14T10:49:00.000+05:302020-03-10T19:38:19.394+05:30Functions - Structure of an Ethereum Smart Contract<div class="separator" style="clear: both; text-align: center;"><a href="https://i.stack.imgur.com/7tji1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="210" data-original-width="220" src="https://i.stack.imgur.com/7tji1.png" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Functions are the executable units of code within a contract. Again these are similar to the functions in the object oriented world.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">A contract can have the following types of functions</div><div class="MsoNormal"></div><ul><li>Member functions</li><li>Constructor</li><li>Default function</li><li>Constant functions</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal"><u>Member functions<o:p></o:p></u></div><div class="MsoNormal"><br /></div><div class="MsoNormal">These are the functions which modify the state variables of the contract and performs transactions that are stored in the block chain. These functions typically don’t have return values.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// hiring the contractor to perform the work</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">hire</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contractor </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _contractor;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above code the client of the service requestor finalized the contractor and is hiring the contractor to perform the service. As you see this function is updating the contractor state variable.<o:p></o:p></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Constructor<o:p></o:p></u></div><div class="MsoNormal"><br /></div><div class="MsoNormal">A constructor is a special type of member function. The constructor is called only once for the life of the contract and during the initialization of the contract. Hence you can have all your initialization logic in this constructor. As show below I am storing the client address, one who creates the contract (msg.sender is the account which initializes the contract) and the 0x platform address which can be used to arbitrage between client and contractor.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// creates the service for the client</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// 0x will be platform provider</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">Service</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">_platform) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> client </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">msg</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">sender</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> platform </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> _platform;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Default function<o:p></o:p></u></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Default function is a function which does not have a function name. This function is invoked whenever a contact is called with a function name that does not exist. For example if user calls a function called “close” and this close function does not exist in the contract, then the default function will be called. In our code we don’t want users to call functions that don’t exist, hence throwing an exception.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">//default function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">throw</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">} <o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Constant function<o:p></o:p></u></div><div class="MsoNormal"><br /></div><div class="MsoNormal">A constant function is used in scenarios where you want to read the state variables of the contract and don’t want to update their state. Constant functions prevent updating the state variables of the contract. In our 0x contract we will have a validate function which checks the terms and conditions of our smart contract. For this POC the actual validation is out of scope. So let’s assume that the validation is always successful and return true as shown below:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// validate the terms of the contract</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">validate</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">returns</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">bool</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// for POC we are doing additional validations</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">true</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}</span></div><br /><div class="MsoNormal">This blog is part of <a href="http://www.prasannapattam.com/2017/08/structure-of-ethereum-smart-contract.html">Structure of an Ethereum Smart Contract</a>, please refer to it for more details.</div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-59037896251134162702017-08-13T21:27:00.000+05:302020-03-10T19:38:19.431+05:30Version Pragma - Structure of an Ethereum Smart Contract<div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-b2dFYIZQIcI/WZB2a2LqFkI/AAAAAAAAbfU/DnZtT8ibgAUe7jPrnEyzlt2efo3BTFvhQCLcBGAs/s1600/Version.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="350" data-original-width="800" height="175" src="https://4.bp.blogspot.com/-b2dFYIZQIcI/WZB2a2LqFkI/AAAAAAAAbfU/DnZtT8ibgAUe7jPrnEyzlt2efo3BTFvhQCLcBGAs/s400/Version.png" width="400" /></a></div><div class="MsoNormal">This pragma directive tells the compiler to use the correction version to compile the contract and to reject compiling with an incompatible compiler. This annotation ensures that our code is always compiled correctly as we intended. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">The version pragma is used as follows:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">pragma </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">solidity</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> ^</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">4</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">14</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal"><br /></div><div class="MsoNormal">This directive is optional, but is highly recommended to annotate every source file with this version pragma. The version pragma uses semantic versioning and is denoted by [major, minor, patch] tuple. As shown above 0.4.14.</div><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In the above version directive we used caret range to specify the supported compilers. The caret range allows compiler greater than the specified version and does not allow compiler greater than the left most non-zero digit. In our definition the left most non-zero digit is 4 (0.4). So the caret range allows compiler greater than the specified version (0.4.14) and does not allow greater than the left most non-zero digit (0.5.0). In other words, only compiler with version >= 0.4.14 and < 0.5.0 be allowed to compile to compile our contract code. This version pragma directive can also include prerelease tags such as alpha, beta. Below are examples of caret ranges:</div><div class="MsoNormal"></div><ul><li><span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> </span><span style="text-indent: -18pt;">^0.4.14 := >=0.4.14 and <0.5.0</span></li><li><span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> </span><span style="text-indent: -18pt;">^1.2.3 := >=1.2.3 and <2.0.0</span></li><li><span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> </span><span style="text-indent: -18pt;">^0.2.3 := >=0.2.3 <0.3.0</span></li><li><span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> </span><span style="text-indent: -18pt;">^0.0.3 := >=0.0.3 <0.0.4</span></li></ul><br /><div class="MsoNormal">The solidity compiler can use complex rules for identifying the correct compiler version. But this may be rarely used. Unless you want to target a specific version range, you don’t need to go that complex.</div><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><br />This blog is part of <a href="http://www.prasannapattam.com/2017/08/structure-of-ethereum-smart-contract.html">Structure of an Ethereum Smart Contract</a>, please refer to it for more details.<br /><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-86735243561333893212017-08-08T06:28:00.000+05:302020-03-10T19:38:19.471+05:30Ethereum Mist supersedes Wallet<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-XkJIAm145Is/WYkMQex7dCI/AAAAAAAAbfE/WuM13IwGtCYb5qbrzjcj9a2qYU1dUe8DwCLcBGAs/s1600/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="144" data-original-width="360" height="256" src="https://2.bp.blogspot.com/-XkJIAm145Is/WYkMQex7dCI/AAAAAAAAbfE/WuM13IwGtCYb5qbrzjcj9a2qYU1dUe8DwCLcBGAs/s640/image001.png" width="640" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><br /></div><div class="MsoNormal">Ethereum Mist now replaces the Ethereum Wallet. Here is the Ethereum wiki on wallet:<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">“Ethereum Wallet is just a Mist implementation enabled to access a single dapp – the wallet dapp, this is due to missing features in Mist itself and so that we are able to release earlier. So the wallet is Mist, in wallet mode”<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">As you see Ethereum Wallet is a stop gap solution while Mist is being built out. With Mist is getting ready for production release, we may as well be using Mist instead of Wallet.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Mist is a cross platform hybrid desktop application using web interface. It is built with electron. It will be easy for the web developers to debug using the Mist browser.<o:p></o:p></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-86406367674464831432017-08-05T22:03:00.000+05:302020-03-10T19:38:19.503+05:30Ethereum Mist Browser with private chain<div align="center" class="MsoNormal" style="text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-nqpplHkAZV0/WYj8FFoeQGI/AAAAAAAAbe0/wUEJT-ERoBUh0KB7G0d8Tyz73rp2R5mtgCLcBGAs/s1600/Mist.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="512" data-original-width="512" height="320" src="https://4.bp.blogspot.com/-nqpplHkAZV0/WYj8FFoeQGI/AAAAAAAAbe0/wUEJT-ERoBUh0KB7G0d8Tyz73rp2R5mtgCLcBGAs/s320/Mist.png" width="320" /></a></div></div><div align="center" class="MsoNormal" style="text-align: center;"><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">You can connect Ethereum Mist browser to the private chain and take advantages of the mist features. Here are the simple 2 steps to connect the mist browser to the private chain:</div><div class="MsoNormal"></div><ul><li>Start the private chain. Refer to my blog <a href="http://www.prasannapattam.com/2017/06/ethereum-dev-network.html" style="text-indent: -18pt;">Ethereum Dev Chain - Private Chain</a><span style="text-indent: -18pt;"> for more details.</span></li><li>Run the Mist. It automatically connects to the private chain that is running on the same machine</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoNormal">That’s all. Now we can have the mist connected to the test chain as shown below:<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_1" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:468pt; height:380.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-Nlj79GDYiD4/WYXy1FCmaCI/AAAAAAAAbec/feb9zBLHmEk2tsvkuZL0t7S1heCfyzxTQCEwYBhgL/s1600/image003.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="507" data-original-width="624" height="520" src="https://3.bp.blogspot.com/-Nlj79GDYiD4/WYXy1FCmaCI/AAAAAAAAbec/feb9zBLHmEk2tsvkuZL0t7S1heCfyzxTQCEwYBhgL/s640/image003.jpg" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Please note that on the windows machine, I had to run the geth and mist with administrative permissions<o:p></o:p></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-80303964773298391562017-08-05T21:39:00.000+05:302020-03-10T19:38:19.599+05:30Ethereum Wallet with private chain<div align="center" class="MsoNormal" style="text-align: center;"><img height="1" src="file:///C:/Users/ppattam/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png" v:shapes="_x0000_i1025" width="1" /> </div><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-goLtxBOMZ7A/WYXtXc-bj7I/AAAAAAAAbeM/RfUvR6JyfCcBwzM6fhazoYAh6vaWGMoGwCLcBGAs/s1600/image002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="369" data-original-width="453" height="325" src="https://2.bp.blogspot.com/-goLtxBOMZ7A/WYXtXc-bj7I/AAAAAAAAbeM/RfUvR6JyfCcBwzM6fhazoYAh6vaWGMoGwCLcBGAs/s400/image002.jpg" width="400" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><o:p></o:p></div><div class="MsoNormal">You can connect Ethereum wallet to the private chain and take advantages of the wallet features. Here are the simple 2 steps to connect the wallet to the private chain:</div><div class="MsoNormal"></div><ul><li>Start the private chain. Refer to my blog <a href="http://www.prasannapattam.com/2017/06/ethereum-dev-network.html" style="text-indent: -18pt;">Ethereum Dev Chain - Private Chain</a><span style="text-indent: -18pt;"> for more details.</span></li><li>Run the Ethereum wallet. It automatically connects to the private chain that is running on the same machine</li></ul><br /><div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><br /></div><div class="MsoNormal">That’s all. Now we can have the wallet connected to the test chain as shown below:<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_1" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:468pt; height:347.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-BOfOdb2WR5A/WYXtXV9m14I/AAAAAAAAbeI/f7Ugx_CYv408yTauaW1wpF9hk05zeWxpACEwYBhgL/s1600/image003.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="463" data-original-width="624" height="474" src="https://4.bp.blogspot.com/-BOfOdb2WR5A/WYXtXV9m14I/AAAAAAAAbeI/f7Ugx_CYv408yTauaW1wpF9hk05zeWxpACEwYBhgL/s640/image003.jpg" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Please note that on the windows machine, I had to run the geth and wallet with administrative permissions<o:p></o:p></div><br /><div class="MsoNormal" style="text-align: justify;"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0tag:blogger.com,1999:blog-9014730285386259823.post-27559815974283515972017-08-04T20:28:00.000+05:302020-03-10T19:38:19.633+05:30Hello World Ethereum Smart Contract with VS Code and Solidity<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-nKyN-3yuxto/WYSLNks2fWI/AAAAAAAAbdg/qEbaomlv3uk8xVjbT5xxSHKfeoAWKsNJwCLcBGAs/s1600/maxresdefault.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="720" data-original-width="1280" height="360" src="https://2.bp.blogspot.com/-nKyN-3yuxto/WYSLNks2fWI/AAAAAAAAbdg/qEbaomlv3uk8xVjbT5xxSHKfeoAWKsNJwCLcBGAs/s640/maxresdefault.jpg" width="640" /></a></div><br /><div align="center" class="MsoNormal" style="text-align: center;"><b><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/></v:shapetype><v:shape id="Picture_x0020_2" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:5in;height:202.5pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></b></div><div class="MsoNormal">In my previous blog we have created our first Hello world app using Remix Solidity IDE. <o:p></o:p></div><div class="MsoNormal"><a href="http://www.prasannapattam.com/2017/06/hello-world-ethereum-solidity-smart.html">http://www.prasannapattam.com/2017/06/hello-world-ethereum-solidity-smart.html</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">In this blog, I will go over how to use Visual Studio Code to compile the Hello World contract and deploy the contract on a private chain and Rinkeby chain. Please refer to my other related blogs for setting up Visual Studio Code, Private Chain and connecting to Rinkeby Testnet.<o:p></o:p></div><div class="MsoNormal"><a href="http://www.prasannapattam.com/2017/07/smart-contracts-solidity-coding-using.html">Smart Contracts (Solidity) coding using Visual Studio Code</a><o:p></o:p></div><div class="MsoNormal"><a href="http://www.prasannapattam.com/2017/06/ethereum-dev-network.html">Ethereum Dev Chain - Private Chain</a><o:p></o:p></div><div class="MsoNormal"><a href="http://www.prasannapattam.com/2017/07/setting-up-ethereum-rinkeby-testnet.html">Setting up Ethereum Rinkeby Testnet</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Let’s start by opening Visual Studio Code and open a folder in VS Code. If required create the folder. The folder is required because VS code compiles the code and creates the abi and bytecode here.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Create a new file in this folder called HelloWorld.sol with the below code:<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">pragma </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">solidity</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> ^</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">4</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">.</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">11</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">contract </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">HelloWorld</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function </span><span style="color: #dcdcaa; font-family: "consolas"; font-size: 10.5pt;">greet</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">() </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">public</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">constant</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">returns</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> (</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">string</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">return</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"Hello World!"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">;<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Compile this smart contract by pressing F5 key. This creates a bin folder with abi and bin (bytecode). Here are the contents of the abi and bin file:<o:p></o:p></div><div class="MsoNormal"><u>abi</u>:<o:p></o:p></div><div class="MsoNormal code">[{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"}]<o:p></o:p></div><br /><div class="MsoNormal"><u>bin(bytecode)</u>:<o:p></o:p></div><div class="MsoNormal code">6060604052341561000c57fe5b5b6101498061001c6000396000f300606060405263ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663cfae3217811461003a575bfe5b341561004257fe5b61004a6100ca565b604080516020808252835181830152835191928392908301918501908083838215610090575b80518252602083111561009057601f199092019160209182019101610070565b505050905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100d261010b565b5060408051808201909152600c81527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060208201525b90565b604080516020810190915260008152905600a165627a7a723058205168b085c257b42e405c11a8e900935fd85bd351767a3ed78211b54b7c6df2e10029<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Now let’s start the private chain as mentioned in my blog <a href="http://www.prasannapattam.com/2017/06/ethereum-dev-network.html">Ethereum Dev Chain - Private Chain</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Here are the steps to be followed in the JavaScript console to deploy the contract:</div><div class="MsoNormal"></div><ul><li>Unlock the account so that Ether can be used for gas</li></ul>> personal.unlockAccount(eth.accounts[0], "password")<br /><div class="MsoListParagraphCxSpMiddle"><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">true<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">In the above command I am using the first account. If required you can specify any other account</div><div class="MsoListParagraphCxSpMiddle"></div><ul><li>Define the abi & bytecode variables. Prefix the bytecode with “0x”</li></ul><div class="code">var abi = [{ abi generated by the compiler }]<br /><div class="MsoListParagraphCxSpMiddle"><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">var bytecode = “0x<bytecode generated by compiler>”</div><div class="MsoListParagraphCxSpMiddle"></div></div><ul><li>Deploy the contract</li></ul><div class="code"><div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">> var contract = eth.contract(abi)</div><div class="MsoListParagraphCxSpMiddle"></div></div><ul><li>Find the gas estimate for deploying the contract</li></ul><div class="code"><div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">eth.estimateGas({ data: bytecode} )<o:p></o:p></div></div><div class="MsoListParagraphCxSpMiddle">This gives the gas required to deploy the contract. Currently it’s value is 138902. Specify this value in the next step while creating an instance of this contract</div><div class="MsoListParagraphCxSpMiddle"></div><ul><li>Now create an instance of this contract.</li></ul><div class="code"><div class="MsoListParagraphCxSpMiddle">> var instance = contract.new({<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... from:eth.accounts[0],<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... data:bytecode,<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... gas:138902}, function(err, contractInstance){<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... if(!err) {<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">......... if(!contractInstance.address) {<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">............ console.log("Tx Hash: " + contractInstance.transactionHash) // The hash of the transaction<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">............ } else {<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">............ console.log("Address: " + contractInstance.address) // the contract address<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">............ }<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">......... }<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... else {<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">......... console.log(err)<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">......... }<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">...... });<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">Tx Hash: 0x57228ccd8013aa17b134c3f76147a1c5a74f40f98c7bc352e484f42581e30355<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">undefined<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">> Address: 0x44408814564648d05d4cfcf12397151cfee0af52<o:p></o:p></div></div><div class="MsoListParagraphCxSpMiddle">The contract creation is an asynchronous function. Once the contract is mined, the call back function returns the transaction hash and address at which the contract is deployed.</div><div class="MsoListParagraphCxSpMiddle"></div><ul><li>Wait till the contract is mined and address is shown in the console</li><li>Now invoke the greet function</li></ul><div class="code"><div class="MsoListParagraphCxSpMiddle">> instance.greet()<o:p></o:p></div><div class="MsoListParagraphCxSpMiddle">"Hello World!"<o:p></o:p></div></div><div class="MsoListParagraphCxSpLast"><br /></div><div class="MsoNormal">With above steps we successfully deployed the contract onto a private chain and invoked it. Here is the complete JavaScript console code:<o:p></o:p></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">personal.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">unlockAccount</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(eth.accounts[</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">], </span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"password"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">)<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">var</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> abi </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> [{</span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">}]<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">var</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> bytecode </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"0x6060604052341561000c57fe5b5b6101498061001c6000396000f300606060405263ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663cfae3217811461003a575bfe5b341561004257fe5b61004a6100ca565b604080516020808252835181830152835191928392908301918501908083838215610090575b80518252602083111561009057601f199092019160209182019101610070565b505050905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100d261010b565b5060408051808201909152600c81527f48656c6c6f20576f726c6421000000000000000000000000000000000000000060208201525b90565b604080516020810190915260008152905600a165627a7a723058205168b085c257b42e405c11a8e900935fd85bd351767a3ed78211b54b7c6df2e10029"</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">var</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contract </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> eth.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">contract</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(abi)<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">var</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> gas </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> eth.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">estimateGas</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">({ data: bytecode} )<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">var</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> instance </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">=</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> contract.</span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">new</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">({<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> from:eth.accounts[</span><span style="color: #b5cea8; font-family: "consolas"; font-size: 10.5pt;">0</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">],<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> data:bytecode,<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> gas:gas}, </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">function</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(err, contractInstance){<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">if</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">!</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">err) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">if</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">!</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">contractInstance.</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> console.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">log</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"Tx Hash: "</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">+ contractInstance.transactionHash) </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// The hash of the transaction</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> } </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">else</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> console.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">log</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(</span><span style="color: #ce9178; font-family: "consolas"; font-size: 10.5pt;">"Address: "</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">+ contractInstance.</span><span style="color: #569cd6; font-family: "consolas"; font-size: 10.5pt;">address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">) </span><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">// the contract address</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> </span><span style="color: #c586c0; font-family: "consolas"; font-size: 10.5pt;">else</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> console.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">log</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">(err)<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">});<o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><br /></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #608b4e; font-family: "consolas"; font-size: 10.5pt;">//wait for the mining to be completed</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="background: #1E1E1E; line-height: 14.25pt; margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">instance.</span><span style="color: #4ec9b0; font-family: "consolas"; font-size: 10.5pt;">greet</span><span style="color: #d4d4d4; font-family: "consolas"; font-size: 10.5pt;">()<o:p></o:p></span></div><div class="MsoNormal"><br /></div><div class="MsoNormal">I generally use Rinkeby during the UAT environment. Let’s run the above script in the Rinkeby environment and check it. Please refer to my other blog on how to connect to Rinkeby chain, <a href="http://www.prasannapattam.com/2017/07/setting-up-ethereum-rinkeby-testnet.html">Setting up Ethereum Rinkeby Testnet</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">I deployed the contract on Rinkeby network and here is the screenshot of this contract:<o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-lhX17UDF6zg/WYPTH6OqKxI/AAAAAAAAbdM/Z76v2sU0nLUSOE6nOYowSoxLQT9xKeF2wCEwYBhgL/s1600/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="361" data-original-width="624" height="370" src="https://2.bp.blogspot.com/-lhX17UDF6zg/WYPTH6OqKxI/AAAAAAAAbdM/Z76v2sU0nLUSOE6nOYowSoxLQT9xKeF2wCEwYBhgL/s640/image002.png" width="640" /></a></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:468pt; height:270.75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com1tag:blogger.com,1999:blog-9014730285386259823.post-71347271739601401322017-07-25T06:52:00.000+05:302020-03-10T19:38:19.670+05:30Nethereum – A .NET Library for Ethereum<div align="center" class="MsoNormal" style="text-align: center;"><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-mECGhuHwkm4/WXac0rloViI/AAAAAAAAbcA/mPBb8S75sSofNjDhl5aYG9BoUoDnHcklACLcBGAs/s1600/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="311" data-original-width="516" height="240" src="https://4.bp.blogspot.com/-mECGhuHwkm4/WXac0rloViI/AAAAAAAAbcA/mPBb8S75sSofNjDhl5aYG9BoUoDnHcklACLcBGAs/s400/image001.png" width="400" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Nethereum is the .Net integration library for Ethereum, it allows you to interact with Ethereum clients like geth, eth or parity using RPC. The library has very similar functionality as the Javascript Etherum Web3 RPC Client Library (from GitHub documentation). <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Nethereum is the open source library that is actively built at GitHub. <o:p></o:p></div><div class="MsoNormal"><a href="https://github.com/Nethereum/Nethereum">https://github.com/Nethereum/Nethereum</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">I am using Nethereum to programmatically deploy the smart contracts and send transactions to these contracts. In this blog, I will walk through setting up the Visual Studio deployment environment. Below are the simple two-step process to setup the Visual Studio Development Environment using Nethereum</div><div class="MsoNormal"><o:p></o:p></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Step 1</u>: Create an ASP.NET Core Web Application<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_3" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:468pt; height:285pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-ioQz8BfWatM/WXac0rgpW7I/AAAAAAAAbcE/YLra0AbQZeQolfVCO6fy2pF1lsb8OFQqACEwYBhgL/s1600/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="380" data-original-width="624" height="388" src="https://4.bp.blogspot.com/-ioQz8BfWatM/WXac0rgpW7I/AAAAAAAAbcE/YLra0AbQZeQolfVCO6fy2pF1lsb8OFQqACEwYBhgL/s640/image002.png" width="640" /></a></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Step 2</u>: Install the Nuget Package Nethereum.Geth<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_4" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:467.25pt; height:252pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-lKObs8EkQ4g/WXac0l80YZI/AAAAAAAAbcI/pqXMNdW3WH8i_zCA9gI_Xha_KxNvoaBrACEwYBhgL/s1600/image003.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="336" data-original-width="623" height="344" src="https://3.bp.blogspot.com/-lKObs8EkQ4g/WXac0l80YZI/AAAAAAAAbcI/pqXMNdW3WH8i_zCA9gI_Xha_KxNvoaBrACEwYBhgL/s640/image003.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Now we are ready to use C# with Ethereum.<o:p></o:p></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com14tag:blogger.com,1999:blog-9014730285386259823.post-11146057693282804292017-07-24T14:11:00.000+05:302020-03-10T19:38:19.701+05:30Setting up Ethereum Rinkeby Testnet<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-zlsZ5LYJUyk/WXWxDlYAT3I/AAAAAAAAbbY/fyPm6Xzo4s0tqaKtz2kH1GJ8UV2kj0GRwCLcBGAs/s1600/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="309" data-original-width="624" height="316" src="https://1.bp.blogspot.com/-zlsZ5LYJUyk/WXWxDlYAT3I/AAAAAAAAbbY/fyPm6Xzo4s0tqaKtz2kH1GJ8UV2kj0GRwCLcBGAs/s640/image001.png" width="640" /></a></div><div class="MsoNormal"><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/></v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1033" type="#_x0000_t75" style='width:468pt;height:231.75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="MsoNormal">Rinkeby is the public testnet for Ethereum. This testnet can be used during development, testing and pre-production scenarios. I personally use private net during development and use Rinkeby for demos. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Refer to my other blog on setting up a development private chain: <a href="http://www.prasannapattam.com/2017/06/ethereum-dev-network.html">Ethereum Dev Network</a><o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Here are the steps for setting up and connecting to Rinkeby test chain:<o:p></o:p></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Step 1</u>: Download the latest Geth from the below URL<o:p></o:p></div><div class="MsoNormal"><a href="https://geth.ethereum.org/downloads/">https://geth.ethereum.org/downloads/</a><o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_9" o:spid="_x0000_i1032" type="#_x0000_t75" style='width:468pt; height:156pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://2.bp.blogspot.com/-q2dBTDYZSWY/WXWxDmTUhKI/AAAAAAAAbbU/FhA_okcIOEg-aTyuOZZCjOjvTYOZAwKUgCEwYBhgL/s1600/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="208" data-original-width="624" height="211" src="https://2.bp.blogspot.com/-q2dBTDYZSWY/WXWxDmTUhKI/AAAAAAAAbbU/FhA_okcIOEg-aTyuOZZCjOjvTYOZAwKUgCEwYBhgL/s640/image002.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">As I am using a windows machine, I downloaded the windows version. Install the Geth on your machine as per the installation guide.<o:p></o:p></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Step 2</u>: Create a folder called Rinkeby which keeps the chain data.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Step 3</u>: Run the following command to connect to the Rinkeby testnet<o:p></o:p></div><div class="MsoNormal">geth.exe --rinkeby --syncmode "fast" --datadir=devchain --rpc --rpccorsdomain "*" --rpcapi "eth,web3,personal,net,miner,admin,debug" --verbosity 0 console<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_3" o:spid="_x0000_i1031" type="#_x0000_t75" style='width:468.75pt; height:57.75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-AoN_6JeVlUI/WXWxDfMr63I/AAAAAAAAbbQ/WjfetdysqvcAPPrDjMsFaDN1cqblN-t2ACEwYBhgL/s1600/image003.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="77" data-original-width="625" height="76" src="https://1.bp.blogspot.com/-AoN_6JeVlUI/WXWxDfMr63I/AAAAAAAAbbQ/WjfetdysqvcAPPrDjMsFaDN1cqblN-t2ACEwYBhgL/s640/image003.png" width="640" /></a></div><div class="MsoNormal"><u><br /></u></div><div class="MsoNormal"><u>Step 4</u>: Wait for the sync to complete. The sync will be completed based number of blocks. With the current block number 586,326 it took about 20 mins to sync. You can check the sync status with the following command:<o:p></o:p></div><div class="MsoNormal">eth.syncing<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_4" o:spid="_x0000_i1030" type="#_x0000_t75" style='width:132pt; height:75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://3.bp.blogspot.com/-WmvR36xMq6E/WXWxEBCwnPI/AAAAAAAAbbc/1oSvlD-dv44n_ySObECPoGPnoORj4M0KQCEwYBhgL/s1600/image004.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="100" data-original-width="176" height="113" src="https://3.bp.blogspot.com/-WmvR36xMq6E/WXWxEBCwnPI/AAAAAAAAbbc/1oSvlD-dv44n_ySObECPoGPnoORj4M0KQCEwYBhgL/s200/image004.png" width="200" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">The above command returns either false (if syncing has not stated or completed) or current block number. Wait for the syncing to be completed.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Step 5</u>: Create the user account using the javascript console. Run personal.newAccount() and provide password when prompted<o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://2.bp.blogspot.com/-P7nCvuw8xhQ/WXWxEJIy3GI/AAAAAAAAbbg/1UKNlkJYV8ESojWhYLw5mRWE-qqXMAxAgCEwYBhgL/s1600/image005.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="62" data-original-width="346" height="70" src="https://2.bp.blogspot.com/-P7nCvuw8xhQ/WXWxEJIy3GI/AAAAAAAAbbg/1UKNlkJYV8ESojWhYLw5mRWE-qqXMAxAgCEwYBhgL/s400/image005.png" width="400" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_5" o:spid="_x0000_i1029" type="#_x0000_t75" style='width:259.5pt; height:45.75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image009.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="MsoNormal">The console shows the address of the new account created.<o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><u>Step 6</u>: Verify that your account is created in the Rinkeby by using the Rinkeby Etherscan<o:p></o:p></div><div class="MsoNormal"><a href="https://rinkeby.etherscan.io/address/0xee2cf60fc91d370d4a73fa0111c4b397a95c918e">https://rinkeby.etherscan.io/address/0xee2cf60fc91d370d4a73fa0111c4b397a95c918e</a><span class="MsoHyperlink"><o:p></o:p></span></div><div class="separator" style="clear: both; text-align: left;"><a href="https://4.bp.blogspot.com/-J4AH02sYp2E/WXWxEPUB8HI/AAAAAAAAbbk/tziOUlbpjMsrzxygrZiTkqPjaulqq4iaACEwYBhgL/s1600/image006.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="312" data-original-width="536" height="371" src="https://4.bp.blogspot.com/-J4AH02sYp2E/WXWxEPUB8HI/AAAAAAAAbbk/tziOUlbpjMsrzxygrZiTkqPjaulqq4iaACEwYBhgL/s640/image006.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><br /></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_7" o:spid="_x0000_i1028" type="#_x0000_t75" style='width:402pt; height:234pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image011.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="MsoNormal"><u>Step 7</u>: Request Ether(ETH) for your newly created account. As you see above the current ETH balance is 0. Rinkeby uses Proof of Authority for mining. Hence you need to request Rinkeby to provide you ether. Rinkeby has a faucet which can provide you ether. You need to periodically request Ether using this faucet. <o:p></o:p></div><div class="MsoNormal"><br /></div><div class="MsoNormal">To prevent spam, Rinkeby faucet requires people requesting funds have a GitHub account and create a GitHub Gist. Let’s create a GitHub Gist with the account number as shown below:<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_8" o:spid="_x0000_i1027" type="#_x0000_t75" style='width:467.25pt; height:261pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image013.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://1.bp.blogspot.com/-33AMz5qUlgg/WXWxEk3vwQI/AAAAAAAAbbo/ToSsa3Iwe_EDCVHlKVvYV_Shpv2dRpb9wCEwYBhgL/s1600/image007.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="348" data-original-width="623" height="355" src="https://1.bp.blogspot.com/-33AMz5qUlgg/WXWxEk3vwQI/AAAAAAAAbbo/ToSsa3Iwe_EDCVHlKVvYV_Shpv2dRpb9wCEwYBhgL/s640/image007.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Once the Gist is created go to the Rinkeby faucet (<a href="https://faucet.rinkeby.io/">https://faucet.rinkeby.io/</a>) and request funds<o:p></o:p></div><div class="MsoNormal"><!--[if gte vml 1]><v:shape id="Picture_x0020_11" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:468pt; height:313.5pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ppattam\AppData\Local\Temp\msohtmlclip1\01\clip_image015.png" o:title=""/></v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://3.bp.blogspot.com/-Yue9RMX9ILg/WXWxErrG6ZI/AAAAAAAAbbs/edD3OunR_DA6YI6O6p2N1kRyxa1AqyxbwCEwYBhgL/s1600/image008.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="418" data-original-width="624" height="427" src="https://3.bp.blogspot.com/-Yue9RMX9ILg/WXWxErrG6ZI/AAAAAAAAbbs/edD3OunR_DA6YI6O6p2N1kRyxa1AqyxbwCEwYBhgL/s640/image008.jpg" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">Once the account is funded with your requested ethers, go to the Etherscan and verify that the account is credited with the requested ethers.<o:p></o:p></div><div class="MsoNormal"><a href="https://rinkeby.etherscan.io/address/0xee2cf60fc91d370d4a73fa0111c4b397a95c918e">https://rinkeby.etherscan.io/address/0xee2cf60fc91d370d4a73fa0111c4b397a95c918e</a><o:p></o:p></div><div class="separator" style="clear: both; text-align: left;"><a href="https://3.bp.blogspot.com/-o9HjVZXQm3M/WXWxFGwQ2uI/AAAAAAAAbbw/rgGu-dgujYw6RQ52QcRcSeiz0Me5iDmwwCEwYBhgL/s1600/image009.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="373" data-original-width="624" height="380" src="https://3.bp.blogspot.com/-o9HjVZXQm3M/WXWxFGwQ2uI/AAAAAAAAbbw/rgGu-dgujYw6RQ52QcRcSeiz0Me5iDmwwCEwYBhgL/s640/image009.png" width="640" /></a></div><div class="MsoNormal"><br /></div><div class="MsoNormal">With these above seven steps, our Rinkeby testnet is setup and ready to deploy smart contracts and send transactions.<o:p></o:p></div><br /><div class="MsoNormal"><br /></div>Prasanna Kumar Pattamhttp://www.blogger.com/profile/05306189308152061408noreply@blogger.com0