Can Swift be used for Smart Contracts, Fungible & Non-Fungible Token Creation?

I'm interested in using Swift for smart contract and non-fungible token (NFT) development. Is there any way to currently do this using Swift Crypto?

If not, is the functionality being worked on already, and when would it be available?

That would depend entirely on where you’re hoping to deploy the smart contract. For example, Etherem smart contracts must be compiled for the Ethereum virtual machine (EVM) and I don’t believe anyone has written a backend for the Swift compiler to target the EVM. After a brief search I found web3.swift but that’s purely an Ethereum client, not a tool for compiling the smart contracts themselves. Can you provide more specifics on where you’re hoping to deploy and why you’d prefer Swift over the native languages for those particular blockchains?

After a bit more searching it looks like there has been some effort to support the EVM as a target for LLVM which is used by the Swift compiler (link below). However there are significant limitations of the EVM, such as being purely stack based (no heap memory) that will probably make writing a smart contract in Swift very unnatural. There would also need to be additional work to support the EVM target in the Swift compiler by exposing additional compilation flags, etc, in the CLI. So the complexity here is pretty significant and it won’t work out of the box today.

Terms of Service

Privacy Policy

Cookie Policy