Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ lib-profile-release = "wasm-release"

[dependencies]
itertools = "0.13.0"
simfony = { git = "https://github.com/uncomputable/simfony", rev = "d5284014e9f67593e50b272f1f676ea8d09f6ec8" }
#simplicityhl = "0.2.0"
simplicityhl = { package = "simfony", git = "https://github.com/BlockstreamResearch/simplicityhl", rev = "d5284014e9f67593e50b272f1f676ea8d09f6ec8" }
leptos = { version = "0.6.14", features = ["csr"] }
leptos_router = { version = "0.6.15", features = ["csr"] }
console_error_panic_hook = "0.1.7"
hex-conservative = "0.2.1"
js-sys = "0.3.70"
web-sys = { version = "0.3.70", features = ["Navigator", "Clipboard", "Storage"] }
web-sys = { version = "0.3.70", features = [
"Navigator",
"Clipboard",
"Storage",
] }
wasm-bindgen-futures = "0.4.43"
gloo-timers = { version = "0.3.0", features = ["futures"] }
gloo-net = "0.6.0"
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Stage 1: Builder
# This stage installs all dependencies and builds the application.
FROM debian:bookworm-slim AS builder

# Install essential build tools, clang, and nodejs for sass
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
clang-16 \
llvm-16 \
curl \
pkg-config \
libssl-dev \
ca-certificates \
nodejs \
npm && \
rm -rf /var/lib/apt/lists/*

# Install Rust and the wasm32 target
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable && \
rustup target add wasm32-unknown-unknown

# Install Trunk and Dart Sass
RUN cargo install trunk && \
npm install -g sass

# Set environment variables for the Wasm C compiler, mimicking the Nix setup.
# This tells Rust's build scripts to use clang-16 when compiling C code for Wasm.
ENV CC_wasm32_unknown_unknown=clang-16
ENV AR_wasm32_unknown_unknown=llvm-ar-16
ENV CFLAGS_wasm32_unknown_unknown="-I/usr/lib/clang/16/include"

# Copy the application source code
WORKDIR /app
COPY . .

# Build the application
RUN trunk build --release && \
sh fix-links.sh

# Stage 2: Final Image
# This stage creates a minimal image to serve the built static files.
FROM nginx:1.27-alpine-slim

# Copy the built assets from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html

# Expose port 80 and start Nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# Simfony Web IDE
# SimplicityHL Web IDE

[Simfony](https://github.com/BlockstreamResearch/simfony) is a high-level language for writing Bitcoin smart contracts.
[SimplicityHL](https://github.com/BlockstreamResearch/simplicityhl) is a high-level language for writing Bitcoin smart contracts.

Simfony looks and feels like [Rust](https://www.rust-lang.org). Just how Rust compiles down to assembly language, Simfony compiles down to Simplicity bytecode. Developers write Simfony, full nodes execute Simplicity.
SimplicityHL looks and feels like [Rust](https://www.rust-lang.org). Just how Rust compiles down to assembly language, SimplicityHL compiles down to Simplicity bytecode. Developers write SimplicityHL, full nodes execute Simplicity.

[A live demo is running on GitHub pages](https://simfony.dev).
[A live demo is running](https://ide.simplicity-lang.org).

## Develop the project

### Install dependencies
### Using Docker

Build
```
docker build -t simplicity-webide .
```

Run and naviate to `http://localhost:8080` in your web browser.
```
docker run -p 8080:80 simplicity-webide
```

### Using Nix

First install nix.

Expand Down
36 changes: 18 additions & 18 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
# How to make a transaction using the web IDE

The Simfony web IDE can only make a restricted form of transaction: There is 1 transaction input, 1 transaction output and 1 fee output _(Liquid has explicit fee outputs)_. Confidential transactions or assets other than Bitcoin are not supported.
The SimplicityHL web IDE can only make a restricted form of transaction: There is 1 transaction input, 1 transaction output and 1 fee output _(Liquid has explicit fee outputs)_. Confidential transactions or assets other than Bitcoin are not supported.

![Screenshot of mempool.space](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/mempool1.png)
![Screenshot of mempool.space](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/mempool1.png)

## Write the main function

Open [the Simfony web IDE](https://simfony.dev/) and write the main function of your program.
Open [the SimplicityHL web IDE](https://ide.simplicity-lang.org/) and write the main function of your program.

_You can leave the default main function as it is. Customize it if you want._

![Screenshot of the web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide0.png)
![Screenshot of the web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide0.png)

## Generate an address

Click the "Address" button to copy the address of your program to the clipboard.

Leave the web IDE tab open. You will need it later.

![Screenshot of the web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide1.png)
![Screenshot of the web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide1.png)

## Fund the address

Paste the address into [the Liquid testnet faucet](https://liquidtestnet.com/faucet) and press the "Send assets" button.

![Screenshot of the Liquid testnet faucet](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/faucet1.png)
![Screenshot of the Liquid testnet faucet](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/faucet1.png)

Copy the ID of the funding transaction to your clipboard.

![Screenshot of the Liquid testnet faucet](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/faucet2.png)
![Screenshot of the Liquid testnet faucet](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/faucet2.png)

## Look up the funding transaction

Paste the ID of the funding transaction into the [Blockstream Explorer for Liquid testnet](https://blockstream.info/liquidtestnet/).

![Screenshot of the Blockstream Explorer](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/esplora1.png)
![Screenshot of the Blockstream Explorer](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/esplora1.png)

Scroll down and find the Simfony UTXO. The Liquid testnet faucet always sends 100000 tL-BTC. In our example, the Simfony UTXO is vout = 1.
Scroll down and find the SimplicityHL UTXO. The Liquid testnet faucet always sends 100000 tL-BTC. In our example, the SimplicityHL UTXO is vout = 1.

![Screenshot of the Blockstream Explorer](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/esplora2.png)
![Screenshot of the Blockstream Explorer](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/esplora2.png)

## Enter UTXO data into the web IDE

Enter the ID of the funding transaction and the vout into the web IDE.

_You can leave the remaining fields as they are. Feel free to customize._

![Screenshot of the Simfony web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide2.png)
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide2.png)

## Sign the spending transaction

Click the "Sig 0" button to generate a signature for a transaction that spends the Simfony UTXO.
Click the "Sig 0" button to generate a signature for a transaction that spends the SimplicityHL UTXO.

![Screenshot of the Simfony web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide3.png)
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide3.png)

Paste the signature into the `mod witness {...}` section.

![Screenshot of the Simfony web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide4.png)
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide4.png)

## Generate the spending transaction

Click the "Transaction" button to copy the spending transaction to your clipboard.

![Screenshot of the Simfony web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/webide5.png)
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/webide5.png)

## Broadcast the spending transaction

Paste the spending transaction into the [Blockstream Liquid testnet explorer](https://blockstream.info/liquidtestnet/tx/push) and click the "Broadcast transaction" button.

![Screenshot of the Simfony web IDE](https://raw.githubusercontent.com/uncomputable/simfony-webide/master/doc/esplora3.png)
![Screenshot of the SimplicityHL web IDE](https://raw.githubusercontent.com/BlockstreamResearch/simplicity-webide/master/doc/esplora3.png)

If everything worked, the explorer will open the broadcast transaction. In this case, congratulations, you made a Simfony transaction on Liquid testnet!!! You can also look up your transaction on [mempool.space](https://liquid.network/testnet).
If everything worked, the explorer will open the broadcast transaction. In this case, congratulations, you made a SimplicityHL transaction on Liquid testnet!!! You can also look up your transaction on [mempool.space](https://liquid.network/testnet).

If you see an error message, take a look at the following "Troubleshooting" section.

Expand Down Expand Up @@ -126,7 +126,7 @@ The fee consumes the entire input value. Decrease the fee.

A Simplicity jet fails.

Double-check the conditions that your Simfony program enforces. Update the witness data or transaction parameters.
Double-check the conditions that your SimplicityHL program enforces. Update the witness data or transaction parameters.

Every time you change the transaction parameters, the signature hash of the transaction changes. In this case, you need to **regenerate signatures** using the "Key Store" tab.

Expand Down
2 changes: 1 addition & 1 deletion src/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn Footer() -> impl IntoView {
<a href="https://t.me/simplicity_community" class="footer-social-link">
<img src="images/telegram.svg" alt="Telegram Icon" class="footer-social-icon" />
</a>
<a href="https://github.com/BlockstreamResearch/simfony" class="footer-social-link">
<a href="https://github.com/BlockstreamResearch/simplicityhl" class="footer-social-link">
<img src="images/github.svg" alt="GitHub Icon" class="footer-social-icon" />
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use js_sys::{Array, Object};
use leptos::*;
use simfony::simplicity;
use simplicityhl::simplicity;
use simplicity::dag::DagLike;
use simplicity::dag::NoSharing;
use simplicity::node;
Expand Down
4 changes: 2 additions & 2 deletions src/components/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn Navigation() -> impl IntoView {
<div class="navigation-dropdown-title">"Whitepaper"</div>
<div class="navigation-dropdown-description">"The original Simplicity whitepaper, detailing the language."</div>
</a>
<a href="https://docs.rs/simfony-as-rust" target="_blank" rel="noopener noreferrer" class="navigation-dropdown-item">
<a href="https://docs.rs/simplicityhl-as-rust" target="_blank" rel="noopener noreferrer" class="navigation-dropdown-item">
<div class="navigation-dropdown-title">"Jets Documentation"</div>
<div class="navigation-dropdown-description">"Technical reference detailing each jet's functionality and use."</div>
</a>
Expand Down Expand Up @@ -140,7 +140,7 @@ pub fn Navigation() -> impl IntoView {
class:active=move || docs_open.get()
>
<a href="https://blockstream.com/simplicity.pdf" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Whitepaper"</a>
<a href="https://docs.rs/simfony-as-rust" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Jets Documentation"</a>
<a href="https://docs.rs/simplicityhl-as-rust" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Jets Documentation"</a>
<a href="https://docs.simplicity-lang.org/" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"SimplicityHL"</a>
<a href="https://github.com/BlockstreamResearch/SimplicityHL/tree/master/examples" target="_blank" rel="noopener noreferrer" class="navigation-mobile-dropdown-item" on:click=close_mobile_menu>"Contract Examples"</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/program_window/help_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use leptos::{component, view, IntoView};
#[component]
pub fn HelpButton() -> impl IntoView {
view! {
<form action="https://github.com/uncomputable/simfony-webide/blob/master/doc/README.md" target="_blank">
<form action="https://github.com/BlockstreamResearch/simplicity-webide/blob/master/doc/README.md" target="_blank">
<button class="button" type="submit">
" Help"
</button>
Expand Down
10 changes: 5 additions & 5 deletions src/components/program_window/program_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use leptos::{
use_context, view, IntoView, RwSignal, Signal, SignalGetUntracked, SignalSet, SignalUpdate,
SignalWith, SignalWithUntracked,
};
use simfony::parse::ParseFromStr;
use simfony::simplicity::jet::elements::ElementsEnv;
use simfony::{elements, simplicity};
use simfony::{CompiledProgram, SatisfiedProgram, WitnessValues};
use simplicityhl::parse::ParseFromStr;
use simplicityhl::simplicity::jet::elements::ElementsEnv;
use simplicityhl::{elements, simplicity};
use simplicityhl::{CompiledProgram, SatisfiedProgram, WitnessValues};

use crate::components::copy_to_clipboard::CopyToClipboard;
use crate::function::Runner;
Expand Down Expand Up @@ -64,7 +64,7 @@ impl Program {
}
self.text.with_untracked(|text| {
self.cached_text.set(text.clone());
let compiled = simfony::Arguments::parse_from_str(text)
let compiled = simplicityhl::Arguments::parse_from_str(text)
.map_err(|error| error.to_string())
.and_then(|args| CompiledProgram::new(text.as_str(), args));
let cmr = compiled
Expand Down
2 changes: 1 addition & 1 deletion src/components/program_window/transaction_button.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use elements::pset::serialize::Serialize;
use hex_conservative::DisplayHex;
use leptos::{component, use_context, view, with, IntoView};
use simfony::elements;
use simplicityhl::elements;

use crate::components::copy_to_clipboard::CopyToClipboard;
use crate::components::program_window::Program;
Expand Down
2 changes: 1 addition & 1 deletion src/components/run_window/hash_store_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use leptos::{
component, create_rw_signal, use_context, view, For, IntoView, RwSignal, SignalGet,
SignalUpdate, View,
};
use simfony::elements::hashes;
use simplicityhl::elements::hashes;

use crate::components::copy_to_clipboard::CopyToClipboard;
use crate::util::{Counter26, HashedData};
Expand Down
2 changes: 1 addition & 1 deletion src/components/run_window/key_store_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use leptos::{
IntoView, NodeRef, RwSignal, Signal, SignalGet, SignalGetUntracked, SignalSet, SignalUpdate,
SignalWith, View,
};
use simfony::{elements, simplicity};
use simplicityhl::{elements, simplicity};

use crate::components::copy_to_clipboard::CopyToClipboard;
use crate::util::{Counter26, SigningKeys};
Expand Down
2 changes: 1 addition & 1 deletion src/components/run_window/transaction_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use leptos::{
component, create_rw_signal, ev, event_target_value, use_context, view, with, Children,
IntoView, RwSignal, Signal, SignalGetUntracked, SignalSet, SignalUpdate,
};
use simfony::{elements, simplicity};
use simplicity::jet::elements::ElementsEnv;
use simplicityhl::{elements, simplicity};

use crate::components::program_window::Program;
use crate::components::string_box::ErrorBox;
Expand Down
2 changes: 1 addition & 1 deletion src/components/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use leptos::{use_context, SignalGetUntracked, SignalWithUntracked};
use simfony::num::U256;
use simplicityhl::num::U256;
use web_sys::window;

use crate::components::program_window::Program;
Expand Down
Loading
Loading