{"id":7131,"date":"2023-03-29T09:51:05","date_gmt":"2023-03-29T09:51:05","guid":{"rendered":"https:\/\/ai.catenacap.xyz\/?page_id=7131"},"modified":"2023-03-29T09:55:50","modified_gmt":"2023-03-29T09:55:50","slug":"restrict-us-wallets-via-evm-smart-contract-from-interacting-with-your-sc","status":"publish","type":"page","link":"https:\/\/ai.catenacap.xyz\/?page_id=7131","title":{"rendered":"Restrict US Wallets via EVM Smart-contract from Interacting with your SC."},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"7131\" class=\"elementor elementor-7131\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4370b61 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4370b61\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f6ce521\" data-id=\"f6ce521\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2a587eb elementor-widget elementor-widget-heading\" data-id=\"2a587eb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Restrict US based Wallets interaction with Smart Contract.<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-aeed277 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"aeed277\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fe07f2d\" data-id=\"fe07f2d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-27d0242 elementor-widget elementor-widget-text-editor\" data-id=\"27d0242\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p dir=\"auto\">Restrict US based wallets interacting with your smart contract via the EVM system<\/p><p dir=\"auto\">Following on from restricting US based validating nodes from validating your smart-contract processes &#8211; <a href=\"https:\/\/github.com\/catenacap\/restrict_evm_US_other_validation\" target=\"_blank\" rel=\"noopener\">here<\/a>, you can also restrict US based wallets from interacting with your smart contract using the following.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-54aebee elementor-widget elementor-widget-code-highlight\" data-id=\"54aebee\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>pragma solidity ^0.8.0;\n\ncontract USWalletRestriction { mapping (address => string) private _walletCountry;\n\nmodifier onlyNonUS() {\n    string memory country = _walletCountry[msg.sender];\n    require(keccak256(bytes(country)) != keccak256(bytes(\"United States\")), \"US-based wallet detected.\");\n    _;\n}\n\nfunction updateWalletCountryMapping(address wallet, string memory country) public {\n    _walletCountry[wallet] = country;\n}\n\nfunction myRestrictedFunction() public onlyNonUS {\n    \/\/ This function can only be called from wallets owned by individuals located outside the United States\n    \/\/ ...\n}\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6d662a3 elementor-widget elementor-widget-text-editor\" data-id=\"6d662a3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>T<\/p><p dir=\"auto\">he &#8216;USWalletRestriction&#8217; contract uses a similar approach to the previous example, but instead of checking the IP address of the validator or miner, it checks the IP address of the wallet owner.<\/p><p dir=\"auto\">The &#8216;_walletCountry&#8217; mapping associates wallet addresses with their corresponding countries. You can update this mapping using the updateWalletCountryMapping function, which takes a wallet address and a country as parameters.<\/p><p dir=\"auto\">The &#8216;onlyNonUS&#8217; modifier checks the country of origin of the wallet owner based on the &#8216;_walletCountry&#8217; mapping. If the country is detected as &#8220;United States&#8221;, the modifier reverts the transaction and prevents the function from being executed.<\/p><p dir=\"auto\">The &#8216;myRestrictedFunction&#8217; function is an example of a function that is restricted to non-US wallets. It can only be called from wallets owned by individuals located outside the United States.<\/p><p dir=\"auto\">Keep in mind that this approach relies on the accuracy and reliability of the external APIs used to retrieve the country information, as well as the wallet address used by the individual. Also, it&#8217;s worth noting that this mechanism may not be sufficient to comply with all regulatory requirements, and you should consult with legal and compliance experts to ensure that your smart contract meets all necessary regulations.<\/p><p dir=\"auto\">Visit our <a href=\"https:\/\/github.com\/catenacap\/restrict_EVM_US_other_Wallets_Via_Smartcontracts\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Restrict US based Wallets interaction with Smart Contract. Restrict US based wallets interacting with your smart contract via the EVM system Following on from restricting US based validating nodes from validating your smart-contract processes &#8211; here, you can also restrict US based wallets from interacting with your smart contract using the following. pragma solidity ^0.8.0; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"disable_featured_image":false,"footnotes":""},"class_list":["post-7131","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ai.catenacap.xyz\/?page_id=7131\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap\" \/>\n<meta property=\"og:description\" content=\"Restrict US based Wallets interaction with Smart Contract. Restrict US based wallets interacting with your smart contract via the EVM system Following on from restricting US based validating nodes from validating your smart-contract processes &#8211; here, you can also restrict US based wallets from interacting with your smart contract using the following. pragma solidity ^0.8.0; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ai.catenacap.xyz\/?page_id=7131\" \/>\n<meta property=\"og:site_name\" content=\"AI | Catena Cap\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-29T09:55:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@CatenaCap\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/?page_id=7131\",\"url\":\"https:\\\/\\\/ai.catenacap.xyz\\\/?page_id=7131\",\"name\":\"Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#website\"},\"datePublished\":\"2023-03-29T09:51:05+00:00\",\"dateModified\":\"2023-03-29T09:55:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/?page_id=7131#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ai.catenacap.xyz\\\/?page_id=7131\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/?page_id=7131#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ai.catenacap.xyz\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Restrict US Wallets via EVM Smart-contract from Interacting with your SC.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#website\",\"url\":\"https:\\\/\\\/ai.catenacap.xyz\\\/\",\"name\":\"AI | Catena Cap\",\"description\":\"Don&#039;t Trust, Verify\",\"publisher\":{\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ai.catenacap.xyz\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#organization\",\"name\":\"AI | CatenaCap\",\"url\":\"https:\\\/\\\/ai.catenacap.xyz\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/bafybeihf3j3elacorgnhodcdk4nnenm63rag6p777elx52d5xwpkmm5rfi.ipfs.dweb.link\\\/uploads\\\/2023\\\/02\\\/occ-fav-150x150-1.png\",\"contentUrl\":\"https:\\\/\\\/bafybeihf3j3elacorgnhodcdk4nnenm63rag6p777elx52d5xwpkmm5rfi.ipfs.dweb.link\\\/uploads\\\/2023\\\/02\\\/occ-fav-150x150-1.png\",\"width\":150,\"height\":150,\"caption\":\"AI | CatenaCap\"},\"image\":{\"@id\":\"https:\\\/\\\/ai.catenacap.xyz\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/CatenaCap\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ai.catenacap.xyz\/?page_id=7131","og_locale":"en_US","og_type":"article","og_title":"Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap","og_description":"Restrict US based Wallets interaction with Smart Contract. Restrict US based wallets interacting with your smart contract via the EVM system Following on from restricting US based validating nodes from validating your smart-contract processes &#8211; here, you can also restrict US based wallets from interacting with your smart contract using the following. pragma solidity ^0.8.0; [&hellip;]","og_url":"https:\/\/ai.catenacap.xyz\/?page_id=7131","og_site_name":"AI | Catena Cap","article_modified_time":"2023-03-29T09:55:50+00:00","twitter_card":"summary_large_image","twitter_site":"@CatenaCap","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/ai.catenacap.xyz\/?page_id=7131","url":"https:\/\/ai.catenacap.xyz\/?page_id=7131","name":"Restrict US Wallets via EVM Smart-contract from Interacting with your SC. - AI | Catena Cap","isPartOf":{"@id":"https:\/\/ai.catenacap.xyz\/#website"},"datePublished":"2023-03-29T09:51:05+00:00","dateModified":"2023-03-29T09:55:50+00:00","breadcrumb":{"@id":"https:\/\/ai.catenacap.xyz\/?page_id=7131#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ai.catenacap.xyz\/?page_id=7131"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ai.catenacap.xyz\/?page_id=7131#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ai.catenacap.xyz\/"},{"@type":"ListItem","position":2,"name":"Restrict US Wallets via EVM Smart-contract from Interacting with your SC."}]},{"@type":"WebSite","@id":"https:\/\/ai.catenacap.xyz\/#website","url":"https:\/\/ai.catenacap.xyz\/","name":"AI | Catena Cap","description":"Don&#039;t Trust, Verify","publisher":{"@id":"https:\/\/ai.catenacap.xyz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ai.catenacap.xyz\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ai.catenacap.xyz\/#organization","name":"AI | CatenaCap","url":"https:\/\/ai.catenacap.xyz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ai.catenacap.xyz\/#\/schema\/logo\/image\/","url":"https:\/\/bafybeihf3j3elacorgnhodcdk4nnenm63rag6p777elx52d5xwpkmm5rfi.ipfs.dweb.link\/uploads\/2023\/02\/occ-fav-150x150-1.png","contentUrl":"https:\/\/bafybeihf3j3elacorgnhodcdk4nnenm63rag6p777elx52d5xwpkmm5rfi.ipfs.dweb.link\/uploads\/2023\/02\/occ-fav-150x150-1.png","width":150,"height":150,"caption":"AI | CatenaCap"},"image":{"@id":"https:\/\/ai.catenacap.xyz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CatenaCap"]}]}},"_links":{"self":[{"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=\/wp\/v2\/pages\/7131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7131"}],"version-history":[{"count":0,"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=\/wp\/v2\/pages\/7131\/revisions"}],"wp:attachment":[{"href":"https:\/\/ai.catenacap.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}