Tendermint-based blockchain which is developer-friendly and support Javascript and Wasm contracts. There's more to come, stay tune!
NOTE: this project is under active development. Don't use it for production.
- NodeJS v12 LTS
- Tendermint latest release
tendermint init
Open ~/.tendermint/config/config.toml
.
Search for index_tags
and set like this:
index_keys = "tx.hash,tx.height"
It is better to set create_empty_blocks
to false
, or you'll get ton of blocks.
create_empty_blocks = false
- clone repo
- Rename
.env.example
to.env
and.env.dev.example
to.env.dev
npm install
tendermint node
- Open another terminal window and
npm start
-> this starts the icetea server - Open another terminal window and
npm run app
-> this starts a sample block explorer and wallet
To reset tendermint (delete all blocks & state), use npm run reset
.
@contract class Withdraw {
@state fund = {}
@onreceive @payable receive() {
this.fund[msg.sender] = (this.fund[msg.sender] || 0) + msg.value
}
@transaction withdraw() {
const available = this.fund[msg.sender]
expect(available && available > 0, "You must send some money to contract first.")
expect(this.balance > 0, "Contract out of money, please come back later.")
const amount = available < this.balance ? available : this.balance
this.fund[msg.sender] = available - amount
this.transfer(msg.sender, amount)
this.emitEvent("Withdrawn", { withdrawer: msg.sender, amount })
}
@transaction backdoor(value: ?number = this.balance) {
expect(msg.sender === this.deployedBy, "Only owner can use this backdoor.")
this.transfer(msg.sender, value)
}
}
More sample contracts are available in example folder.
Check out our guide here https://github.com/TradaTech/icetea/wiki/Javascript-smart-contract