Example worker for ethereum-based applications

Overview

Ethsig-rs

Example worker for ethereum-based applications.

Features:

  • Verify arbitrary messages and their signature from an Ethereum Address
  • Verify EIP-4361-based signature and message. This is used for the Sign-in-with-Ethereum (SIWE) standard.

that uses ethers-rs and Cloudflare workers to create an endpoint that verifies signed messages with an Ethereum address.

Usage

With wrangler, you can build, test, and deploy your Worker with the following commands:

# compiles your project to WebAssembly and will warn of any issues
wrangler build

# run your Worker in an ideal development workflow (with a local server, file watcher & more)
wrangler dev

# deploy your Worker globally to the Cloudflare network (update your wrangler.toml file for configuration)
wrangler publish

Read the latest worker crate documentation here: https://docs.rs/worker

WebAssembly

workers-rs (the Rust SDK for Cloudflare Workers used in this template) is meant to be executed as compiled WebAssembly, and as such so must all the code you write and depend upon. All crates and modules used in Rust-based Workers projects have to compile to the wasm32-unknown-unknown triple.

Read more about this on the workers-rs project README.

Comments
  • Started typing codebase

    Started typing codebase

    I started giving types to the codebase using type hinting since python3.5 supports them and python3.5 is the minimum version required by the library.

    I started with serializers and compressors.

    I have some doubts about the client, specifically about key, version and prefix.

    Redis supports everything that can be byte encoded like stated here https://redis.io/topics/data-types-intro

    Redis keys are binary safe, this means that you can use any binary sequence as a key, from a string like "foo" to the content of a JPEG file. The empty string is also a valid key.
    

    But other caches like memcached and django own BaseCache seem to point to key and prefix being a string and version an integer.

    My question is, leaving Any instead of a more specific type or to enforce the types that I just mentioned?

    By the way django-stubs here https://github.com/typeddjango/django-stubs/blob/master/django-stubs/core/cache/backends/base.pyi have specific types in some methods and on some not.

    opened by WisdomPill 25
  • Split linters

    Split linters

    • split linters
    • fixed cache hash
    • added cache for lint job
    opened by WisdomPill 24
  • django-redis is incompatible with redis-py >= 3

    django-redis is incompatible with redis-py >= 3

    From the redis-py release notes:

    Only bytes, strings and numbers (ints, longs and floats) are acceptable for keys and values.

    See https://github.com/andymccurdy/redis-py/blob/9b03af26dc829beea232a3248768de933f4c3b67/CHANGES#L9-L15

    The CacheKey class used by django-redis is no longer supported.

    I'm happy to open a PR, but I wanted to ask first if it's better to drop CacheKey or to cast keys to strings right before sending them to redis-py? The latter would be more work, but retain the intended use of CacheKey:

    A stub string class that we can use to check if a key was created already.

    opened by michael-k 24
  • add redis sentinel support

    add redis sentinel support

    I know that there were multiple requests, and most of them were denied since the primary author was not working with sentinel. Now that this project got passed to JazzBand, would it be possible to request sentinel support for this project?

    enhancement help needed 
    opened by L1ghtman2k 21
  • package naming is confusing

    package naming is confusing

    pypi name is django-redis python package is redis_cache

    there is another pypi package called django-redis-cache

    opened by stefanfoulis 20
  • adjust GitHub actions and tox config

    adjust GitHub actions and tox config

    Changes to GitHub actions:

    • The service definition was duplicated on squash
    • Merge lint and test workflow files into ci.yml
    • Update for Django 3.2 and only test unreleased library versions with Python 3.9 to limit permutations
    • Move redis sentinel startup to a script to more easily use in local development

    Changes to README:

    • Fix the GitHub badge definition

    Changes to tests and testing environment:

    • Move tox config to setup.cfg
    • Remove runtest-*.py wrappers in favor of using runtest.py --settings=<settings>
    • Move test settings into their own directory
    • Fix unix socket tests

    x-ref: https://github.com/ymyzk/tox-gh-actions/pull/60 will remove the need for lint-dj31-redislatest

    opened by terencehonles 19
  • URL notation in LOCATION

    URL notation in LOCATION

    Hi,

    Since this package uses redis-py under the hood, I think it would be better to support the URL notation of the redis-py package directly in LOCATION instead of defining a new notation.

    For example: django-redis: unix:/path/to/socket:1 redis-py: unix:///path/to/socket?db=1

    django-redis: 127.0.0.1:6379:1 redis-py: redis://127.0.0.1:6379/1

    redis-py URL notation:

    redis://[:password]@localhost:6379/0
    rediss://[:password]@localhost:6379/0
    unix://[:password]@/path/to/socket.sock?db=0
    

    Details here: https://github.com/andymccurdy/redis-py/blob/master/redis/connection.py#L733 There is no need to develop anything, the URL can just be passed to the redis client/connection pool.

    What do you think?

    Thanks

    enhancement 
    opened by YAmikep 18
  • New maintainer needed.

    New maintainer needed.

    Hi,

    Unfortunatelly or not i'm no longer using python on my daily job and right now i dont have time to maintain this package. So for not just abandon it, i'm looking for a new maintainer.

    help needed 
    opened by niwinz 17
  • refactor: ensure close method is thread safe closes #491

    refactor: ensure close method is thread safe closes #491

    call the method disconnect of ConnectionPool instead of modifying protected attribute

    opened by AnesFoufa 17
  • Fix incr_version of key with no expiration

    Fix incr_version of key with no expiration

    Fixes version increment of keys with no expiration, that were previously wrongly deleted

    fixes: #483

    opened by WisdomPill 16
  • Using sentinel config hangs for many seconds if one or more sentinels are down

    Using sentinel config hangs for many seconds if one or more sentinels are down

    Due to a poorly configured socket_timeout for the connection to the sentinels, the connection may hang for many seconds or even minutes when one ore more of the configured sentinels are down. Then the django cache hangs for the same time causing http timeouts for users. This is bad, as the purpose of using sentinels is that something can go down without the user noticing.

    A workaround is setting OPTIONS["SENTINEL_KWARGS"] = {"socket_timeout": 1}.

    I think we should set a better default. ( It seems the current default is somewhere around 30 seconds, which means with two offline sentinels it would be around 60 seconds of hang. According to redis-py the default is gotten from the connection_kwargs, but I do not know where that is set)

    It should at least be documented.

    opened by neumantm 0
  • Add issue template

    Add issue template

    Many times people open issues for issues not related to bugs but for knowing how to use the library, I suggest to add some disclaimers in the issue template for looking for answers elsewhere, like stackoverflow, and also add tags to the issues automatically, like question, bug and so on.

    enhancement 
    opened by WisdomPill 0
  • Django-Redis on Heroku: Error while reading from socket: (104, 'Connection reset by peer')

    Django-Redis on Heroku: Error while reading from socket: (104, 'Connection reset by peer')

    I've uploaded my project on Heroku. Settings in the settings.py are as per the docs.

    CACHES = {"default": {"BACKEND": "django_redis.cache.RedisCache","LOCATION": os.environ.get('REDIS_URL'),"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",}}}

    However when I load a view function with "@cache_page" decorator, I get the error :

      Error while reading from socket: (104, 'Connection reset by peer'). The Images of error report are attached. Pictures are numbered in sequence. Same error is also displayed when I run the following in the shell

    from django.core.cache import cache cache.set("foo", "value", timeout=25)

    This too throws a connection error. Please suggest how to overcome this error!

    Picture2 Picture3 Picture4 Picture5 Picture6 Picture Picture1

    opened by rajesitb 2
  • Added python 3.10 beta 1 to CI

    Added python 3.10 beta 1 to CI

    Just so if there will be any issues we can tackle them and be ready for when it will be out of beta

    opened by WisdomPill 1
  • Use towncrier to generate release notes

    Use towncrier to generate release notes

    This issue is to investigate how much config is needed to configure towncrier or a similar tool to generate the release notes instead of manually generating them.

    An investigation in the form of a PR will be evaluated for its complexity, and upon approval will become part of the PR process, shifting the burden of release notes to happen during the PR review (this could still be added/adjusted by a maintainer instead of the original author, but at least the notes happen when the PR happens).

    good first issue 
    opened by terencehonles 0
  • Add a way to provide the sentinel master name in the configuration

    Add a way to provide the sentinel master name in the configuration

    In the current version, the master name is the redis url host. This PR kept it as the default but a SERVICE_NAME configuration parameter allows specifying it.

    The Sentinel part of the readme was also fixed and updated but the code block is still not displayed in the github main page. It seems to be related to the caption option as some other code blocks with caption are not displayed either.

    opened by j-bernard 3
  • [Discussion] Make other clients reflect DefaultClient methods?

    [Discussion] Make other clients reflect DefaultClient methods?

    I can't not notice how other clients do not have certain methods that are in DefaultClient I suggest to create issues for making them complaint and adding a not supported or implemented exception where needed.

    @terencehonles what do you think?

    Of course the question is open to everybody that wants to contribute

    question 
    opened by WisdomPill 0
  • Use Existing Connection Pool

    Use Existing Connection Pool

    Hi guys,

    i wanted to ask if there is the option to use an existing connection pool? I have redis-py already in place for huey and would love to pass in my SentinelConnectionPool to django-redis as well. So I need to define it once and can share it across all redis dependend clients.

    e.g. this is how it looks for huey

    
     'connection': {
            'connection_pool': SentinelConnectionPool(service_name="mymaster",
                                             sentinel_manager=sentinel.Sentinel([("localhost",26379)],
                                                                                password="XXXXXXX",
                                                                                socket_timeout=10,
                                                                                sentinel_kwargs={"password": "XXXXX"})
                                             ),
        },
    
    question 
    opened by ZuSe 8
  • Convert unittest class base tests to pytest function tests

    Convert unittest class base tests to pytest function tests

    By converting unittest class base tests to pytest function based tests we can use some nifty features of pytest such as fixtures* and parameterization :tada:

    See: https://docs.pytest.org/en/stable/unittest.html#pytest-features-in-unittest-testcase-subclasses

    Example of what needs to be done: #520

    enhancement good first issue help needed 
    opened by terencehonles 3
  • setup jazzband packaging

    setup jazzband packaging

    This may be what's needed for https://github.com/jazzband/django-redis/issues/430#issuecomment-812165986 as it was cribbed from another jazzband project.

    Anything more @jezdez ? Are there steps to get branch protection rules in place? Is the GitHub secret set per repo or for the org?

    opened by terencehonles 1
