swswsw / predictionmkt Goto Github PK
View Code? Open in Web Editor NEWprediction market on lotionjs with tendermint
License: MIT License
prediction market on lotionjs with tendermint
License: MIT License
right now, for testnet, the genesis token distribution is hardcoded.
separate this to a separate file so others can easily specify the genesis token amount.
balances in state is currently a js number. it has limitation on how large the number can be.
we cannot store js BigNumber in state, doing so cause various problems.
so we should store the number as string in the state.
everytime we use it, we should remember to convert it to bignumber.
evertime we store balance in state, we should remember to convert it to string representation.
allow user to use string to specify amount in input so big number can be used.
eg.
curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": 10, "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'
change the amount to string.
curl -X POST http://localhost:3000/txs -d '{"type": "bet", "marketId": "market2", "outcome": 1, "amount": "2000000000000", "user": "5wvwWgKP3Qfw1akQoXWg4NtKmzx5v4dTj"}'
everytime we read the amount, we should use
let amount = new BigNumber(inputAmount);
to make sure we convert it to bignumber.
there should be a minimum staking amount for challenge. if the challenge staking amount is lower than that, the challege is ignored
should the system take a commission on all prediction market?
then distribute that commission to all token owners.
when voting, there should be a minimum staking amount. staking amount smaller than that is ignored.
to make sure the tx is coming from the user with the valid authority for the action (eg. he can only move his own fund), the system will require the user to provide the signature.
the tx will have this kind of scheme:
{"type": "bet", "amount": 10}
the signature will sign the entire thing + seq.
seq is sequence number. it must be increasing. the system will not accept the same sequence number or a lower sequence number, so the old tx cannot be replayed.
cleanup should only be performed n block after distribute is done.
it might be possible for one chain to act as oracle for the main chain.
so we should think of a way to allow main chain to use the prediction market result as oracle.
perhaps make the result into a token so that it can be transferred to main chain. token can be transferred on cosmos across chain. so perhaps we can use tokenized result as a way to use prediction market result from this chain.
set flag.
is concurrency an issue?
to make a challenge, the challenge must stake at this x amount of tokens.
x to be determined later.
also check if they have enough balances
some bitcoin people are worried that people are not going to run full node as there is no incentive to run full node.
zencash seems to make rewarding node works. zencash has a masternode system where the masternode gets paid. you need to stake certain amount of tokens to run masternode, but masternode get paid.
zencash has ~8000 nodes, compared to bitcoin's 11000 nodes.
we need to limit the input size, range, etc.
eg. if there is a string, we need to give string length range
eg. if it is a number, we need to check for valid range
add sequence to the tx.
record the sequence in the state (perhaps with the balance). whenever a valid tx is made, sequence is incremented. a valid tx will need to match the current sequence number in the state.
distribution logic is for demo only so far. need to implement
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.