# Running a Relayer

**URL:** <https://forum.openzeppelin.com/t/running-a-relayer/1738>\
**Category:** Support\
**Created:** [November 12, 2019, 2:19am UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738 "2019-11-12T02:19:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nglglhtr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nglglhtr/32/1411_2.png) [@nglglhtr](https://forum.openzeppelin.com/u/nglglhtr)\
**Post date:** [November 12, 2019, 2:19am UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/1 "2019-11-12T02:19:38Z")

</div>

What I want to do is run a relayer on a custom network, which would entail the following:

1. deploy `relayhub` on the network
2. run a relayer from a reachable url
3. register relayer
4. fund dapp

I was having some trouble with the second step,  
i believe [https://github.com/OpenZeppelin/openzeppelin-gsn-helpers/releases](https://github.com/OpenZeppelin/openzeppelin-gsn-helpers/releases) this is where i can get a downloadable binary for my OS  
I’m using macOS Catalina (v10.15.1), could you guide me through the steps to installing the binary?

Also,  
was wondering, if running a relayer is only about getting a reachable URL - is it independent of the network `RelayHub` is deployed on?  
if yes, then is there a general purpose Relayer available, URL for which can be used directly?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 12, 2019, 7:42am UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/2 "2019-11-12T07:42:01Z")

</div>

Hi @nglglhtr,

> [@nglglhtr](#):
>
> could you guide me through the steps to installing the binary

For me on Windows this was just a matter of running the exe once downloaded from the command line.

On Linux (based on: [https://gist.github.com/spalladino/f516b46bdefb5e025c5d28daf7ad1491](https://gist.github.com/spalladino/f516b46bdefb5e025c5d28daf7ad1491)) I downloaded the Linux binary using curl

```auto
curl 'https://github.com/OpenZeppelin/openzeppelin-gsn-helpers/releases/download/v0.2.1/gsn-relay-linux-amd64' -o RelayHttpServer -L -s

```

Then ran it with default options

```auto
./RelayHttpServer 

```

For help:

```auto
./RelayHttpServer --help

```

For MacOS I assume the binary is darwin-amd64.

> [@nglglhtr](#):
>
> was wondering, if running a relayer is only about getting a reachable URL - is it independent of the network `RelayHub` is deployed on?  
> if yes, then is there a general purpose Relayer available, URL for which can be used directly?

Each Relayer is configured for a specific network. In the GSN multiple Relayers can be running. It is a matter of running the Relayer with the appropriate options for the network you are using.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 18, 2019, 12:26am UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/3 "2019-11-18T00:26:00Z")

</div>

Hi @nglglhtr,

I wanted to check how you got on running a relayer?

---

<div class="post-metadata">

**Author:** ![nglglhtr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nglglhtr/32/1411_2.png) [@nglglhtr](https://forum.openzeppelin.com/u/nglglhtr)\
**Post date:** [November 18, 2019, 4:35pm UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/4 "2019-11-18T16:35:32Z")

</div>

Hey @abcoathup,  
I was able to get a running relayer on my preferred network, thanks for all the help 🙂  
Had to switch OS though. Wasn’t able to get one up and running on MacOS Catalina. It was a breeze on Linux and Windows

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 18, 2019, 8:29pm UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/5 "2019-11-18T20:29:29Z")

</div>

Hi @nglglhtr,

Glad that you have the relayer running. Sorry that you had to switch OS.

Be great to hear about your experience running the GSN with Matic network.

---

<div class="post-metadata">

**Author:** ![nglglhtr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nglglhtr/32/1411_2.png) [@nglglhtr](https://forum.openzeppelin.com/u/nglglhtr)\
**Post date:** [December 24, 2019, 2:20pm UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/6 "2019-12-24T14:20:56Z")

</div>

hey @abcoathup  
so i was able to successfully run my GSN enabled contract on local dev environment (thanks to you 🙂 )  
i’m having some trouble in registering a relayer on matic’s test network  
so when i run

```auto
const provider = new HDWalletProvider(mnemonic, "https://testnetv3.matic.network");
const web3 = new Web3(provider);
registerRelay(web3, {
      relayUrl: 'http://localhost:8090'
}).then(console.log)

```

my account is deducted of 6 ETH, 5 of which go to an address that relayer provides and 1 goes to the contract relayHub  
i can see these transactions on the block explorer, but each time my console returns with the following error:

```auto
Will wait up to 30s for the relay to be ready
(node:14949) UnhandledPromiseRejectionWarning: Error: Failed to fund relay: 'Error: Relay not ready after 30s'

```

i tried increasing the timeout, but still face the same error

how should i go about resolving this?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 27, 2019, 5:50am UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/7 "2019-12-27T05:50:30Z")

</div>

Hi @nglglhtr,

I am not sure what the issue is here. Let me come back to you.

The relayer is returning ready as false, but the relay is apparently staked with the RelayHub and the Relayer is funded.

> <https://github.com/OpenZeppelin/openzeppelin-gsn-helpers/blob/master/src/register.js#L44>

---

<div class="post-metadata">

**Author:** ![nglglhtr](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nglglhtr/32/1411_2.png) [@nglglhtr](https://forum.openzeppelin.com/u/nglglhtr)\
**Post date:** [January 3, 2020, 3:20pm UTC](https://forum.openzeppelin.com/t/running-a-relayer/1738/8 "2020-01-03T15:20:01Z")

</div>

Yes! that was indeed the issue, but I later figured the problem had less to do with the register script and more to do with TruffleHDWalletProvider - i still haven’t pinned down the exact issue, but there is some nasty way that package works - it kept making my code go into loops  
anyway, fixed it using some other wallet 🙂
