General Solidity Questions

Here you can post general questions or issues you have with Solidity smart contracts and Solidity programming.


hi guys i was hoping someone could help. Im in the middle of a project using moralis and when inputting. truffle init, into the terminal the following error appears. C:Users\dell\AppData\Roaming\npm \truffle.ps1 cannot be loaded because running scripts is disabled on this system.

any guidance would be much appreciated pray

1 Like

Are you trying to run it with powerShell? You should try to use CMD (windows console) instead.

Might be an issue with your powerShell not able to run scripts (maybe admin mode works).

Carlos Z

thanks Carlos much appreciated

1 Like


I’m developer but totally new to blockchain development. I’m about to give Moralis a try for my first blockchain project.

I would like to know if I’ll be able to query Twitter API using some kind of Oracle in a smart contract. For exemple Chainlink have an adapter for Twitter.

It’s still very obscure to me how to setup the whole thing, and I’m not asking “how” to do this (let me the pleasure to discover :smiley:). But what I’m asking is : is Moralis a dead end for this kind of requirement? Or will I be able, somehow, to get this working?

I’m a bit concerned about the last part of this article stating that the Node backend has to be configured so the Chainlink adapter can work. Will I be able to integrate this with the Moralis Servers/Functions ?


Does anyone know the process for updating metadata on an ERC721 token? According to the standards it should be possible.

In theory, does this mean you could change the image associated with the popular NFT cryptopunks?

Is there a way to guarantee a user cannot change the metadata?

This is the bit I’m referencing from the ERC721 documentation:

A mechanism is provided to associate NFTs with URIs. We expect that many implementations will take advantage of this to provide metadata for each NFT. The image size recommendation is taken from Instagram, they probably know much about image usability. The URI MAY be mutable (i.e. it changes from time to time). We considered an NFT representing ownership of a house, in this case metadata about the house (image, occupants, etc.) can naturally change.

You are referring to ERC721URIStorage. The metadata can be modified by the internal function _setTokenURI. There will need to be another function in your contract that calls _setTokenURI with the correct permissions.

So yes, the way to guarantee a user never changes the URI is to not allow access to _setTokenURI in any functions.

However, it is important to realize why changing an URI may be useful. The biggest use case is in the rare occasion that the file get removed/deleted/banned etc by the host. If _setTokenURI is not available, the NFT would then have to be recreated with a new URI and new transaction history.

More info on ERC721URIStorage here:


Hi everyone, I have a solidity challenge and I am unsure I understand.

What is the shortest runtime bytecode for a contract that:

  • expects only one uint256 as calldata (no function selector)
  • returns the fibonacci number at that index (can start the sequence at either 0 or 1)

Calling a contract with no function selector means calling the fallback function? and if so the logic for the fibonacci computation should go in the fallback?


Hi Filip and everyone!

I am a complete newbie at programming with a big and urgent problem.
I am trying to (emergency) withdraw funds from a smart contract vault at BSC but I get “Fail with error ‘ds-math-sub-underflow’”.

Now the problem is, that it is quite a large amount that is stuck and the website is going to go offline next week.

The devs are nowhere to be found but from some vaults funds have been able to get withdrawn by raising the gas fee drastically. But alas not from this one.

So I try my luck here with you guys that at least understand more than I do about communicating with smart contracts.

Does anyone have any idea what I can do? I know that you guys are enthusiasts happy to help – but if this gets solved there will be a reward as well.

Sincere regards

Help! I’m a Struggling Developer,
Hello guys, can someone help with putting a solidity smart contract together with a front-end in order to launch a Dapp in What I need really is a step 1. step 2. step 3 … walkthrough from start to finish including the tools required to be installed and at what point to use them).
Note: I have already tested and proofed the Solidity smart contract code and I have downloaded the code as a remix back-up zip folder but I’m unable to put it together using as the information provided thus far are somewhat skimpy to say the least (confusing somewhat).
I would appreciate the help. Anyone?

I am not sure what kind of dApp you’re looking to build but here is a complete tutorial you can follow to get started: Build Your First Dapp

The Moralis Academy also has plenty of resources to learn from.

Thanks, I will take a look but honestly I have gone over practically all of the front-end —>> JS + HTML -->> Solidity tutorials available here so far on Moralis however, most of what I’m seeing is about using truffle+ganache to initialize the codes (from scratch) but that’s not what I need.
What I need is how to use Moralis to launch my Dapp having already developed the solidity smart contract code (saved in .zip)

The tutorial I linked covers everything; app development, contracts, Moralis integration. Then you can deploy or host the finished app on Moralis or another provider like Netlify or Vercel.

There are many tutorials for Moralis apps and you can look over the docs.

Went through that and that’s sending me back to running the codes through truffle et al once again…, that’s not what I need. I already have my DeFi smart contract built, tested and proven in the remix solidity environment - I have all the smart contract files ready so where do I go from here without wasting my time watching a beginner’s tutorial?
I performed my smart contract in remix solidity therefore, how do I set up the Web 3, JS and HTML integration using Moralis?

You can go through the documentation as mentioned: Create a Moralis Dapp - Moralis or Connect with SDK - Moralis

Thanks a mucho. I’m seeing how it all works with the Moralis system now