Text this: Comprehensive Insights into Smart Contracts: Architecture, Sectoral Applications, Security Analysis, and Legal Frameworks