-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
13,561 additions
and
3,257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# name: Deploy Docusaurus site to GitHub Pages | ||
|
||
# on: | ||
# push: | ||
# branches: | ||
# - main # or the branch you want to deploy from | ||
|
||
# jobs: | ||
# build-deploy: | ||
# runs-on: ubuntu-latest | ||
# defaults: | ||
# run: | ||
# working-directory: docs | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v3 | ||
# with: | ||
# submodules: true | ||
|
||
# - name: Setup Node.js | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: '16.x' # Ensure this matches your project's Node.js version | ||
|
||
# - name: Install dependencies | ||
# run: npm install | ||
|
||
# - name: Build Docusaurus site | ||
# run: npm run build | ||
|
||
# - name: Deploy to GitHub Pages | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# @notemine/core | ||
**notemine** mines nostr notes, is written in rust, targets web and compiles to wasm. Variable difficulty and realtime hashrate. There's a [demo](https://sandwichfarm.github.io/notemine). | ||
|
||
# related | ||
- [`notemine-js`](https://github.com/sandwichfarm/notemine-js) is an npm module that wraps this package with observables for use with modern stacks. | ||
- [`notemine-hw`](https://github.com/plebemineira/notemine_hw) is a fork ported to a cli application that leverages hardware acceleration | ||
|
||
# install | ||
```js | ||
npm install notemine | ||
pnpm install notemine | ||
yarn add notemine | ||
``` | ||
|
||
# usage | ||
```js | ||
import init, { mine_event } from './pkg/notemine.js'; | ||
|
||
//You shouldn't need to pass id or sig, and created_at is optional. | ||
const event = { | ||
"pubkey": "e771af0b05c8e95fcdf6feb3500544d2fb1ccd384788e9f490bb3ee28e8ed66f", | ||
"kind": 1, | ||
"tags": [], | ||
"content": "hello world", | ||
} | ||
|
||
const difficulty = 21 | ||
let cancel = false | ||
|
||
function reportProgress(hashRate = undefined, bestPow = undefined) { | ||
if(hashRate){ | ||
console.log(`hash rate: ${hashRate}`); | ||
} | ||
if(bestPow){ | ||
console.log('best pow: ', bestPow); | ||
} | ||
} | ||
|
||
function shouldCancel() { | ||
//Add some logic here | ||
//if it returns true, wasm should stop mining. | ||
return cancel | ||
} | ||
|
||
const run = async () => { | ||
//this is synchronous. | ||
const minedResult = mine_event( | ||
event, | ||
difficulty, | ||
startNonce.toString(), | ||
nonceStep.toString(), | ||
reportProgress, | ||
shouldCancel | ||
); | ||
} | ||
await init({}); | ||
``` | ||
|
||
# build | ||
|
||
## deps | ||
``` | ||
cargo install wasm-pack | ||
``` | ||
|
||
## build | ||
``` | ||
cargo clean | ||
wasm-pack build --target web --release | ||
``` | ||
|
||
## run demo | ||
``` | ||
cd demo && npx serve | ||
``` | ||
|
||
# license | ||
GNU General Public License v3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# notemine⛏️ | ||
|
||
**notemine** mines nostr notes, is written in rust, targets web and compiles to wasm. Variable difficulty and realtime hashrate. There's some [demos](https://sandwichfarm.github.io/notemine). | ||
|
||
## Packages: | ||
- [`@notemine/core`](./packages/core/) - It is in here you find the `rust` source for the moner. Build step generates JS Bindings, type declarations and wasm file via `wasm-bindgen`. The base of all packages in this monorepo. | ||
- [`@notemine/wrapper`](./packages/wrapper/) - A user-friendly wrapper for `@notemine/core` that greatly simplifies usage in modern stacks and deployments with modern bundlers. Provides observables, manages workers, tracks internal state and bundles wasm as _inline base64_ within _inline_ web-workers for hassle-free use in modern apps targeted for the browser. | ||
- _[`@notemine/svelte`](./packages/svelte/)_ [coming soon] - Library optimized for Svelte that exports stores and components for hassle-free use in svelte projects. | ||
- _[`@notemine/reactjs`](./packages/reactjs/)_ [coming soon] - Library optimized for ReactJS that exports stores and components for hassle-free use in svelte projects. | ||
|
||
## Demos: | ||
- [`@notemine/vanilla-js-demo`](./demos/vanilla-js/) - Demo of Notemine written with vanilla Javascript, HTML and CSS that implements `@notemine/core`. No bundlers. | ||
- [`@notemine/svelte-demo`](./demos/svelte/) - Vanilla JS Demo Ported to Svelte that implements `@notemine/wrapper` (note: future version will implement `@notemine/svelte`) | ||
|
||
## Contrib | ||
`@notemine` monorepo presently uses `yarn workspaces` without any monorepo toolkit (pending). Recommended to use `yarn v2` until monorepo is fully configured. | ||
``` | ||
yarn install | ||
``` | ||
|
||
Use workspace commands: | ||
``` | ||
yarn workspace @notemine/wrapper ... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@notemine/reactjs` | ||
|
||
Future home of `notemine` for ReactJS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# @notemine/rust | ||
Rust source code for **notemine** that compiles to WASM. | ||
|
||
# deps | ||
``` | ||
cargo install wasm-pack | ||
``` | ||
|
||
# build | ||
``` | ||
cargo clean | ||
wasm-pack build --target web --release | ||
``` | ||
|
||
# license | ||
GNU General Public License v3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@notemine/svelte` | ||
|
||
Future home of `notemine` for svelte. |
Oops, something went wrong.