{"id":32164930,"url":"https://github.com/omgnetwork/ex_plasma","last_synced_at":"2025-10-21T14:56:12.507Z","repository":{"id":53520430,"uuid":"214584966","full_name":"omgnetwork/ex_plasma","owner":"omgnetwork","description":"Elixir library for the OMG Plasma Contracts Transaction Format","archived":false,"fork":false,"pushed_at":"2021-03-31T14:18:31.000Z","size":436,"stargazers_count":11,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-21T14:55:51.995Z","etag":null,"topics":["elixir","ethereum","omg","plasma","rlp"],"latest_commit_sha":null,"homepage":"https://omg.network/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omgnetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-12T05:38:38.000Z","updated_at":"2025-01-21T20:17:22.000Z","dependencies_parsed_at":"2022-08-30T22:13:06.943Z","dependency_job_id":null,"html_url":"https://github.com/omgnetwork/ex_plasma","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/omgnetwork/ex_plasma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omgnetwork%2Fex_plasma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omgnetwork%2Fex_plasma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omgnetwork%2Fex_plasma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omgnetwork%2Fex_plasma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omgnetwork","download_url":"https://codeload.github.com/omgnetwork/ex_plasma/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omgnetwork%2Fex_plasma/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280281397,"owners_count":26303709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","ethereum","omg","plasma","rlp"],"created_at":"2025-10-21T14:56:11.254Z","updated_at":"2025-10-21T14:56:12.503Z","avatar_url":"https://github.com/omgnetwork.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ExPlasma\n[![Build Status](https://circleci.com/gh/omgnetwork/ex_plasma.svg?style=svg)](https://circleci.com/gh/omgnetwork/ex_plasma)\n\nExPlasma is an Elixir library for encoding, decoding and validating transactions used for the OMG Network Plasma contracts.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `ex_plasma` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_plasma, \"~\u003e 0.2.0\"}\n  ]\nend\n```\n\nYou will also need to specify some configurations in your [config/config.exs]():\n\n```elixir\nconfig :ex_plasma,\n  eip_712_domain: %{\n    name: \"OMG Network\",\n    salt: \"0xfad5c7f626d80f9256ef01929f3beb96e058b8b4b0e3fe52d84f054c0e2a7a83\",\n    verifying_contract: \"0xd17e1233a03affb9092d5109179b43d6a8828607\",\n    version: \"1\"\n  }\n```\n\n## Setup\n\n`ExPlasma` requires Rust to be installed because it uses Rust NIFs for keccak hash and secp256k1.\n\n1. Clone the repo to your desktop `git@github.com:omgnetwork/ex_plasma.git`\n2. Run `mix compile` in your terminal.\n3. If there are any unavailable dependencies, run `mix deps.get`.\n\n## Usage\n\nTo build a transaction use `ExPlasma.Builder` module:\n\n``` elixir\n{:ok, txn} =\n  ExPlasma.payment_v1()\n  |\u003e ExPlasma.Builder.new()\n  |\u003e ExPlasma.Builder.add_input(blknum: 1, txindex: 0, oindex: 0)\n  |\u003e ExPlasma.Builder.add_output(output_type: 1, output_data: %{output_guard: \u003c\u003c1::160\u003e\u003e, token: \u003c\u003c0::160\u003e\u003e, amount: 1})\n  |\u003e ExPlasma.Builder.sign([\"0x79298b0292bbfa9b15705c56b6133201c62b798f102d7d096d31d7637f9b2382\"])\n{:ok,\n %ExPlasma.Transaction{\n   inputs: [\n     %ExPlasma.Output{\n       output_data: nil,\n       output_id: %{blknum: 1, oindex: 0, txindex: 0},\n       output_type: nil\n     }\n   ],\n   metadata: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n     0, 0, 0, 0, 0, 0, 0, 0, 0, 0\u003e\u003e,\n   nonce: nil,\n   outputs: [\n     %ExPlasma.Output{\n       output_data: %{\n         amount: 1,\n         output_guard: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n           0, 1\u003e\u003e,\n         token: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\u003e\u003e\n       },\n       output_id: nil,\n       output_type: 1\n     }\n   ],\n   sigs: [\n     \u003c\u003c236, 177, 165, 5, 109, 208, 210, 116, 68, 176, 199, 17, 168, 29, 30, 198,\n       77, 45, 233, 147, 149, 38, 93, 136, 24, 98, 53, 218, 52, 177, 200, 127,\n       26, 6, 138, 17, 36, 52, 97, 152, 240, 222, ...\u003e\u003e\n   ],\n   tx_data: 0,\n   tx_type: 1,\n   witnesses: []\n}}\n```\n\nYou can encode a transaction using `ExPlasma.encode/2`:\n\n``` elixir\n{:ok, rlp} = ExPlasma.encode(txn, signed: false)\n{:ok,\n \u003c\u003c248, 116, 1, 225, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 154, 202, 0, 238, 237, 1, 235, 148, 0, 0,\n   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 148, 0, 0, 0, 0, 0, 0,\n   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 128, 160, 0, 0, 0, 0, 0, 0, 0,\n   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\u003e\u003e}\n```\n\nYou can decode a transaction using `ExPlasma.decode/2`:\n\n``` elixir\n{:ok, txn} = ExPlasma.decode(rlp, signed: false)\n{:ok,\n %ExPlasma.Transaction{\n   inputs: [\n     %ExPlasma.Output{\n       output_data: nil,\n       output_id: %{blknum: 1, oindex: 0, position: 1000000000, txindex: 0},\n       output_type: nil\n     }\n   ],\n   metadata: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n     0, 0, 0, 0, 0, 0, 0, 0, 0, 0\u003e\u003e,\n   nonce: nil,\n   outputs: [\n     %ExPlasma.Output{\n       output_data: %{\n         amount: 1,\n         output_guard: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n           0, 1\u003e\u003e,\n         token: \u003c\u003c0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\u003e\u003e\n       },\n       output_id: nil,\n       output_type: 1\n     }\n   ],\n   sigs: [],\n   tx_data: 0,\n   tx_type: 1,\n   witnesses: []\n }}\n```\n\nYou can validate a transaction using `ExPlasma.validate/1`:\n\n``` elixir\nExPlasma.validate(txn)\n```\n\nView the [documentation](https://hexdocs.pm/ex_plasma)\n\n## Testing\n\nYou can run the tests by running;\n\n```sh\nmix test\nmix credo\nmix dialyzer\n```\n\nThis will load up Ganche and the plasma contracts to deploy.\n\n\n### Conformance test\n\nTo ensure we can encode/decode according to the contracts, we have a separate suite of conformance tests that\nloads up mock contracts to compare encoding results. You can run the test by:\n\n```sh\nmake up-mocks\nmix test --only conformance\n```\n\nThis will spin up ganache and deploy the mock contracts.\n\n## Contributing\n\n1. [Fork it!](https://github.com/omgnetwork/ex_plasma)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nExPlasma is released under the Apache-2.0 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomgnetwork%2Fex_plasma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomgnetwork%2Fex_plasma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomgnetwork%2Fex_plasma/lists"}