Sign up Smart Contract continuation 2: CreateAccountNotAllowed

0 45
Avatar for wabinab
2 years ago

This article continues from https://read.cash/@wabinab/sign-up-smart-contract-partial-solution-and-its-security-concerns-364b3361

Previously one wrote about the idea for signup creation, and here is an update. The original linkdrop contract is deployed on "testnet", which is a top-level contract. And linkdrop contract requires an account creation either be another top-level contract, or a sub-contract of a top-level contract. If you know about near protocol, "testnet" is the highest level, with lower level things like "wabinab.testnet", etc. Then lower level again "smart_contract.wabinab.testnet".

Hence, one wants to deploy a linkdrop contract as the one deployed on testnet requires you to drop at least 1 NEAR to your friend. (On testnet, if you drop 2 NEAR to your friend, you friend only receives 1 NEAR, because there's a bug on linkdrop testnet that eats away 1 NEAR. Hence if you try to send only 1 NEAR, it will fail. However if you do this on mainnet, it's okay, the bug is fixed, and sending 1 NEAR to your friend, your friend will receives slightly less than 1 NEAR (due to GAS fee)). But one just wants to create a wallet, not to send 1 NEAR. One wants to send 0.1 NEAR (stingily). It won't work on the main contract, so we'll deploy our own contract, modified from the main contract.

Then as the title said, CreateAccountNotAllowed is what one received. This is weird if you don't Google it, thinking that something's wrong with the contract written. Only when you google it, one found out this:

https://nomicon.io/RuntimeSpec/Actions

(And you CTRL+F yourself and type "CreateAccountNotAllowed") then that's one issue. One don't deploy it to the top level account...

testnet: "wahahahah you don't have a top level account to deploy too."

me: "But one wants to deploy the contract."

testnet: "Wahahahaha who cares, one is occupied. Bye!"

(One wants to create a meme here but one can't find a proper image on unsplash/pexels sorry...)

Another trial

We would redirect the person to create an account themselves. Upon creation, it'll ask for fund, and we'll ask for their address to send to us and we'll send the (minimal) fund for account creation.

Too bad this can't be tried on testnet. In testnet, when you create an account, they allocate a fix funds for you to experiment. In mainnet, you require to send your own fund. So that's a difference.

Conclusion

After some pain and frustration, we understand the limitations of the NEAR linkdrop contract, and we try to find solutions that go around it, which did or did not work. We resolve to request customer creating their own wallet and we can fund their wallet with 0.1 NEAR upon creation. We also bear in mind there can be scam, fraudulent, farmers, etc that takes advantage of the system and it may take some time to find even partial solutions to them.

(Alternatively, could use the NEAR DROP to generate large amount of link to supply to user. As usual, this is susceptible to farmers).

Remember to Like and Subscribe if you like my posts.

4
$ 0.71
$ 0.70 from @TheRandomRewarder
$ 0.01 from @DrPsycho
Sponsors of wabinab
empty
empty
empty
Avatar for wabinab
2 years ago

Comments