Owner
odyslam.eth
~danbex | ~sipsen-pilser
odyslam.eth
Ethereum (and Ethereum like) indexer using P2P message to fetch blocks and transactions

Ethereum P2P indexer This project is an indexer for Ethereum and Ethereum forks. It takes advantage of the ETH (Ethereum Wire Protocol) to fetch block

null 5 Nov 10, 2023
An Ethereum 2.0 Emulator for Local Testing of Eth2 Applications

Mousse is an Ethereum 2.0 emulator for local testing of Eth2 applications (mainly Rollups). HTTP Server The REST API definition can be found in the ht

Mousse 46 Sep 10, 2022
Key derivation and cryptographic signing functionality for Ethereum applications (ethers-rs)

ethers-signer-factory ethers-signer-factory is a Rust crate that provides functions for key derivation and signing of Ethereum transactions and messag

Ilia 3 Sep 27, 2023
CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework

CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework. CosmWasm is a secure and efficient smart contract platform designed specifically for the Cosmos ecosystem.

Vitalii Tsyhulov 20 Jun 9, 2023
Parity-Bridge — Bridge between any two ethereum-based networks

Deprecated Bridges This repo is deprecated. Originally it contained the ETH <> ETH-PoA bridge (see tumski tag). Later it was repurposed for ETH-PoA <>

