-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DERO Virtual Machine Inbuilt Functions Suggestions #1
Comments
Read and learn more about DERO DVM and Smart Contracts on stargate testnet. |
IDEA FOR DVM:
IDEA FOR DERO PROJECT:
|
about random number, is it possible to use next tx block hash to create the random number? i found also an interesting paper about random number on bitcoin WEBSITES: |
While we did come together and make functions for errors and returning balances when they occurred during testing earlier this year, I know there was once discussion about solving this issue to where if a SC errored out, the sent value(s) would be returned. just to expand on what I was mentioning, I know one example was this and I believe others had some other similar versions as well: error function: https://github.com/Nelbert442/DERO_Stargate_SC/blob/master/timebox_payment.bas#L28 the call of the function supplying value as a parameter: https://github.com/Nelbert442/DERO_Stargate_SC/blob/master/timebox_payment.bas#L87 |
|
|
DERO API/SDK for dapp developers https://www.programmableweb.com/category/blockchain/sdks examples: |
Hashing functions: SHA-256 Also function to convert string to bytes for input into hashing functions. |
BLOCK_TIMESTAMP := get the unix time (uint64) of a block from within a smart contract rationale: alongside BLOCK_HEIGHT, it would be useful to have BLOCK_TIMESTAMP, because block times can change and it's useful to make smart contract actions conditional on time as a concrete example, I'm looking at implementing a 'Harberger tax' smart contract for digital asset ownership, in which owners periodically engage in a kind of auction. but i don't want the auction period to be dependent on the block time. something like BLOCK_HEIGHT that just returns the unix timestamp of the last block would be ideal: the condition would be something like "on the first block after timestamp T, allow [or disallow] action A". action A would be something like "user makes a bid", but only within a particular time window. |
VALIDATE_SIGNATURE(DATA, SIGNATURE, ADDRESS) := returns TRUE if SIGNATURE is valid from ADDRESS on DATA, otherwise FALSE rationale: to perform smart contract actions on the basis of external data, it will often be necessary for some 'oracle' to supply the data. but we do not want to bloat the blockchain with storage of this data. alternatively, we can have the oracle sign the data (DATA) with a private key corresponding to a dero address (ADDRESS). the smart contract user can then supply the data DATA and the resulting signature SIGNATURE in the relevant smart contract call, and then the smart contract can validate the data by checking that the signature is valid using VALIDATE_SIGNATURE. the smart contract can then perform the desired action without requiring DATA to be stored by the oracle in the on-chain database. |
I also second the suggestion for permitting smart contract functions to call functions from other smart contracts. This allows some contract to supply services to other contracts which can consume them, and is a key ingredient in the vibrancy of the Ethereum ecosystem. See the links below. A related feature is the ability on Ethereum for a contract to deploy new contracts. Effectively, in Ethereum, smart contracts are no less powerful than human agents. https://dappsforbeginners.wordpress.com/tutorials/interactions-between-contracts/ |
Can I please make a feature request for two functions to be added to the Golang code:
The usage of these two functions would be proving that a given address has signed the hash of a string. To be clear, these functions are not DVM functions, but are Golang library functions for other software that imports dero. They would be used off-chain. |
|
FUNCTIONS TO ADD: Uint64 SC_DERO_BALANCE(): return dero balance in SC wallet Uint64 SC_TOKEN_BALANCE(): return token balance in SC wallet SEND_TOKEN_TO_ADDRESS(a String, amount Uint64): send token deposited in SC wallet BURN_SC_TOKEN or BURN_VALUE(amount Uint64): burn token deposited in SC wallet
BURN_SC_DERO or BURN_DERO(amount Uint64): burn token deposited in SC wallet
|
What was already mentioned but I would find really useful:
Additional (very important to me):
|
DVM(DERO Virtual Machine) Enhancements
Suggestions are invited for inbuilt functions for DERO Virtual Machine DVM which will enhance DVM and take it closer to some real use cases.
DERO Virtual Machine (DVM)
DERO Virtual Machine represents entire DERO Smart Contracts eco-system which runs on the DERO block chain.
Read more about DVM and DERO Smart Contracts.
DVM Documentation
DVM is a decentralized platform that runs both public and private smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.Public Smart contracts are open versions. However, the DVM is being designed to support Private Smart Contracts where everything is hidden, eg parties, and information involved. Smart Contracts are nothing but rules which apply on transacting parties.
Current version of DVM is an interpretor based system to avoid security vulneribilities, issues and compiler backdoors. This also allows easy audits of Smart Contracts for quality,bug-testing and security assurances. DVM supports a new language DVM-BASIC.
DVM apps run on a from scratch custom built privacy supporting, encrypted blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of assets/property without leaking any information.No one knows who owns what and who transferred to whom.
This enables developers to create puzzles, games, voting, markets, store registries of debts or promises, move funds in accordance with instructions given long in the past (like a will or a futures contract) and many other ideas/things that have not been invented yet, all without a middleman or counterparty risk.
DVM-BASIC is a contract-oriented, high-level language for implementing smart contracts. It is influenced by GW-BASIC, Visual Basic and C and is designed to target the DERO Virtual Machine (DVM). It is very easy to program and very readable.
DVM runs Smart Contracts which are a collection of functions written in DVM-BASIC.
These functions can be invoked over the blockchain to do something. SCs can act as libraries for other SCs.
DVM supports number of comments formats such as ', // , /* */ as good documentation is necessary.
Example Factorial program
DVM are written in a DVM-BASIC custom BASIC style language with line numbers.
DVM supports uint64 and string data-types.
DVM interprets the smart-contract and processes the SC line-line
uint64 supports almost all operators namely +,-,*,/,%
uint64 support following bitwise operators & ,|, ^, ! , >> , <<
uint64 supports following logical operators >, >= , <, <=, == , !=
string supports only + operator. string support concatenation with a uint64.
string supports ==, != logical operators.
All DVM variables are mandatory to define and are initialized to default values namely 0 and "".
A SC execution must return 0 to persist any changes made during execution. During execution, no panics should occur.
The text was updated successfully, but these errors were encountered: