Smart Contracts

This is a thread for discussing smart accounts, smart tokens, RIDE API & IDE.
Basic information can be found here: https://docs.wavesplatform.com/platform-features/smart-contracts.html
Documentation: https://docs.wavesplatform.com/technical-details/waves-contracts-language-description.html
IDE: https://ide.wavesplatform.com/

4 Likes

We plan to move away from base58 encoding for scripts. It is too slow for kilobyte-sized data, which opens the way to DOS attacks. Moreover, base58 doesn’t make much sense for anything other than addresses.

So the planned changes are:

  • use base64 to encode scripts. Base64 is widely supported and much faster. To avoid confusion base64 strings are to be prefixed with “base64:”
  • restrict the base58 function in the smart contract language to accept short strings only (say 64 bytes and less), and fail on longer inputs.
  • I’m not sure about adding base64 function to the language. Is there any use for it?
2 Likes

So everything with work with Base64 in the future?
I remember the “poll” on Discord about this, the decision is made?

1 Like

Not everything, only new features: data transactions, and smart contracts.

1 Like

base64 better, base58 only can help not confusing with 0, i , l :slight_smile: That’s all I know :slight_smile:

Here, why bitcoin used base58 instead base64. Source: https://en.bitcoin.it/wiki/Base58Check_encoding

// Why base-58 instead of standard base-64 encoding?
// - Don’t want 0OIl characters that look the same in some fonts and
// could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won’t line-break if there’s no punctuation to break at.
// - Doubleclicking selects the whole number as one word if it’s all alphanumeric.

1 Like

Доброго времени суток, для будущей платформы интересует следующий момент: Возможна или нет заморозка части токенов на аккаунте по определенным условиям? Как пример заморожено 5000 токенов, которые были переведены туда на год, но остальные свободны. И возможно-ли автоматизировать начисление процентов на замороженную сумму.
A good time of the day for the future platform is interested in the next moment: Is it possible or not to freeze part of the tokens on the account for certain conditions? As an example, 5,000 tokens that were transferred there for a year are frozen, but the rest are free. And is it possible to automate the calculation of interest on a frozen amount.

1 Like

It should be possible to forbid going below 5,000 on this account until some moment in the future. Something like (in pseudocode):

if transaction is transfer
and balance - amount < FROZEN
and timestamp < YEAR_FROM_NOW
then false

As for interest it’s hardly possible to accumulate it automatically, because smart accounts cannot initiate transactions, they just verify them

1 Like

Добрый день.
Помогите пожалуйста создать простой смарт контракт. Из документации получилось только создать смарт контракт с алисой, бобом и купером ) Заранее спасибо.

Входные данные

Участник №1 - знаем его паблик кей
Участник №2 - знаем его паблик кей
Система - имеем доступ ко всем ключам.

1-й этап
Система загружает смарт контракт на 2-х участников, на определенную сумму.
2-й этап через некоторое время система передает значения в смарт контракт. Если Отправляет 1, то средства отправляются участнику №1, если 2 то участнику №2, если 3, то происходит возврат обратно системе.
После 2-го этапа контракт считается исполненным.

1 Like

I want to send the waves that come into the smart wallet evenly on two separate wallets. Can you help with script

1 Like