Parity Technologies 314 Nov 25, 2022
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

?? Martinez ?? Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Arthur·Thomas 23 Jul 3, 2022
The Voting example based on MoonZoon and Solana + Anchor framework.

The Voting example based on MoonZoon and Solana + Anchor framework.

Martin Kavík 6 Aug 13, 2022
Selendra is a multichains interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications.

Selendra An interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications. Read

Selendra 16 Nov 29, 2022
Custom Ethereum vanity address generator made in Rust

ethaddrgen Custom Ethereum address generator Get a shiny ethereum address and stand out from the crowd! Disclaimer: Do not use the private key shown i

Jakub Hlusička 153 Dec 27, 2022
Rust Ethereum 2.0 Client

Lighthouse: Ethereum 2.0 An open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prime. Documentation Overview Lighthouse is: Read

Sigma Prime 2.1k Jan 6, 2023
The fast, light, and robust client for the Ethereum mainnet.

OpenEthereum Fast and feature-rich multi-network Ethereum client. » Download the latest release « Table of Contents Description Technical Overview Bui

OpenEthereum 1.6k Dec 28, 2022
C++ `std::unique_ptr` that represents each object as an NFT on the Ethereum blockchain

C++ `std::unique_ptr` that represents each object as an NFT on the Ethereum blockchain

null 1.9k Dec 28, 2022
Rust client to Opensea's APIs and Ethereum smart contracts

opensea.rs Rust bindings & CLI to the Opensea API and Contracts CLI Usage Run cargo r -- --help to get the top level help menu: opensea-cli 0.1.0 Choo

Georgios Konstantopoulos 226 Dec 27, 2022
Ethereum Improvement Proposal Validator

EIP validator An engine which ensures Ethereum Improvement Proposals meet certain requirements. Getting Started To install eipv and validate the EIPs

null 4 Dec 6, 2021
Terra Trophies is a copy of Ethereum's POAP project for Terra

Terra Trophies Terra Trophies is a copy of Ethereum's POAP project for Terra. It allows anyone to create digital badges for participants of events, or

larry.{ust,sol,thor} 18 Dec 7, 2022
An Ethereum compatible Substrate blockchain for bounties and governance for the Devcash community.

Substrate Node Template A fresh FRAME-based Substrate node, ready for hacking ?? Getting Started Follow the steps below to get started with the Node T

null 4 Mar 30, 2022
Scans the Ethereum network for USDT ERC-20 token transfer transactions

ethscan This is a Rust command line program for scanning the Ethereum blockchain for USDT transfers within a time span and amount span. prerequisites

Frank Buss 4 Oct 6, 2022
Terabethia - A Bridge and Messaging Protocol between Ethereum and the Internet Computer.

Terabethia - A Bridge Between Ethereum & the Internet Computer Terabethia is a bridge between Ethereum & the Internet Computer that contracts in both

Psychedelic 36 Dec 26, 2022
Emerging smart contract language for the Ethereum blockchain.

Emerging smart contract language for the Ethereum blockchain.

null 1.4k Jan 9, 2023