oaxfoundation / parrot Goto Github PK
View Code? Open in Web Editor NEWSubstrate based blockchain intended for Polkadot Network
License: GNU General Public License v3.0
Substrate based blockchain intended for Polkadot Network
License: GNU General Public License v3.0
For the multi-transfer of the native token, I think a better architecture would be to expand the balances pallet and add an extra function to it, instead of adding a whole new runtime module due to the various overheads this causes for a node.
However I have had no success in figuring out the correct syntax to do this, especially since there has now been a new change in subtrate-node-template. Will need to look into this in the future when we have time to clean up.
Traditional blockchains have an API to transfer tokens between wallets. Swaps involve two transfers and atomic swaps are done to ensure that both legs of a swap is guaranteed. Atomic swaps are done using smart contracts involving the swap of two distinct tokens. In the case of a swap between two ERC20 tokens, the chain for both tokens is Ethereum but it still requires two transactions.
A native swap SRM would provide the same guaranteed execution but in one transaction instead of two.
Note that this AtomicSwap implies that we implement ERC20 tokens on our chain. This swap would not work for a swap between OAX Chain and another Polkadot chain (until we find out more about how Polkadot interoperability via bridges work).
API signature:
atomicSwap(tokenA, walletAddressA, sigA, amountA, expiry, tokenB, walletAddressB, sigB, amountB)
This function requires signatures from both parties. Party A signs the atomicSwap message (setting an expiry) and passes message to Party B to sign and submit to the blockchain. The expiry field works to prevent Party B from holding the signed message for an unreasonable amount of time before trying to perform a swap.
Atomic Swap Tests
Our development shows that substrate doesn't charge gas fees on txns. Turn it on and make the amount configurable. Set to 0.1% as per our tokenonmics slide.
Currently our runtimes are designed to be called directly by users. This means their is no way for smart contract developers to charge a fee since the calls are directly from the user straight to the runtime methods.
We may need to explore how to either modify the runtime methods to be more useful for the dapp developers through the use of smart contracts, or look if its possible to build a system where DAPP devs are still economically incentivized to use these runtime methods.
The expiresAfter field is a numeric field indicating number of blocks this transaction is willing to wait for confirmation before expiring. Afterwhich, the transaction is failed (this failure has a gas cost to prevent spam).
To avoid too many pending transactions in the mempool if spammers send many transactions with a very large expiresAfter value, the maximum value of expiresAfter is 200 (this roughly equates to 26 minutes based on an 8s block time).
Expires Tests
Substrate has native functionality to remove accounts with small balances. Where do those balances go?
Our initial proposal was to reward 80% of the chain's gas fees to collators and then burn the other 20%.
[ ] Determine where/how fees are rewarded to collators and ensure it's customizable
[ ] We need to setup a testnet with multiple collators
Allow developers to batch multiple transactions (be it payments or contract calls) into one for cheaper gas cost. The idea is that the message size of this batched transaction should be smaller due to fewer repeated fields (such as the from address which would be identical for each inner transaction), resulting in lower gas cost.
This is NOT an atomic transaction as we do not ensure that all transactions are successful or they get rolled back. Thus, some inner transactions could fail but the others would remain committed.
Developers can utilize this to batch an ERC20 approve() and send(). Albeit, this wouldn’t be an atomic transaction, it still simplifies the interaction for the user as they only need to sign one transaction.
Multiple Transactions Tests
get CI builds working with Travis
Add an additional dependsOn field to the Transaction structure which can contain the transaction ID of another transaction. Transaction ID is a hash of the transaction. This tells the Substrate runtime to only execute this transaction if the dependsOn transaction has been successful. Note that dependsOn only guarantees the successful execution of the first transaction (the one specified in dependsOn field) but does not guarantee this current transaction is successful.
When using dependsOn, the developer must also set Expires to avoid the transaction waiting forever.
DependsOn Tests
Putting our node into a docker container might enable us to add an nginx proxy in front of it to overcome the localhost limitation
Our initial proposal was to reward 80% of the chain's gas fees to collators and then burn the other 20%.
Implement this auto burn feature and also track how much has been burnt for display purposes.
Fee delegation allows the gas cost of a transaction to be paid by someone other than the user.
This feature eases adoption for DApps because users do not need to have native OAX tokens in order to transact with the OAX Chain. Users not having to have a particular token to pay for gas removes a significant hurdle for DApp adoption. Imagine going to a DEX to trade your ABC token for XYZ; and then finding out you also need LOL token to pay for the trade?
DEX operators could also use it to provide no-fee limit orders but charge fees for market orders; encouraging participants to add liquidity rather than taking it away.
Blockchain transactions need to support a second signature field. If a third party (typically the DApp operator) wishes to pay the fee for a transaction, they must sign the newly introduced “gas payer signature” field. To do so, we must extend Substrate’s Extrinsic data type (Rust trait) to support a second signature.
Fee Delegation Tests
Make sure the event notification contains token id or else user doesn't know which token is theirs (not without some hacks in querying token id balances).
The multiTransfer event currently does not broadcast the senders address.
@waylandc suggested adding tokenName into the runtime
rustfmt can't handle macros properly, so the formatting for most of the rust files are not clean. We also exceed 80 chars in many lines since this seems to be normal in the node-template, however is undesired.
current PoC code doesn't use a nonce
Currently a user can initialize a multi transfer with over 1000 individual sends in a single transaction. Since nodes need to gossip, validate and then execute each transaction, this may slow things down without having a limit. A potential simple solution would be setting a limit for his.
As a bridge until Polkadot interoperability is a reality, we need a representation of other parachain tokens to enable swaps.
Implement the ERC20 equivalent standard as a pallet/frame.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.