p2pcloud.io is a protocol and utility set for booking and securing trustless virtual machines over the blockchain.
- All implementations should be in the implementations folder in a separate subfolder;
- All implementations should comply with
BlockchainIface
; - Good test coverage with edge cases;
- Deliver changes through pull reqeusts.
Compile contracts
go run ./cmd/compile/
Test:
go test ./...
Undertested and a bit messy
There are 3 actors - miner, user and community. User books and pays for VM. Miner runs VMs. Community gets comission from every VM booking.
- Broker contract. Facilitates deals between miners and users.
- Community contract. Some contract used to vote on SDK and protocol updates. Also accepts and distributes fees. Not implemented yet.
- Satblecoin contract. Some external stablecoin, probably USDC. May be replaced.
- Miner creates offer setting type and price of VM per second
- Functions:
getMinersOffers
,updateOffer
,addOffer
- Functions:
- User sends a stablecoin to the Broker. All stablecoin is split between free and locked states.
- Tasks: Deposit and withdraw steblecoin, Check stablecoin balance
- Functions:
depositCoin
,checkBalance
,withdrawCoin
- User gets list of offers
- Functions:
getAvailableOffers
- Functions:
- User books VM. His stablecoin gets locked.
- User aborts booking because of miners misbehaviour. Unused stablecoin gets unlocked. Miner gets paid 1/2 of the price. The rest 1/2 goes into the community. Booking gets deleted.
- Functions:
reportBooking
- Events:
bookingReported
- Tasks: Emit bookingReported event with bookingId, timeUsed, miner, user and vmType fields
- Functions:
- User aborts booking, but no problems with miner. Unused stablecoin gets unlocked. Miner gets paid 95% of the price. The rest 5% goes into the community. Booking gets deleted.
- Functions:
stopBooking
- Events:
bookingStopped
- Tasks: Emit bookingStopped event with bookingId, timeUsed, miner, user and vmType fields
- Functions:
- User extends booking. More stablecoin gets locked. New PPS is used. No checks for slot availability.
- User does nothing and booking expires.
- Miner claims expired booking. Miner gets paid 95% of the price. The rest 5% goes into the community. Booking gets deleted.
- Functions:
claimBookingFinished
- Tasks: claimBookingFinished function
- Functions:
Events are used to calculate miner's reputation.
- Stablecoin address. Set is callable only by community contract/wallet.
- Functions:
setStablecoinAddress
,getStablecoinAddress
- Tasks: Set and get stablecoin address Propose logic of work in case stablecoin address is changed during active vm bookings
- Functions:
- Community wallet/contract address. Set is callable only by community contract/wallet. Just a regular wallet for now.
- Functions:
setCommunityContract
,getCommunityContract
- Tasks: Set and get community address
- Functions:
- Community fee. 5% for now.
- Functions:
setCommunityFee
,getCommunityFee
- Tasks: Set and get community fee
- Functions: