Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/payment_channel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore build artifacts from the local tests sub-crate.
/target/

# Ignore backup files creates by cargo fmt.
**/*.rs.bk

# Remove Cargo.lock when creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock
41 changes: 41 additions & 0 deletions examples/payment_channel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[package]
name = "payment_channel"
version = "3.0.1"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
publish = false

[dependencies]
ink_primitives = { version = "3.0.1", path = "../../crates/primitives", default-features = false }
ink_metadata = { version = "3.0.1", path = "../../crates/metadata", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "3.0.1", path = "../../crates/env", default-features = false }
ink_storage = { version = "3.0.1", path = "../../crates/storage", default-features = false }
ink_lang = { version = "3.0.1", path = "../../crates/lang", default-features = false }

eth = { package="ink_eth_compatibility", version = "3.0.1", path="../../crates/eth_compatibility", default-features = false }
hex-literal = { version = "0.3" }

scale = { package = "parity-scale-codec", version = "3.1.2", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }

sp-core = { version = "6.0.0", default-features = false }

[lib]
name = "payment_channel"
path = "lib.rs"
crate-type = ["cdylib"]

[features]
default = ["std"]
std = [
"ink_metadata/std",
"ink_env/std",
"ink_storage/std",
"ink_primitives/std",
"scale/std",
"scale-info/std",
"sp-core/std",
"eth/std",
]

ink-as-dependency = []
13 changes: 13 additions & 0 deletions examples/payment_channel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Payment Channel Example

## What is this example about?

It demonstrates a payment channel in ink!.

The implementation is based on [this post](https://programtheblockchain.com/posts/2018/03/02/building-long-lived-payment-channels/)
which has an implementation in Solidity.

## On-Chain Deployment

`ink_env::ecdsa_recover()` uses an [unstable interface](https://github.com/paritytech/substrate/tree/master/frame/contracts#unstable-interfaces)
of the contracts pallet. The unstable interfaces needs to be enabled for it to work on-chain.
Loading