 
   def init(config) do
     import Ecto.Query
-    %{account_name: account_name} = config
-    Logger.info("AuthorSync GenServer process for #{account_name} is being initialized...")
-    Repo.delete_all(from c in Glasnost.Post, where: c.author == ^account_name)
-
+    %{account_name: account_name, source_blockchain: source_blockchain} = config
+    Logger.info("AuthorSync GenServer process for #{account_name} and #{source_blockchain} is being initialized...")
+    Repo.delete_all(from c in Glasnost.Post, where: c.author == ^account_name and c.blockchain == ^source_blockchain)
     config = config
-      |> put_in([:client_mod], RuntimeConfig.blockchain_client_mod)
+      |> put_in([:client_mod], RuntimeConfig.blockchain_client_mod(config.source_blockchain))
       |> put_in([:current_cursor], "")
     Process.send_after(self(), :tick, 1_000)
     {:ok, config}

     end
  end

  def save_to_db(post) when is_map(post) do
     result =
       case Repo.get(Glasnost.Post, post["id"]) do
         nil  -> %Glasnost.Post{}
         comment -> comment
       end
       |> Glasnost.Post.changeset(post)

      |> Post.filter_by(:tags, filters[:tags])
      |> Post.filter_by(:title, filters[:title])
      |> Post.filter_by(:created, filters[:created])
      |> Enum.map( &Map.update!(&1, "created",  fn created -> NaiveDateTime.from_iso8601!(created) end))
      |> Enum.map( &Map.put(&1, "unix_epoch", &1["created"] |> DateTime.from_naive!("Etc/UTC") |> DateTime.to_unix()))

    for post <- posts do
         save_to_db(post, state.source_blockchain)
    end
    state = iterate(posts, state)
    {:noreply, state}
  end


